grub-devel
[Top][All Lists]
Advanced

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

Re: [BUGFIX] lexer waits for space to terminate the varname


From: Bean
Subject: Re: [BUGFIX] lexer waits for space to terminate the varname
Date: Sat, 2 May 2009 22:08:36 +0800

Hi,

I think there is problem with this patch. Consider ${aa}, the closing
character "}" would be left out.

Although you can remedy this by swapping:

  { GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, ' ', 1},
  { GRUB_PARSER_STATE_VARNAME2, GRUB_PARSER_STATE_TEXT, '}', 0},

so that '}' would be handled before ' ', but it's still not a good
practice, as you have added a logic in code that would depend on the
order of state_transitions, which is not apparent for casual code
viewer. Also, ' ' might be used for other transition in the future,
this code could break that. I suggest you use {} to enclose the
variable that doesn't terminated with space, or add the terminating
character explicitly in the transition table:


  { GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, '/ ', 1},


On Sat, May 2, 2009 at 8:02 PM, Vladimir 'phcoder' Serbinenko
<address@hidden> wrote:
> Hello. A varname may be terminated by any character which isn't in a set
> [A-Za-z0-9_] and not only space. Here is a fix
>
> --
> Regards
> Vladimir 'phcoder' Serbinenko
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>



-- 
Bean




reply via email to

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