[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 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 !

>  src/qemu/qemu_conf.c                            |   20 ++++++++++----------
>  tests/qemuxml2argvdata/qemuxml2argv-smbios.args |    2 +-
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 925585a..8985241 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -3622,16 +3622,16 @@ static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
> 
>      /* 0:Vendor */
>      if (def->bios_vendor)
> -        virBufferVSprintf(&buf, ",vendor=\"%s\"", def->bios_vendor);
> +        virBufferVSprintf(&buf, ",vendor=%s", def->bios_vendor);
>      /* 0:BIOS Version */
>      if (def->bios_version)
> -        virBufferVSprintf(&buf, ",version=\"%s\"", def->bios_version);
> +        virBufferVSprintf(&buf, ",version=%s", def->bios_version);
>      /* 0:BIOS Release Date */
>      if (def->bios_date)
> -        virBufferVSprintf(&buf, ",date=\"%s\"", def->bios_date);
> +        virBufferVSprintf(&buf, ",date=%s", def->bios_date);
>      /* 0:System BIOS Major Release and 0:System BIOS Minor Release */
>      if (def->bios_release)
> -        virBufferVSprintf(&buf, ",release=\"%s\"", def->bios_release);
> +        virBufferVSprintf(&buf, ",release=%s", def->bios_release);
> 
>      if (virBufferError(&buf)) {
>          virReportOOMError();
> @@ -3658,23 +3658,23 @@ static char *qemuBuildSmbiosSystemStr(virSysinfoDefPtr def)
> 
>      /* 1:Manufacturer */
>      if (def->system_manufacturer)
> -        virBufferVSprintf(&buf, ",manufacturer=\"%s\"",
> +        virBufferVSprintf(&buf, ",manufacturer=%s",
>                            def->system_manufacturer);
>       /* 1:Product Name */
>      if (def->system_product)
> -        virBufferVSprintf(&buf, ",product=\"%s\"", def->system_product);
> +        virBufferVSprintf(&buf, ",product=%s", def->system_product);
>      /* 1:Version */
>      if (def->system_version)
> -        virBufferVSprintf(&buf, ",version=\"%s\"", def->system_version);
> +        virBufferVSprintf(&buf, ",version=%s", def->system_version);
>      /* 1:Serial Number */
>      if (def->system_serial)
> -        virBufferVSprintf(&buf, ",serial=\"%s\"", def->system_serial);
> +        virBufferVSprintf(&buf, ",serial=%s", def->system_serial);
>      /* 1:UUID */
>      if (def->system_uuid)
> -        virBufferVSprintf(&buf, ",uuid=\"%s\"", def->system_uuid);
> +        virBufferVSprintf(&buf, ",uuid=%s", def->system_uuid);
>      /* 1:SKU Number */
>      if (def->system_sku)
> -        virBufferVSprintf(&buf, ",sku=\"%s\"", def->system_sku);
> +        virBufferVSprintf(&buf, ",sku=%s", def->system_sku);
> 
>      if (virBufferError(&buf)) {
>          virReportOOMError();
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
> index d5bd289..bd3ede4 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
> @@ -1 +1 @@
> -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -smbios type=0,vendor="QEmu/KVM",version="0.13" -smbios type=1,manufacturer="Fedora",product="Virt-Manager",version="0.8.2-3.fc14",serial="32dfcb37-5af1-552b-357c-be8c3aa38310",uuid="c7a5fdbd-edaf-9455-926a-d65c16db1809" -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -smbios type=0,vendor=QEmu/KVM,version=0.13 -smbios type=1,manufacturer=Fedora,product=Virt-Manager,version=0.8.2-3.fc14,serial=32dfcb37-5af1-552b-357c-be8c3aa38310,uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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