All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: Release of 2.00~rc1
Date: Tue, 26 Jun 2012 04:46:18 +0200	[thread overview]
Message-ID: <4FE9227A.3010808@gmail.com> (raw)
In-Reply-To: <4FE91B67.104@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 3604 bytes --]

On 26.06.2012 04:16, Robert Mabee wrote:

> On 06/25/2012 02:23 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>> On 24.06.2012 09:29, Robert Mabee wrote:
>>
>>> Missed this one, where the symbol belongs to some other interface,
>>> but has a value close enough to require an insane test (a filename
>>> containing a newline) to get incorrect results:
>>>
>>> === modified file 'grub-core/commands/wildcard.c'
>>> --- old/grub-core/commands/wildcard.c 2012-06-08 20:54:21 +0000
>>> +++ new/grub-core/commands/wildcard.c 2012-06-24 06:55:33 +0000
>>> @@ -153,7 +153,7 @@
>>> buffer[i] = '\0';
>>> grub_dprintf ("expand", "Regexp is %s\n", buffer);
>>>
>>> - if (regcomp (regexp, buffer, RE_SYNTAX_GNU_AWK))
>>> + if (regcomp (regexp, buffer, REG_EXTENDED))
>>> {
>>> grub_free (buffer);
>>> return 1;
>>>
>> REG_EXTENDED isn't even a syntax type but is just refined to 1. Valid
>> syntaxes are:
>>
>> RE_SYNTAX_EMACS
>> RE_SYNTAX_AWK
>> RE_SYNTAX_GNU_AWK                       
>> RE_SYNTAX_POSIX_AWK                        RE_SYNTAX_GREP
>> RE_SYNTAX_EGREP                       
>> RE_SYNTAX_POSIX_EGREP                        RE_SYNTAX_ED
>> RE_SYNTAX_SED
>> RE_SYNTAX_POSIX_BASIC                       
>> RE_SYNTAX_POSIX_MINIMAL_BASIC               
>> RE_SYNTAX_POSIX_EXTENDED                   
>> RE_SYNTAX_POSIX_MINIMAL_EXTENDED               
>>
>> Additionally no real testcase was ever demonstrated.
> Looking at the code and "man regex" (not binding on Grub, but describes
> the code that was imported), it appears regcomp takes the OR of any of
> REG_EXTENDED, REG_ICASE, REG_NEWLINE, REG_NOSUB, all defined by
> POSIX. RE_SYNTAX_* are valid args to re_set_syntax or re_compile_internal,
> defined by GNU.
> 
> RE_SYNTAX_GNU_AWK happens to have the bits REG_EXTENDED, REG_NEWLINE,
> and REG_NOSUB set. The last has no effect because wildcard.c doesn't pass
> the array to collect subexpression matches. REG_EXTENDED is usually used
> because the alternative ("basic") syntax is called obsolete. However,
> the basic
> syntax has many fewer special characters so would save code (to quote them)
> in wildcard.c. Probably REG_ICASE should be set according to the fs case
> insensitivity.
> 
> REG_NEWLINE causes incorrect results when a filename contains a newline,
> both because a wild char won't match the newline, and because the generated
> pattern anchors ^$ can match adjacent to the newline.

Looks like you misinterpret the flags and it's actually reversed to what
you say. Did you check that claimeed behaviour actuall occurs?

       REG_NEWLINE
              Match-any-character operators don't match a newline.

              A nonmatching list ([^...])  not containing a newline does
not match a newline.

              Match-beginning-of-line operator (^) matches the empty
string immediately after a newline, regardless of whether eflags, the
execution flags of  regexec(),  con‐
              tains REG_NOTBOL.

> For example, after
> echo foo >'/foo
> bar'
> (shell, OS, fs permitting) Grub will fail to show this file with ls /f*r
> but will show
> it with /*o or /b* (as well as the expected /*r and /f*).
> 
> I support your choice not to include this in a code freeze, since it is
> so unlikely
> to affect anyone. I only wanted to make sure it didn't get lost.
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

  reply	other threads:[~2012-06-26  2:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 20:59 Release of 2.00~rc1 Vladimir 'φ-coder/phcoder' Serbinenko
2012-06-23 21:30 ` Aleš Nesrsta
2012-06-23 21:57   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-06-24  7:29 ` Robert Mabee
2012-06-24 18:30   ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-06-25  9:12     ` REG_EXTENDED (was Re: Release of 2.00~rc1) Vladimir 'φ-coder/phcoder' Serbinenko
2012-06-25 18:23   ` Release of 2.00~rc1 Vladimir 'φ-coder/phcoder' Serbinenko
2012-06-26  2:16     ` Robert Mabee
2012-06-26  2:46       ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-06-27  4:40         ` Robert Mabee
2012-06-25 14:29 ` David Cantrell
2012-06-26 18:27 ` Bruce Dubbs
2012-06-26 20:03   ` Vladimir 'φ-coder/phcoder' Serbinenko

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=4FE9227A.3010808@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /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.