Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1M0ayy-0001II-6B for mharc-grub-devel@gnu.org; Sun, 03 May 2009 08:39:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0ayw-0001Gw-DZ for grub-devel@gnu.org; Sun, 03 May 2009 08:39:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0ayr-0001Gj-8b for grub-devel@gnu.org; Sun, 03 May 2009 08:39:45 -0400 Received: from [199.232.76.173] (port=57713 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0ayr-0001Gg-34 for grub-devel@gnu.org; Sun, 03 May 2009 08:39:41 -0400 Received: from mail-ew0-f162.google.com ([209.85.219.162]:46766) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M0ayq-0004Xo-Aw for grub-devel@gnu.org; Sun, 03 May 2009 08:39:40 -0400 Received: by ewy6 with SMTP id 6so3390520ewy.42 for ; Sun, 03 May 2009 05:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=ZHmMK6Lsi/0ZE0cT8F52QD4b2EayggvXZgM4jk9bUL4=; b=YJ1bnUrEV+3H7XU8HI+b0kUnFxNo+qkJT2bIS3gClNgUvAhZDrizjqC6RMXIV1LUA+ wyUJ6skmJfL3Spj8yCWNVVal90DUAeIODJ0g80XUsIp1DujBeklzaRMGy1R6KHVxYcvT t7RGGFQonmnqjuVeMR/uO1OXHasCHPlOiB72E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=SvQGZ4GtGtETcIq9Ke913ruH70gsA4NhpWD/1BoGGLp8JaDGjO3HoPPydyC3fB3kMp 3aRMKlviqY1otbGmG8zFjxM9vnonpDKmpPZs1MEK0C/ACf4nD2Vbppo4zN8Akq1doOSg gTfr6SaPgnCBwLdMdoOLbAhxACdcSrGBxzfGg= MIME-Version: 1.0 Received: by 10.210.119.5 with SMTP id r5mr4932095ebc.30.1241354379251; Sun, 03 May 2009 05:39:39 -0700 (PDT) In-Reply-To: References: Date: Sun, 3 May 2009 14:39:39 +0200 Message-ID: From: "Vladimir 'phcoder' Serbinenko" To: The development of GRUB 2 Content-Type: multipart/alternative; boundary=000e0cd1fab6d0d14b046901565c X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [BUGFIX] lexer waits for space to terminate the varname X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2009 12:39:46 -0000 --000e0cd1fab6d0d14b046901565c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Sun, May 3, 2009 at 2:37 PM, Bean wrote: > Hi, > > On Sun, May 3, 2009 at 5:12 PM, Vladimir 'phcoder' Serbinenko > wrote: > > Hello > > > > On Sat, May 2, 2009 at 4:08 PM, Bean wrote: > >> > >> 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}, > > > > It's not the same starting state. However similar issue exists with ' ' > and > > '\"' > > Oh right, I copy the wrong sample. > > >> > >> 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. > > > > Perhaps we should switch to just ordering the transition rules instead of > > separate code for default value > >> > >> 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, > > > > It can be a workaround but the bug is still here. The following pieces > of > > code fail: > > 1) echo $hello; > > 2) echo $hello > > > > Yeah, and there are other varieties as well, such as -. Perhaps it'd > be simpler to use your fix for now, but you should add some comment in > the source code to indicate its purpose. What about making it rely on order of rules? It should make it more compact > > > >> 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 > >> 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 > >> > Grub-devel@gnu.org > >> > http://lists.gnu.org/mailman/listinfo/grub-devel > >> > > >> > > >> > >> > >> > >> -- > >> Bean > >> > >> > >> _______________________________________________ > >> Grub-devel mailing list > >> Grub-devel@gnu.org > >> http://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > > > -- > > Regards > > Vladimir 'phcoder' Serbinenko > > > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > http://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > > > -- > Bean > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > -- Regards Vladimir 'phcoder' Serbinenko --000e0cd1fab6d0d14b046901565c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Sun, May 3, 2009 at 2:37 PM, Bean <bean123ch@gmail.c= om> wrote:
Hi,

On Sun, May 3, 2009 at 5:12 PM, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.co= m> wrote:
> Hello
>
> On Sat, May 2, 2009 at 4:08 PM, Bean <bean123ch@gmail.com> wrote:
>>
>> Hi,
>>
>> I think there is problem with this patch. Consider ${aa}, the clos= ing
>> character "}" would be left out.
>>
>> Although you can remedy this by swapping:
>>
>> =A0{ GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, ' '= ;, 1},
>> =A0{ GRUB_PARSER_STATE_VARNAME2, GRUB_PARSER_STATE_TEXT, '}= 9;, 0},
>
> It's not the same starting state. However similar issue exists wit= h ' ' and
> '\"'

Oh right, I copy the wrong sample.

>>
>> so that '}' would be handled before ' ', but it= 9;s still not a good
>> practice, as you have added a logic in code that would depend on t= he
>> order of state_transitions, which is not apparent for casual code<= br> >> viewer.
>
> Perhaps we should switch to just ordering the transition rules instead= of
> separate code for default value
>>
>> 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,
>
> It can be a workaround=A0 but the bug is still here. The following pie= ces of
> code fail:
> 1) echo $hello;
> 2) echo $hello
>

Yeah, and there are other varieties as well, such as -. Perhaps it= 9;d
be simpler to use your fix for now, but you should add some comment in
the source code to indicate its purpose.
What about making= it rely on order of rules? It should make it more compact


>> or add the terminating
>> character explicitly in the transition table:
>>
>>
>> =A0{ GRUB_PARSER_STATE_VARNAME, GRUB_PARSER_STATE_TEXT, '/ = 9;, 1},
>>
>>
>> On Sat, May 2, 2009 at 8:02 PM, Vladimir 'phcoder' Serbine= nko
>> <phcoder@gmail.com>= 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
>> > Grub-devel@gnu.org<= br> >> > http://lists.gnu.org/mailman/listinfo/grub-devel
>> >
>> >
>>
>>
>>
>> --
>> Bean
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>
> --
> Regards
> Vladimir 'phcoder' Serbinenko
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>



--
Bean


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel



--
Regards
= Vladimir 'phcoder' Serbinenko
--000e0cd1fab6d0d14b046901565c--