BUG: grep -v -x -f does not work when pattern file is empty

Quentin Rameau quinq at fifth.space
Wed Apr 4 21:29:06 UTC 2018


> Hello,

Hello Luiz,

> This simple test show the problem:
> 
> $ touch a.txt
> $ busybox grep -v -x -f a.txt /etc/passwd | wc -l
> 0
> 
> While gnu grep works:
> 
> $ grep -v -x -f a.txt /etc/passwd | wc -l
> 43
> 
> If a.txt has any content, it works:
> 
> $ echo >a.txt
> $ busybox grep -v -x -f a.txt /etc/passwd | wc -l
> 43

The standard specifies, for the -f flag:

“Patterns in pattern_file shall be terminated by a <newline>. A null
pattern can be specified by an empty line in pattern_file.”

So calling grep -f with an empty file is non-standard thus not a BUG
per se.


More information about the busybox mailing list