Bug 204255
Summary: | grep -e '' does not always match in Update 4 | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 4 | Reporter: | Jordan Russell <jr-redhatbugs2> | |
Component: | grep | Assignee: | Tim Waugh <twaugh> | |
Status: | CLOSED ERRATA | QA Contact: | ||
Severity: | medium | Docs Contact: | ||
Priority: | medium | |||
Version: | 4.4 | |||
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | RHBA-2007-0281 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 574351 (view as bug list) | Environment: | ||
Last Closed: | 2007-05-01 22:44:10 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: | ||||
Bug Depends On: | ||||
Bug Blocks: | 574351 |
Description
Jordan Russell
2006-08-27 20:14:24 UTC
Actually, specifying "-e ''" first stops grep from highlighting the second pattern... I see no workaround for this ATM. This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Work-around is to convert to non-UTF8 input charset and set LC_ALL. e.g. LC_ALL=en_GB grep ... seems to avoid the problem whereas LC_ALL=en_GB.UTF-8 exhibits the bug. Investigating. Actually an easier work-around is this: grep -e 'HighlightThis' -e '' -e '' This is a Gcompile bug, and it exists in unpatched grep-2.5.1a. Fix is: --- grep-2.5.1a/src/grep.c.empty-pattern 2006-11-22 19:05:43.000000000 +0000 +++ grep-2.5.1a/src/grep.c 2006-11-22 19:22:04.000000000 +0000 @@ -1667,9 +1667,6 @@ out_invert ^= 1; match_lines = match_words = 0; } - else - /* Strip trailing newline. */ - --keycc; } else if (optind < argc) --- grep-2.5.1a/src/search.c.empty-pattern 2006-11-22 19:21:11.000000000 +0000 +++ grep-2.5.1a/src/search.c 2006-11-22 19:35:06.000000000 +0000 @@ -204,6 +204,10 @@ motif = sep; } while (sep && total != 0); + /* Strip trailing newline. */ + if (size && pattern[size - 1] == '\n') + size--; + /* In the match_words and match_lines cases, we use a different pattern for the DFA matcher that will quickly throw out cases that won't work. Then if DFA succeeds we do some hairy stuff using the regex matcher @@ -288,6 +292,10 @@ motif = sep; } while (sep && total != 0); + /* Strip trailing newline. */ + if (size && pattern[size - 1] == '\n') + size--; + /* In the match_words and match_lines cases, we use a different pattern for the DFA matcher that will quickly throw out cases that won't work. Then if DFA succeeds we do some hairy stuff using the regex matcher Fixed in update: grep-2.5.1-54.1.2.fc6. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2007-0281.html |