Bug 160834 - [patch] grep(1): fixes for POSIX conformance
Summary: [patch] grep(1): fixes for POSIX conformance
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-19 21:40 UTC by Toby Peterson
Modified: 2018-04-25 11:49 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (1.86 KB, patch)
2011-09-19 21:40 UTC, Toby Peterson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toby Peterson 2011-09-19 21:40:05 UTC
Standard is at http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html

Fairly straightforward changes, description as follows:

fastgrep.c:
Handle ^$ pattern correctly. Simple test is `echo | grep "^$"` - it
should match the single line.

grep.c:
As described in the standard, "The pattern_list's value shall consist
of one or more patterns separated by <newline> characters"

util.c:
For the purposes of the standard, inaccessible = nonexistent.

Also don't match the empty end of the line. Simple test for that:
`echo abc#def | grep "^[A-Za-z0-9]*$"` should not match anything.

Fix: Patch attached.

Patch attached with submission follows:
How-To-Repeat: See description for test cases.
Comment 1 Kyle Evans freebsd_committer freebsd_triage 2017-04-20 16:54:14 UTC
This is no longer an issue with either gnugrep or bsdgrep, and should probably be closed ("fixed").