[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: found bug

From: Eric Blake
Subject: Re: found bug
Date: Wed, 22 Aug 2018 20:55:20 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 08/22/2018 06:32 PM, Karl Riauba wrote:

I think I found egrep bug.

Thanks for your report. However, you've reported to an old address; 'grep --help' currently recommends that bug reports be sent to address@hidden, which makes me wonder if the behavior you are seeing may have changed in the meantime with a newer version of grep.

No tabs in example file or in variable.

Maybe not, but your mailer line wrapped things, which means I can't readily reproduce your output by just copying and pasting from your email. However, I think I've managed to reconstruct the egrep_bug file that you describe, containing just 5 lines, and your $egrep variable with no newlines but a bunch of values with one space on either side. should suppose to be filtered out, but it doesn't.

> $ echo ===$egrep===

It's hard to say if I exactly matched the contents of your $egrep variable, since you forgot to use shell quoting, so if your variable contained multiple spaces, word splitting and then echo's argument pasting collapsed those multiple spaces down to one.

$ cat egrep_bug | egrep -v "$egrep"

Side comment: Useless use of cat; you could have written:

egrep -v "$egrep" < egrep_bug

for fewer processes.

tcp        0      0  *               LISTEN
tcp        0      0  *               LISTEN
tcp        0      0
  ESTABLISHED 12160/statsd_export

When I tried to reproduce your setup, this line was filtered for me, using grep 3.1. But it was very easy to make this line not be filtered, by calling:

egrep -v " $egrep" < egrep_bug

since that creates a pattern which requires two leading spaces, when only one is present in the input. Since you didn't use proper shell quoting, I can't tell if the bug is in your usage, or if it really was something broken in whatever version of grep you are using.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]