Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 269607 - sys-apps/grep-2.5.1a-r1: case insensitive when using character class [ ]
Summary: sys-apps/grep-2.5.1a-r1: case insensitive when using character class [ ]
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-12 18:50 UTC by Alexander Tsoy
Modified: 2009-05-12 20:40 UTC (History)
1 user (show)

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 Alexander Tsoy 2009-05-12 18:50:04 UTC
When using character class in regexp it is case insensitive. I've tested this on several gentoo boxes and have the same result.

sys-apps/grep-2.5.1a-r1  USE="nls pcre -static"

Reproducible: Always

Steps to Reproduce:

Actual Results:  
$ echo Test | grep "^[a-z]"
Test
$ echo Test | grep -v "^[a-z]"
$ echo test | grep "^[A-Z]"
test
$ echo test | grep -v "^[A-Z]"
$

Expected Results:  
$ echo Test | grep "^[a-z]"
$ echo Test | grep -v "^[a-z]"
Test
$ echo test | grep "^[A-Z]"
$ echo test | grep -v "^[A-Z]"
test
Comment 1 Harald van Dijk (RETIRED) gentoo-dev 2009-05-12 19:19:10 UTC
If you want a-z to match only lowercase characters, set LC_ALL to C. Your locale orders characters as aAbBcC...sStTuU...zZ (or as AaBbCc...SsTtUu...Zz, I suppose), where uppercase T is between lowercase a and lowercase z. This is the expected behaviour.
Comment 2 Alexander Tsoy 2009-05-12 19:50:39 UTC
(In reply to comment #1)

Yes, it helped.

$ LC_ALL=C bash -c "echo abc | grep '[A-Z]'"
$ LC_ALL=C bash -c "echo ABC | grep '[A-Z]'"
ABC
$

But why Debian whith ru_RU.UTF-8 locale doesn't have this issue?
Comment 3 Harald van Dijk (RETIRED) gentoo-dev 2009-05-12 20:12:39 UTC
You'd have to ask the Debian folks: Gentoo's grep is mostly identical to grep as released by GNU right now, there are just a few build fixes. Debian seems to have a collection of patches for it that may have changed its behaviour in this case.
Comment 4 Alexander Tsoy 2009-05-12 20:40:24 UTC
I found an older bug. May be it should be fixed again?

http://bugs.gentoo.org/show_bug.cgi?id=76192