All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pass kernel command line as verbatim
@ 2018-04-11  8:58 Michael Chang
  2018-04-11  9:17 ` Michael Chang
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Chang @ 2018-04-11  8:58 UTC (permalink / raw)
  To: grub-devel

The command line has been processed by grub shell, then the result is expected
to be passed to kernel command line as verbatim according to the grub manual
[1][2].

This patch removes extra escape character added as it helps nothing but only
creates trouble as you want them to be literal. Besides the surrounding
double-quotes added is kept as it used to protect space.

[1] https://www.gnu.org/software/grub/manual/grub/html_node/linux.html#linux
[2] https://www.gnu.org/software/grub/manual/grub/html_node/xen_005fhypervisor.html

Signed-off-by: Michael Chang <mchang@suse.com>
---
 grub-core/lib/cmdline.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index d5e10ee87..26b8131c8 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -27,9 +27,7 @@ static unsigned int check_arg (char *c, int *has_space)
 
   while (*c)
     {
-      if (*c == '\\' || *c == '\'' || *c == '"')
-	size++;
-      else if (*c == ' ')
+      if (*c == ' ')
 	space = 1;
 
       size++;
@@ -84,13 +82,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
 	*buf++ = '"';
 
       while (*c)
-	{
-	  if (*c == '\\' || *c == '\'' || *c == '"')
-	    *buf++ = '\\';
-
-	  *buf++ = *c;
-	  c++;
-	}
+	*buf++ = *c++;
 
       if (space)
 	*buf++ = '"';
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-11  7:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11  8:58 [PATCH] pass kernel command line as verbatim Michael Chang
2018-04-11  9:17 ` Michael Chang
2018-04-17 16:37   ` Daniel Kiper
2018-04-18  7:07     ` Michael Chang
2018-04-24 10:03       ` Daniel Kiper
2018-04-26  8:42         ` Michael Chang
2018-05-09 13:23           ` Daniel Kiper
2018-05-11  7:01             ` Michael Chang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.