GNU bug report logs - #33972
grep -vf <(<nothing>) filters all rows

Previous Next

Package: grep;

Reported by: luke <at> gavelfamily.com

Date: Fri, 4 Jan 2019 05:16:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33972 in the body.
You can then email your comments to 33972 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#33972; Package grep. (Fri, 04 Jan 2019 05:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to luke <at> gavelfamily.com:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Fri, 04 Jan 2019 05:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: luke <at> gavelfamily.com
To: bug-grep <at> gnu.org
Subject: grep -vf <(<nothing>) filters all rows
Date: Fri, 4 Jan 2019 00:04:28 -0500
[Message part 1 (text/plain, inline)]


I have to pre-check for an empty set before passing it to grep:
�
SAVED_RECORDs=($(sqlite3 -list -separator '/' files.db "SELECT FileName FROM Files WHERE ModTime > '2018-12-31'")) #Returns an empty set
NEW_RECs=($(ls * | grep -vf <(echo ${SAVED_RECORDs[@]}
| tr ' ' '\n') #Returns an empty list because grep considers SAVED_RECORDs to be universal rather than null set
Workaround:


if [ ${#SAVED_RECORDs[@]} -gt 0 ]; then

� NEW_RECs=($(ls * | grep -vf <(echo ${SAVED_RECORDs[@]} | tr ' ' '\n') #Now returns the expected subtraction of SAVED_RECORDs from NEW_RECs

fi
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 02 Jan 2020 09:05:02 GMT) Full text and rfc822 format available.

Notification sent to luke <at> gavelfamily.com:
bug acknowledged by developer. (Thu, 02 Jan 2020 09:05:02 GMT) Full text and rfc822 format available.

Message #10 received at 33972-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: luke <at> gavelfamily.com
Cc: 33972-done <at> debbugs.gnu.org
Subject: grep -vf <(<nothing>) filters all rows
Date: Thu, 2 Jan 2020 01:04:21 -0800
> I have to pre-check for an empty set before passing it to grep:
> ...
> Workaround:

You're right that the empty pattern matches every line, since every line has an
empty string in it somewhere. This is considered to be a feature of grep, not a
bug. As you have a workaround I'm closing the bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Jan 2020 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.