diff --git a/ChangeLog b/ChangeLog index bacd6cc4c..77a37e955 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-03-19 Vladimir Serbinenko + + * 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 * grub-core/kern/dl.c (grub_dl_add): Make global in order for gdb_grub diff --git a/Makefile.util.def b/Makefile.util.def index c41b76e0c..85e71ed60 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -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; diff --git a/grub-core/script/argv.c b/grub-core/script/argv.c index b58d3e658..217ec5d1e 100644 --- a/grub-core/script/argv.c +++ b/grub-core/script/argv.c @@ -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 index 000000000..d5946ba40 --- /dev/null +++ b/tests/grub_script_leading_whitespace.in @@ -0,0 +1,4 @@ +#! @builddir@/grub-shell-tester + +list=" 1 2 3" +echo $list