Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 130894 - regexp bug in grep -P or libpcre
Summary: regexp bug in grep -P or libpcre
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-22 15:06 UTC by Alex Efros
Modified: 2006-04-23 06:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2006-04-22 15:06:05 UTC
I'm using modified version of grep ebuild: only difference from official ebuild is removed --disable-perl configure option. (AFAIK it was added only to avoid linking grep in /bin/ with libpcre in /usr/ for cases when /usr mounts later.)

So, grep with -P options incorrectly process inversed character classes: [^...]
here is example:

$ cat test 
a
b
$ grep '[a]' test 
a
$ grep '[b]' test 
b
$ grep '[^a]' test 
b
$ grep '[^b]' test 
a
$ grep -P '[a]' test 
a
$ grep -P '[b]' test 
b
$ grep -P '[^a]' test 
a
b
$ grep -P '[^b]' test 
a
b

and here is used ebuild versions (all - current x86+hardned):
sys-apps/grep-2.5.1-r8
dev-libs/libpcre-6.3
dev-lang/perl-5.8.7-r3

... I must notice, what it was a pain to hit this bug while analizing apache's access_log using grep. :-(
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-04-23 00:29:19 UTC
I don't see why are you filing this bug with Gentoo, we no longer install pcre support in grep.
Comment 2 SpanKY gentoo-dev 2006-04-23 01:26:27 UTC
submit bug report here please:
http://savannah.gnu.org/bugs/?group=grep
Comment 3 Alex Efros 2006-04-23 06:35:48 UTC
I'm filling report in Gentoo bugzilla because:

>>> Unpacking grep-2.5.1.tar.gz to /var/tmp/portage/grep-2.5.1-r8/work
 * Applying grep-2.5.1-manpage.patch ...                                  [ ok ]
 * Applying grep-2.5.1-fgrep.patch ...                                    [ ok ]
 * Applying grep-2.5.1-bracket.patch ...                                  [ ok ]
 * Applying grep-2.5.1-i18n.patch ...                                     [ ok ]
 * Applying grep-2.5.1-oi.patch ...                                       [ ok ]
 * Applying grep-2.5.1-restrict_arr.patch ...                             [ ok ]
 * Applying 2.5.1-utf8-case.patch ...                                     [ ok ]
 * Applying grep-2.5.1-perl-segv.patch ...                                [ ok ]
 * Applying grep-2.5.1-libintl.patch ...                                  [ ok ]
 * Applying 2.5.1-tests.patch ...                                         [ ok ]
>>> Source unpacked.

AFAIK before sending bugreport upstream Gentoo grep.ebuild developer should be sure this bug exists in vanilla version, and not result of some Gentoo-made patches. Also grep.ebuild developer probably monitor grep's changelog, and may suggest me to unmask some newer version, which already in portage (but not x86 yet) and don't have that bug.

Anyway, I've reported this bug upstream, as you asked.

P.S. About "we no longer install pcre support in grep". Before enabling pcre in my ebuild, I've searched bugzilla/forums for reason why pcre support was disabled in Gentoo. Only reason I've found - linking binary in / (/bin) with library in /usr/ (/usr/lib). Nothing about "pcre support in grep too buggy and we refuse to support it". I dislike to remember a lot of slightly different regexp dialects, and ability to use perl regexp dialect in grep is important for me... and I don't mount /usr!