From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: Seth Goldberg <seth.goldberg@oracle.com>,
The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: default menuentry matching similar entries is broken
Date: Sat, 03 Mar 2012 15:12:17 +0100 [thread overview]
Message-ID: <4F5226C1.4000202@gmail.com> (raw)
In-Reply-To: <31DA57F5-04BF-42DA-811D-277D5FD1E7B7@oracle.com>
On 03.03.2012 15:02, Seth Goldberg wrote:
> Sigh. I thought I tracked it down to this code, but it was late. I'll double-check. The buggy behavior is as I described -- this just may not be the actual root cause. BTW, with the code below, does this mean that having '>' characters in the title of menuentries is forbidden?
No, just that you have to escape it with double >. E.g.
default="weird>>submenu>entry"
> Thanks,
> --S
>
>
> On Mar 3, 2012, at 3:09 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>
>> On 03.03.2012 08:33, Seth Goldberg wrote:
>>> Hi,
>>>
>>> This code in menu.c::menuentry_eq() looks wrong:
>>>
>>> {
>>> const char *ptr1, *ptr2;
>>> ptr1 = title;
>>> ptr2 = spec;
>>> while (1)
>>> {
>>> if (*ptr2 == '>'&& ptr2[1] != '>'&& *ptr1 == 0)
>>> return 1;
>>> if (*ptr2 == '>'&& ptr2[1] != '>')
>>> return 0;
>>> if (*ptr2 == '>')
>>> ptr2++;
>>> if (*ptr1 != *ptr2)
>>> return 0;
>>> if (*ptr1 == 0)<----
>>> return 1;
>>> ptr1++;
>>> ptr2++;
>>> }
>>> }
>>>
>>>
>>> Specifically, if there are two menuentries that differ by adding characters, this function will match the wrong one, i.e.:
>> Have you actually tested this? Since from the code readin just before it we have:
>>
>> if (*ptr1 != *ptr2)
>> return 0;
>>
>> So the code you point at is trigered only if both *ptr1 and *ptr2 are 0
>>> Also, what's the deal with the '>' characters? What are they supposed to do? I can't seem to find the use of'>' documented anywhere.
>> It's for submenus:
>> "submenu>subsubmenu>entry"
>>> Thanks,
>>> --S
>>> _______________________________________________
>>> Grub-devel mailing list
>>> Grub-devel@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>>
>>
>> --
>> Regards
>> Vladimir 'φ-coder/phcoder' Serbinenko
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
next prev parent reply other threads:[~2012-03-03 14:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-03 7:33 default menuentry matching similar entries is broken Seth Goldberg
2012-03-03 11:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] ` <31DA57F5-04BF-42DA-811D-277D5FD1E7B7@oracle.com>
2012-03-03 14:12 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-03-03 18:10 ` Andreas Vogel
2012-03-03 18:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-03 19:04 ` Andreas Vogel
2012-03-03 19:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-03 19:29 ` Andreas Vogel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F5226C1.4000202@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
--cc=seth.goldberg@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.