GNU bug report logs -
#22071
incorrect behaviour for inverted matches with -l on empty files
Previous Next
Reported by: Mark Wotton <mwotton <at> gmail.com>
Date: Tue, 1 Dec 2015 22:47: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 22071 in the body.
You can then email your comments to 22071 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#22071
; Package
grep
.
(Tue, 01 Dec 2015 22:47:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mark Wotton <mwotton <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Tue, 01 Dec 2015 22:47:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
orb ➜ ~/src/grep-2.22 touch empty
orb ➜ ~/src/grep-2.22 ./src/grep -v -l "hi there" ./empty
gives empty output. Surely the file "empty" should match 'does not match
"hi there"' ?
cheers
mark
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-grep <at> gnu.org
:
bug#22071
; Package
grep
.
(Wed, 02 Dec 2015 12:58:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 22071 <at> debbugs.gnu.org (full text, mbox):
El 01/12/15 a las 22:36, Mark Wotton escribió:
> orb ➜ ~/src/grep-2.22 touch empty
> orb ➜ ~/src/grep-2.22 ./src/grep -v -l "hi there" ./empty
>
> gives empty output. Surely the file "empty" should match 'does not match
> "hi there"' ?
-v, --invert-match
Invert the sense of matching, to select non-matching lines.
I think this is not a bug because there isn't non-matching line in an empty file.
Cheers,
-- Santiago
Information forwarded
to
bug-grep <at> gnu.org
:
bug#22071
; Package
grep
.
(Wed, 02 Dec 2015 13:15:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 22071 <at> debbugs.gnu.org (full text, mbox):
hm. "grep -l '' empty" also doesn't print anything, so I guess it's
consistent, at least.
On 12/2/15, Santiago Ruano Rincón <santiagorr <at> riseup.net> wrote:
> El 01/12/15 a las 22:36, Mark Wotton escribió:
>> orb ➜ ~/src/grep-2.22 touch empty
>> orb ➜ ~/src/grep-2.22 ./src/grep -v -l "hi there" ./empty
>>
>> gives empty output. Surely the file "empty" should match 'does not match
>> "hi there"' ?
> -v, --invert-match
> Invert the sense of matching, to select non-matching lines.
>
> I think this is not a bug because there isn't non-matching line in an empty
> file.
>
> Cheers,
>
> -- Santiago
>
--
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
-- Chris Maeda
Information forwarded
to
bug-grep <at> gnu.org
:
bug#22071
; Package
grep
.
(Wed, 02 Dec 2015 13:33:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 22071 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 12/02/2015 06:14 AM, Mark Wotton wrote:
> hm. "grep -l '' empty" also doesn't print anything, so I guess it's
> consistent, at least.
You want 'grep -L "hi there" ./empty', which says to print the names of
all files that did not contain any match (and not the names of all files
that had lines that didn't match). That is, -v and -L are different
types of negation.
$ grep -L '' empty
empty
$ grep -Lv '' empty
empty
The empty file has no matches to any patterns (whether or not the
pattern is negated with -v), so it shows up under -L.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-grep <at> gnu.org
:
bug#22071
; Package
grep
.
(Wed, 02 Dec 2015 13:58:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 22071 <at> debbugs.gnu.org (full text, mbox):
Yes, I understand the interpretation now. Just confusing when you have
a model in mind that almost always works.
On 12/2/15, Eric Blake <eblake <at> redhat.com> wrote:
> On 12/02/2015 06:14 AM, Mark Wotton wrote:
>> hm. "grep -l '' empty" also doesn't print anything, so I guess it's
>> consistent, at least.
>
> You want 'grep -L "hi there" ./empty', which says to print the names of
> all files that did not contain any match (and not the names of all files
> that had lines that didn't match). That is, -v and -L are different
> types of negation.
>
> $ grep -L '' empty
> empty
> $ grep -Lv '' empty
> empty
>
> The empty file has no matches to any patterns (whether or not the
> pattern is negated with -v), so it shows up under -L.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
--
A UNIX signature isn't a return address, it's the ASCII equivalent of a
black velvet clown painting. It's a rectangle of carets surrounding a
quote from a literary giant of weeniedom like Heinlein or Dr. Who.
-- Chris Maeda
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Wed, 02 Dec 2015 16:12:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mark Wotton <mwotton <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 02 Dec 2015 16:12:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 22071-done <at> debbugs.gnu.org (full text, mbox):
On 12/02/2015 05:57 AM, Mark Wotton wrote:
> Yes, I understand the interpretation now.
Thanks, closing the bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 31 Dec 2015 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.