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

dietmar.schindler at manroland-web.com dietmar.schindler at manroland-web.com
Thu Apr 5 06:32:11 UTC 2018


> Von: Quentin Rameau
> Gesendet: Mittwoch, 4. April 2018 23:29
>> 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.”

The above does not rule an empty pattern_file (i. e. no patterns) out.
The actually relevant part from http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html is:

-f  pattern_file
Read one or more patterns from the file named by the pathname pattern_file. …

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

True, but because of the wording "one or more patterns".
--
Regards,
Dietmar Schindler
________________________________
manroland web systems GmbH | Managing Director: Alexander Wassermann
Registered Office: Augsburg | Trade Register: AG Augsburg | HRB-No.: 26816 | VAT: DE281389840

Confidentiality note:
This eMail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use or dissemination of this communication is strictly prohibited. If you have received this eMail in error, then please delete this eMail.
________________________________


More information about the busybox mailing list