buggrep - Bugs: bug #28162, '\W' character class doesn't work...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #28162: '\W' character class doesn't work with command line option '-i'

Submitter:  None
Submitted:  Fri 04 Dec 2009 06:18:21 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Wed 17 Mar 2010 08:25:40 AM UTC, comment #4: 

Thank you for the bug report. This bug has been fixed in the
development sources, which can be downloaded using git from
git://git.sv.gnu.org/grep.git

Paolo Bonzini <bonzini>
Mon 08 Mar 2010 08:52:50 AM UTC, comment #3: 

Work-in-progress patch posted to mailing list.

Paolo Bonzini <bonzini>
Sat 05 Dec 2009 03:24:48 AM UTC, comment #2: 

   A pattern is coverted to lower case before compile in match
icase (grep.c:mb_icase_keys).  \B and \W doesn't corrently work so
that each are converted to \b and \w.

Norihirio Tanaka <noritnk>
Fri 04 Dec 2009 07:17:48 PM UTC, comment #1: 

forwarded 387704 -email is unavailable-
thanks

On Sun, Jan 11, 2009 at 11:14:07AM -0500, Ruben Molina wrote:

> >On Sat, Sep 16, 2006 at 10:35:26AM +0200, Christoph Biedl wrote:
>> >>Package: grep
>> >>Version: 2.5.1.ds2-5
>> >>Severity: normal
>> >>
>> >>I noticed that enabling --ignore-case suddenly caused certain patterns
>> >>not to match any longer although they should:
>> >>
>> >>$ echo 'foo bar' | grep    '^foo\W'
>> >>foo bar
>> >>$ echo 'foo bar' | grep -i '^foo\W'
>> >>$
>> >>
>> >>Digging further reveals that there's an locales influence since
>> >>$ echo 'foo bar' | LANG=C grep -i '^foo\W'
>> >>foo bar
>> >>$
>> >>
>> >>matches again. After a check using all my generated locales:
>> >>
>> >>MATCH:
>> >>- de_DE
>> >>- de_DE@euro
>> >>- en_US
>> >>
>> >>FAIL:
>> >>- de_DE.UTF-8
>> >>- de_DE.UTF-8@euro
>> >>- en_US.UTF-8
>> >>
>> >>there's a strong impression that UTF-8 locales somehow disturb \W when
>> >>using -i.
>> >>
>> >>Even more confusing, using the bracket expression instead of the
>> >>synonym matches again:
>> >>$ echo 'foo bar' | LANG=de_DE.UTF-8 grep -i '^foo[^[:alnum:]]'
>> >>foo bar
>> >>$
>> >>
>> >>For the records, this sounds somewhat similar to #209194 and #218873
>> >>but these bugs are fixed in this version (2.5.1.ds2-5), I've checked.
>> >>
>> >>By the way, there's a typo in the manpage
>> >>
>> >>  and
>> >>  .B \eW
>> >>  is a synonym for
>> >>- .BR [^[:alnum]] .
>> >>+ .BR [^[:alnum:]] .
>> >>  .PP
>> >>
>> >>-- System Information:
>> >>Debian Release: testing/unstable
>> >>  APT prefers testing
>> >>  APT policy: (500, 'testing')
>> >>Architecture: i386 (i686)
>> >>Shell:  /bin/sh linked to /bin/bash
>> >>Kernel: Linux 2.6.17.13
>> >>Locale: LANG=de_DE.UTF-8@euro, LC_CTYPE=de_DE.UTF-8@euro
>> >>(charmap=UTF-8)
>> >>
>> >>Versions of packages grep depends on:
>> >>ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared
>> >>libraries
>> >>
>> >>grep recommends no packages.
>> >>
>> >>-- no debconf information
> >
> >tags  387704  + confirmed
> >found 387704 2.5.3~dfsg-6
> >thanks
> >
> >$ locale
> >LANG=es_CO.UTF-8
> >LC_CTYPE="es_CO.UTF-8"
> >LC_NUMERIC="es_CO.UTF-8"
> >LC_TIME="es_CO.UTF-8"
> >LC_COLLATE="es_CO.UTF-8"
> >LC_MONETARY="es_CO.UTF-8"
> >LC_MESSAGES="es_CO.UTF-8"
> >LC_PAPER="es_CO.UTF-8"
> >LC_NAME="es_CO.UTF-8"
> >LC_ADDRESS="es_CO.UTF-8"
> >LC_TELEPHONE="es_CO.UTF-8"
> >LC_MEASUREMENT="es_CO.UTF-8"
> >LC_IDENTIFICATION="es_CO.UTF-8"
> >LC_ALL=
> >
> >$ echo 'foo bar' | grep    '^foo\W'
> >foo bar
> >$
> >
> >$ echo 'foo bar' | grep -i '^foo\W'
> >$
> >
> >$ echo 'foo bar' | LANG=C grep -i '^foo\W'
> >foo bar
> >$

I can reproduce this bug with 2.5.4

grep -V
GNU grep 2.5.4

echo 'foo bar' | grep '^foo\W'; echo $?
foo bar
0

echo 'foo bar' | grep -i '^foo\W'; echo $?
foo bar
0

echo 'foo bar' | LANG=C grep -i '^foo\W'; echo $?
foo bar
0

echo 'foo bar' | LANG=en_AU grep -i '^foo\W'; echo $?
foo bar
0

echo 'foo bar' | LANG=en_AU.UTF-8 grep -i '^foo\W'; echo $?
1




Paolo Bonzini <bonzini>
Fri 04 Dec 2009 06:18:21 AM UTC, original submission:  

This may be related to bug #27919.

To reproduce, in bash run these:

grep -i '\Wabc' <<< "   abc"
grep '\Wabc' <<< "   abc"

Both should match, but the former doesn't for me.

# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by noritnk (Posted a comment)
  • -email is unavailable- added by bonzini (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-03-17 bonzini StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Summary\'\\W\' character class doesn\'t work with command line option \'-i\' '\W' character class doesn't work with command line option '-i'
    2010-03-08 bonzini StatusNone In Progress
        Summary\'\\W\' character class doesn\'t work with command line option \'-i\' '\W' character class doesn't work with command line option '-i'
    2009-12-04 bonzini Summary\'\\W\' character class doesn\'t work with command line option \'-i\' '\W' character class doesn't work with command line option '-i'

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code