Bug 12816

Summary: grep does not match GNU grep for -xf EMPTY_FILE
Product: Busybox Reporter: wolf+busybox
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.32.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description wolf+busybox 2020-04-27 12:22:32 UTC
Hello,

while implementing whitelist mechanism in my shell scripting, I've
noticed an inconsistency between busybox's grep and GNU grep. They
handle -xf EMPTY_FILE flags differently when EMPTY_FILE is well...
empty.

GNU grep in that case handles it as if /.*/ pattern was provided, while
busybox uses //.

Attached patch fixes this issue. I've both added a test case into grep's
testsuite and I've also used following shell script to verify that the
behavior does match now:

http://lists.busybox.net/pipermail/busybox/2020-April/087915.html
Comment 1 Denys Vlasenko 2020-04-29 22:22:00 UTC
Fixed in git