[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv2 1/5] qemu: avoid adding "" in smbios arguments



On 12/05/2010 12:57 AM, Daniel Veillard wrote:
> On Fri, Dec 03, 2010 at 02:56:14PM -0700, Eric Blake wrote:
>> The log lists things like -smbios type=1,vendor="Red Hat", which
>> is great for shell parsing, but not so great when you realize that
>> execve() then passes those literal "" on as part of the command
>> line argument, such that qemu sets SMBIOS with extra literal quotes.
> 
>   Hum, I was afraid that QEmu parsing would fail in case of spaces if
> there is no quote, but if you checked this, sure !

What's happening here is that we are building up execve arguments, and
supplying roughly:

"qemu" "-smbios" "type=0,vendor=\"Red Hat\",version=\"Fedora 14\""

instead of the intended:

"qemu" "-smbios" "type=0,vendor=Red Hat,version=Fedora 14"

Although qemu uses a hand-rolled loop instead of getsubopt(), it looks
like qemu is using the same algorithm as getsubopt, where it parses
everything between '=' and ',', including spaces, as the subopt
argument.  At any rate, yes, I did test this; the only thing you can't
pass through qemu's -smbios is a literal comma, but that's already
excluded from our domain.rng schema. :)

>   ACK,

Thanks; I've pushed 1 through 4; I'm waiting to push 5 until after my
virCommand buffer patches have been ACK'd, so as to avoid any question
of any potential NULL dereferences due to the virCommandSetOutputBuffer
calls.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]