parser.sh ignores the closing quote when preceeded by a variable
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Andreas Born
URL:
<http://savannah.gnu.org/bugs/?27695>Summary:
parser.shignores the closing quote when preceeded
by a variable
Attached patch should fix this bug
Quoted 70 lines
Project: GNU GRUB
Submitted by: shador
Submitted on: Di 13 Okt 2009 21:11:16 GMT
Category: Terminal
Severity: Major
Priority: 5 - Normal
Item Group: Software Error
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release:
Release: SVN
Reproducibility: Every Time
Planned Release: None_______________________________________________________
Details:
The problem is reproducible with this example:
Quoted 3 lines
set blub=blob
echo $blubblob
Quoted 2 lines
echo "${blub}"
blob
Quoted 3 lines
echo "$blub"
=> fails, the closing quote is ignored
Quoted 2 lines
echo "$blub""
blob
=> works as workaroundThe real trouble starts with strings containing spaces. But it can be fixed, as shown, by adding another quote at the end or using ${...}.
This was tested with beta~4.
_______________________________________________________Reply to this item at:
<http://savannah.gnu.org/bugs/?27695>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.gnu.org/_______________________________________________
Bug-grub mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-grub
Signature · 3 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +5 -0
@@ -1,5 +1,10 @@ 2009-10-15 Vladimir Serbinenko <[email protected]> + * script/sh/lexer.c (grub_script_yylex): Prevent character from changing + state twice. + +2009-10-15 Vladimir Serbinenko <[email protected]> + * loader/i386/pc/xnu.c (grub_xnu_set_video): Fix loading splash image. 2009-10-15 Vladimir Serbinenko <[email protected]>
script/sh/lexer.c +5 -4
@@ -350,9 +350,11 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)if (! (check_varstate (newstate))) {if (state->state ==GRUB_PARSER_STATE_VARNAME2 - || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) -nextchar (state); - state->state = newstate; + || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) + { +nextchar (state); + state->state = newstate; + }break ; }
@@ -378,7 +380,6 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate) buffer[bufpos++] =0 ; - state->state = newstate; yylval->arg =grub_script_arg_add (parsestate, yylval->arg,GRUB_SCRIPT_ARG_TYPE_VAR , buffer);grub_dprintf ("scripting" ,"vartoken=`%s'\n" , buffer);
Quoted 20 lines · Vladimir 'phcoder' Serbinenko
script/sh/lexer.c +5
-3@@ -350,9 +350,11 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)if (! (check_varstate (newstate))) {if (state->state ==GRUB_PARSER_STATE_VARNAME2 - || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) -nextchar (state); - state->state = newstate; + || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) + { +nextchar (state); + state->state = newstate; + }break ; }
script/sh/lexer.c grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate) · line 385
Quoted 7 lines
script/sh/lexer.c +0
-1@@ -378,7 +380,6 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate) buffer[bufpos++] =0 ; - state->state = newstate; yylval->arg =grub_script_arg_add (parsestate, yylval->arg,GRUB_SCRIPT_ARG_TYPE_VAR , buffer);grub_dprintf ("scripting" ,"vartoken=`%s'\n" , buffer);
Same here, I'm afraid.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Problem exists still as of r1917. I've attached a rediffed version of Vladimir's patch. The behaviour without the patch changed (it's even more confusing), but it's basically still the same:
grub> echo "$root"
grub>"
hd0,1
Quoted 93 lines · Vladimir 'phcoder' Serbinenko
Quoted 7 lines · Andreas Born
URL:
<http://savannah.gnu.org/bugs/?27695>Summary:
parser.shignores the closing quote when preceeded
by a variableAttached patch should fix this bug
Quoted 79 lines
Project: GNU GRUB
Submitted by: shador
Submitted on: Di 13 Okt 2009 21:11:16 GMT
Category: Terminal
Severity: Major
Priority: 5 - Normal
Item Group: Software Error
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release:
Release: SVN
Reproducibility: Every Time
Planned Release: None_______________________________________________________
Details:
The problem is reproducible with this example:
Quoted 4 lines
set blub=blob
echo $blubblob
Quoted 3 lines
echo "${blub}"
blob
Quoted 4 lines
echo "$blub"
=> fails, the closing quote is ignored
Quoted 3 lines
echo "$blub""
blob
=> works as workaroundThe real trouble starts with strings containing spaces. But it can be fixed, as shown, by adding another quote at the end or using ${...}.
This was tested with beta~4.
_______________________________________________________Reply to this item at:
<http://savannah.gnu.org/bugs/?27695>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.gnu.org/_______________________________________________
Bug-grub mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-grub
=== modified file 'script/lexer.c'
lexer.c +5 -4
@@ -350,9 +350,11 @@if (! (check_varstate (newstate))) {if (state->state ==GRUB_PARSER_STATE_VARNAME2 - || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) -nextchar (state); - state->state = newstate; + || state->state ==GRUB_PARSER_STATE_QVARNAME2 ) + { +nextchar (state); + state->state = newstate; + }break ; }
@@ -378,7 +380,6 @@ buffer[bufpos++] =0 ; - state->state = newstate; yylval->arg =grub_script_arg_add (parsestate, yylval->arg,GRUB_SCRIPT_ARG_TYPE_VAR , buffer);grub_dprintf ("scripting" ,"vartoken=`%s'\n" , buffer);