Bug 118716 - grep with --color and -f patternfile gives wrong results
grep with --color and -f patternfile gives wrong results
Status: CLOSED UPSTREAM
Product: Red Hat Linux
Classification: Retired
Component: grep (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-19 08:51 EST by Thomas Steudten
Modified: 2007-04-18 13:04 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-22 09:21:30 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 Thomas Steudten 2004-03-19 08:51:59 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1 (ax)

Description of problem:
grep called with option --color=auto works fine with
pattern matching given expr like "one|two|three", but
gives wrong results if gives the expr from file with
option -f patternfile. 
patternfile:
one
three
two

Different behavior with egrep=grep -E and grep -F...




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

How reproducible:
Always

Steps to Reproduce:
1. echo -e "one two test runs here\nok runs one test one" | egrep
--color=auto  "runs|one|test"
2. echo -e "one two test runs here\nok runs one test one" | egrep
--color=auto -f pattern
pattern: 
runs
one
test
3.
    

Actual Results:  1. one two test runs here (only two,here not highlighted)
   ok runs one test one (only ok not hl)
2. one .. (only runs hl)
   ok .. (only ok, test not hl)

Expected Results:  1. OK
2. like 1.

Additional info:

Try changing the order of the pattern in pattenfile, gives
different output.
Comment 1 Tim Waugh 2004-03-22 07:55:40 EST
This is expected.  A pattern file is not equivalent to
line1|line2|..., but each line is matched in turn until a match is found.
Comment 2 Thomas Steudten 2004-03-22 08:15:39 EST
No, expected - and the correct output with --color option and -f
patternfile is given from grep -F --color -f patternfile.
The wrong output and not expected output, is the bug above.

grep -E --color -f patternfile gives definitly wrong output. Without
the coloroption, you´re right. The pattern are found, and the hole
inputline is printed.

Please reopen and fix.

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