Bug 576594 - grep sometimes acts in case-insensitive manner if LANG=en_US.UTF-8
Summary: grep sometimes acts in case-insensitive manner if LANG=en_US.UTF-8
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-24 15:01 UTC by Denys Vlasenko
Modified: 2010-03-24 15:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-24 15:38:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Denys Vlasenko 2010-03-24 15:01:18 UTC
Tried these commands on F11 and F12 and I see this:

# echo $LANG
en_US.UTF-8
# echo '00000014 T is_nip_reserved' | env -uLANG grep -v ' [a-t] '
00000014 T is_nip_reserved
# echo '00000014 T is_nip_reserved' | env -uLANG grep -v ' [a-u] '
00000014 T is_nip_reserved
# echo '00000014 T is_nip_reserved' | grep -v ' [a-t] '
00000014 T is_nip_reserved
# echo '00000014 T is_nip_reserved' | grep -v ' [a-u] '
# 

All commands except last worked correctly.
The last command erroneously filtered out the line. For some reason, ' T ' matched ' [a-u] ' regexp.

Comment 1 Paolo Bonzini 2010-03-24 15:38:18 UTC
This is not a bug.  strcoll's order is aAbBcCdDeE..tTuU, so [A-T] matches t but not a, and [a-t] matches A but not T.  But, [a-u] does match T.  See also

    info sed 'Reporting Bugs'

(However, for some reason I cannot reproduce it with 

    echo '00000014 T is_nip_reserved' | sed 's/ [a-u] / /p'

under Fedora).

Set LC_COLLATE=C to avoid this funny behavior.


Note You need to log in before you can comment on or make changes to this bug.