В Thu, 04 Jun 2015 19:24:51 +0200 Jiri Jaburek <[email protected]> пишет:
> Hello, > the documentation [1] for linux / linux16 mentions that > > "The rest of the line is passed verbatim as the kernel command-line." > > which is false, I was able to cause > > error: syntax error. > error: Incorrect command. > error: syntax error. > > by specifying & (ampersand character) on the command line. > (Yes, grub2.cfg, not the shell generation logic.) > Like in "normal" shell commands receive arguments after pre-processing by shell (grub CLI). grub documentation explicitly says that "&" is metacharacter and needs to be quoted if you want to include it verbatim. > Quoting the character seems to help, but that further proves that > grub doesn't treat even the quotes as verbatim text. > > Since I have all this as part of a more complex infrastructure, > it's impossible to hand-edit every such occurrence - could you please > tell me which characters have special meaning (aside from newline) > and/or confirm that the current behavior (not treating text as > verbatim) is a bug? > > If it is a feature, what would be the easiest way to make grub > treat unknown (external) kernel cmdline as valid? Quoting the entire > cmdline (after kernel filename) seems to leave the quotes intact and > take the cmdline as verbatim, but I don't want the extra quotes to > be there if I need them to make grub treat the cmdline as verbatim > in the first place. > > TL;DR: > > - this works: > linux16 /somekernel opt1 opt2 opt3 > > - this triggers syntax error: > linux16 /somekernel opt1 opt2&opt3 > > - this works, but removes the quotes: > linux16 /somekernel opt1 "opt2&opt3" > Are you surprised that echo "opt2&opt3" outputs opt2&opt3 without quotes? > - this also works, but leaves the quotes intact: > linux16 /somekernel "opt1 opt2&opt3" > Yes, this is a bit magical. GRUB sees space in argument and quotes it so kernel will correctly parse it as a single word and not split in multiple arguments. Think about it it as a syntactic sugar which frees user from using extra quotes like linux /vmlinuz '"single argument with spaces"' May be it should be explicitly mentioned in documentation. > Reproducible with grub-2.02 on x86 and powerpc at least, on > RHEL/Fedora, but reproduced with Super Grub Disk, so it's not > downstream-specific. > > Thanks, > Jiri > > > [1]: http://www.gnu.org/software/grub/manual/grub.html#linux > > _______________________________________________ > Help-grub mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-grub _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
