Bug 81521 - grep outputs mismatched patterns
grep outputs mismatched patterns
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: grep (Show other bugs)
8.0
i686 Linux
high Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-01-09 21:59 EST by Zhao Wu
Modified: 2007-03-26 23:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-01-10 04:38:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Zhao Wu 2003-01-09 21:59:03 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Description of problem:
When I use regular expression in grep, it outputs lines which do not contain 
the specified patterns.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Just try the following at shell prompt:
echo "foo" |grep "[L-Z]"


Actual Results:  foo

Expected Results:  nothing should be output

Additional info:

At first, I thought it was a case-sensitivity problem, but later I found more 
problems. Note that in the above example, letter 'f' is not even in the list [l-
z]. grep is being constantly used by many scripts and programs, and this bug 
leads to a potential security breach.
Comment 1 Zhao Wu 2003-01-09 22:01:44 EST
I forgot to mention that this is a new bug in Redhat 8.0. I tried on 7.3 and 
there is no such a bug.
Comment 2 Tim Waugh 2003-01-10 04:38:18 EST
You forgot to set LC_COLLATE.  See the bash FAQ question E9.
Comment 3 Zhao Wu 2003-01-10 14:38:15 EST
Thanks for the FAQ info. LC_COLLATE works, but why does "foo" match "[L-Z]" 
even though 'f' is not in "lLmMnN...zZ"? Isn't that a bug?
Comment 4 Tim Waugh 2003-01-10 17:54:13 EST
Because 'o' is.

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