Bug 118716 - grep with --color and -f patternfile gives wrong results
Summary: grep with --color and -f patternfile gives wrong results
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: grep (Show other bugs)
(Show other bugs)
Version: 9
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-03-19 13:51 UTC by Thomas Steudten
Modified: 2007-04-18 17:04 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-22 14:21:30 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Thomas Steudten 2004-03-19 13:51:59 UTC
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 12:55:40 UTC
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 13:15:39 UTC
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.