[PATCH v2 1/7] util: introduce a parser for kernel cmdline arguments

Paulo de Rezende Pinatti ppinatti at linux.ibm.com
Wed Jun 10 14:24:54 UTC 2020

On 10/06/20 15:55, Paulo de Rezende Pinatti wrote:
>>> +    { " arg3\" escaped=val2\"",                         "arg3\" 
>>> escaped", "val2",                "" },
>> ^Is this even valid for the kernel itself? Looking at [1], they 
>> clearly don't
>> allow escaped \" in the arg/value.
>> [1] 
>> https://github.com/torvalds/linux/blob/db54615e21419c3cb4d699a0b0aa16cc44d0e9da/lib/cmdline.c 
> I guess the word "escaped" in this test is a bit misleading; it's 
> actually escaping the blank space, not the quote itself. This is valid 
> for the kernel. In order to assure our parsing results would match those 
> of the kernel I executed the code in cmdline.c in a standalone file to 
> generate the reference values for the test.
> I'll change "arg3\" escaped" to "arg3\" with spaces" to clearly state 
> the intention here.

I forgot to mention that while double checking the reference values I 
had to add a missing trailing double quote to the expected result value 
in order to match what the kernel produces for this case. So this is 
actually "val2\"".

Best regards,

Paulo de Rezende Pinatti

More information about the libvir-list mailing list