diff --git a/ChangeLog b/ChangeLog index 4be24c1b2..7097a3c6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-04-13 BVK Chaitanya + + Fix for escaped dollar in double quoted strings. + + * script/yylex.l: Updated flex rules. + * conf/tests.rmk: Rule for new testcase. + * tests/grub_script_dollar.in: New testcase. + 2010-04-13 Carles Pina i Estany 2010-04-13 Colin Watson diff --git a/conf/tests.rmk b/conf/tests.rmk index 11e5f2a1a..d48bc3dd9 100644 --- a/conf/tests.rmk +++ b/conf/tests.rmk @@ -65,6 +65,9 @@ grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in check_SCRIPTS += grub_script_final_semicolon grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in +check_SCRIPTS += grub_script_dollar +grub_script_dollar_SOURCES = tests/grub_script_dollar.in + # List of tests to execute on "make check" # SCRIPTED_TESTS = example_scripted_test # SCRIPTED_TESTS += example_grub_script_test @@ -79,7 +82,7 @@ SCRIPTED_TESTS += grub_script_while1 SCRIPTED_TESTS += grub_script_if SCRIPTED_TESTS += grub_script_blanklines SCRIPTED_TESTS += grub_script_final_semicolon - +SCRIPTED_TESTS += grub_script_dollar # dependencies between tests and testing-tools $(SCRIPTED_TESTS): grub-shell grub-shell-tester diff --git a/script/yylex.l b/script/yylex.l index 0cf33c951..29aa5c2e3 100644 --- a/script/yylex.l +++ b/script/yylex.l @@ -211,7 +211,7 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+ ARG (GRUB_SCRIPT_ARG_TYPE_TEXT); } \\ | - [^\"\'$\\]+ { COPY (yytext, yyleng); } + [^\"\'\$\\]+ { COPY (yytext, yyleng); } <> { yy_pop_state (yyscanner); yypop_buffer_state (yyscanner); @@ -254,6 +254,11 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+ } { + \\\$ { COPY ("$", 1); } + \\\\ { COPY ("\\", 1); } + \\\" { COPY ("\"", 1); } + \\\n { /* ignore */ } + [^\"\$\\\n]+ { COPY (yytext, yyleng); } \" { yy_pop_state (yyscanner); ARG (GRUB_SCRIPT_ARG_TYPE_DQSTR); @@ -262,10 +267,6 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+ yy_push_state (VAR, yyscanner); ARG (GRUB_SCRIPT_ARG_TYPE_DQSTR); } - \\\\ { COPY ("\\", 1); } - \\\" { COPY ("\"", 1); } - \\\n { /* ignore */ } - [^\"$\\\n]+ { COPY (yytext, yyleng); } (.|\n) { COPY (yytext, yyleng); } } diff --git a/tests/grub_script_dollar.in b/tests/grub_script_dollar.in new file mode 100644 index 000000000..3819b8bc9 --- /dev/null +++ b/tests/grub_script_dollar.in @@ -0,0 +1,5 @@ +#! /bin/sh -e + +@builddir@/grub-script-check << EOF +echo "\\\$" +EOF