Bug 576594

Summary: grep sometimes acts in case-insensitive manner if LANG=en_US.UTF-8
Product: [Fedora] Fedora Reporter: Denys Vlasenko <dvlasenk>
Component: grepAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: jskarvad, lkundrak, pbonzini
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-24 15:38:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.