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.
This commit is contained in:
BVK Chaitanya 2010-04-13 21:25:27 +05:30
commit 8c4a72d4b5
4 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2010-04-13 BVK Chaitanya <bvk.groups@gmail.com>
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 <carles@pina.cat>
2010-04-13 Colin Watson <cjwatson@ubuntu.com>

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

View file

@ -0,0 +1,5 @@
#! /bin/sh -e
@builddir@/grub-script-check << EOF
echo "\\\$"
EOF