https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267749
Bug ID: 267749
Summary: Running "grep -Fivx -f known.words new.words" gives
wrong result
Product: Base System
Version: Unspecified
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
Created attachment 238058
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=238058&action=edit
List of known words in the repro
The command "grep -Fivx -f known.words new.words" is meant to compare a
list of putatively new words against a list of known words, reporting
only those new words not present amongst the known words. The context
is a script for helping with the New York Times "Spelling Bee" puzzle,
but that doesn't matter much.
Testing "grep (BSD grep) 2.5.1-FreeBSD" as found on macOS Big Sur 11.7.1
against "grep (GNU grep) 2.27", I get different results for the following
files:
New Words:
decedent
deceived
decident
detected
dietetic
Known Words:
Civic
Decedent
Deceit
Deceive
Deceived
Decent
Decide
Decided
Deiced
Detect
Detected
Detective
Device
Dice
There are no blanks in the files; the only white space is the newlines.
There are no blank lines in the files.
GNU grep produces the (correct) list:
decident
dietetic
BSD grep produces the (incorrect) list:
deceived
decident
detected
dietetic
Both "deceived" and "detected" are in the list of known words and
neither should be reported.
I believe this is a bug in BSD grep. My short-term workaround is to use
GNU grep, but I'd rather it wasn't necessary. I'm not clear whether this
should be reported to Apple or FreeBSD (or both).
(I think I ran into 253209 "grep -v -f some-empty-file -- does the wrong thing"
previously, but I worked around that, too. It isn't directly relevant to this
bug, though; neither file is empty in this bug.)
--
You are receiving this mail because:
You are the assignee for the bug.