]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
fix and testcase for \$ in grub script dquote strings
authorBVK Chaitanya <bvk.groups@gmail.com>
Tue, 13 Apr 2010 15:28:12 +0000 (20:58 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Tue, 13 Apr 2010 15:28:12 +0000 (20:58 +0530)
conf/tests.rmk
script/yylex.l

index 11e5f2a1a0f5dcd0ee3bff06ef463218b1220bb4..d48bc3dd9fc3bffd5bd1e18eb187732cc48fa56a 100644 (file)
@@ -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
index 0cf33c9517c3e073178c3288639e5b7280892ba1..29aa5c2e3a73fd56486acb12d23ecbe9fb990a55 100644 (file)
@@ -211,7 +211,7 @@ WORD            ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
                   ARG (GRUB_SCRIPT_ARG_TYPE_TEXT);
                 }
   \\            |
-  [^\"\'$\\]+   { COPY (yytext, yyleng); }
+  [^\"\'\$\\]+  { COPY (yytext, yyleng); }
   <<EOF>>       {
                   yy_pop_state (yyscanner);
                   yypop_buffer_state (yyscanner);
@@ -254,6 +254,11 @@ WORD            ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
 }
 
 <DQUOTE>{
+  \\\$          { 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); }
 }