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

Re: [libvirt] [PATCH] qemu: Add quotes to kernel command line of direct kernel boot



Thanks Eric! After reading the code of virCommandRun and virExecWithHook, I know there is no problem of passing arguments.

On 08/28/2012 12:06, Eric Blake wrote:
On 08/27/2012 08:05 PM, Zhou Zheng Sheng wrote:
When passing kernel command line arguments, it is possible to have
spaces. The arguments should be protected in qoutes.
NACK.


If the contents in <cmdline> are passed as-is to qemu, then qemu will see
   qemu ... -append console=ttyS0 ks=http://example.com/f8-i386/os/ ...
That's what shows in the guest log, because we don't (yet) properly
quote arguments in the log.  But if you look at what we actually pass to
the exec() family,...


          if (def->os.cmdline)
-            virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
...this code properly passes def->os.cmdline as a single exec()
argument.  Remember, virCommand is NOT subject to further shell
interpretation.  You are getting confused by trying to treat the log
output as though libvirt were invoking /bin/sh to start the command,
instead of calling exec() directly.

If anything, the real bug to fix would be virCommandToString to have a
mode that lists the output with shell quoting as needed, and to use that
mode when outputting log file information.


--
Thanks and best regards!

Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou linux vnet ibm com
Telephone: 86-10-82454397


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