bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #27695] parser.sh ignores the closing quote when preceeded by a


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [bug #27695] parser.sh ignores the closing quote when preceeded by a variable
Date: Thu, 15 Oct 2009 15:28:02 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701)

Andreas Born wrote:
> URL:
>   <http://savannah.gnu.org/bugs/?27695>
>
>                  Summary: parser.sh ignores the closing quote when preceeded
> by a variable
>   
Attached patch should fix this bug
>                  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:
>   
>> set blub=blob
>> echo $blub
>>     
> blob
>   
>> echo "${blub}"
>>     
> blob
>   
>> echo "$blub"
>>
>>     
> => fails, the closing quote is ignored
>   
>> echo "$blub""
>>     
> blob
> => works as workaround
>
> The 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-grub
>
>   


-- 
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git 

diff --git a/ChangeLog b/ChangeLog
index b0864a9..db30e9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-10-15  Vladimir Serbinenko  <address@hidden>
 
+       * script/sh/lexer.c (grub_script_yylex): Prevent character from changing
+       state twice.
+
+2009-10-15  Vladimir Serbinenko  <address@hidden>
+
        * loader/i386/pc/xnu.c (grub_xnu_set_video): Fix loading splash image.
 
 2009-10-15  Vladimir Serbinenko  <address@hidden>
diff --git a/script/sh/lexer.c b/script/sh/lexer.c
index a30e3c0..0c71dae 100644
--- a/script/sh/lexer.c
+++ b/script/sh/lexer.c
@@ -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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]