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 <mch...@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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to