fix and testcase for \$ in grub script dquote strings

This commit is contained in:
BVK Chaitanya 2010-04-13 20:58:12 +05:30
parent 4b0cd8f813
commit 4e6da157dd
2 changed files with 10 additions and 6 deletions

View 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

View 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); }
}