]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/script/argv.c (grub_script_argv_split_append): Skip leading
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 19 Mar 2012 12:29:43 +0000 (13:29 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 19 Mar 2012 12:29:43 +0000 (13:29 +0100)
spaces.
* tests/grub_script_leading_whitespace.in: New file.
* Makefile.util.def (grub_script_leading_whitespace): New test.

ChangeLog
Makefile.util.def
grub-core/script/argv.c
tests/grub_script_leading_whitespace.in [new file with mode: 0644]

index bacd6cc4c5f984b3a1d61fddc51afc2b41c5bb47..77a37e9554979f47dbeea53865ad281da7a0ed44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-19  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/script/argv.c (grub_script_argv_split_append): Skip leading
+       spaces.
+       * tests/grub_script_leading_whitespace.in: New file.
+       * Makefile.util.def (grub_script_leading_whitespace): New test.
+
 2012-03-19  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/kern/dl.c (grub_dl_add): Make global in order for gdb_grub
index c41b76e0ceb7584d38e314a1392e046c9c1cbe2a..85e71ed60ccc0d76662e6ffc427b7678587d381b 100644 (file)
@@ -540,6 +540,12 @@ script = {
   common = tests/grub_script_echo1.in;
 };
 
+script = {
+  testcase;
+  name = grub_script_leading_whitespace;
+  common = tests/grub_script_leading_whitespace.in;
+};
+
 script = {
   testcase;
   name = grub_script_echo_keywords;
index b58d3e658967b4a715198cfb035c62d835df0c4f..217ec5d1e1b2fda0ca9ff633f60a2f12a57667e3 100644 (file)
@@ -132,6 +132,9 @@ grub_script_argv_split_append (struct grub_script_argv *argv, const char *s)
   if (! s)
     return 0;
 
+  while (*s && grub_isspace (*s))
+    s++;
+
   while (! errors && *s)
     {
       p = s;
diff --git a/tests/grub_script_leading_whitespace.in b/tests/grub_script_leading_whitespace.in
new file mode 100644 (file)
index 0000000..d5946ba
--- /dev/null
@@ -0,0 +1,4 @@
+#! @builddir@/grub-shell-tester
+
+list=" 1 2 3"
+echo $list