Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > gnu.utils.bug > #2249
| From | Eric Blake <eblake@redhat.com> |
|---|---|
| Newsgroups | gnu.utils.bug |
| Subject | Re: found bug |
| Date | 2018-08-22 20:55 -0500 |
| Organization | Red Hat, Inc. |
| Message-ID | <mailman.5436.1534989584.1292.bug-gnu-utils@gnu.org> (permalink) |
| References | <CAMy0ACN5Ut_NiD7y5WbONKVEoMuGtn5fX5Ji9ct+XKO+yirWMw@mail.gmail.com> |
On 08/22/2018 06:32 PM, Karl Riauba wrote: > Hi, > > 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 bug-grep@gnu.org, 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. > 10.193.132.65:9102 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 0.0.0.0:9102 0.0.0.0:* LISTEN > 12160/statsd_export > tcp 0 0 0.0.0.0:9125 0.0.0.0:* LISTEN > 12160/statsd_export > tcp 0 0 10.193.132.65:9102 10.196.128.42:46852 > 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
Back to gnu.utils.bug | Previous | Next | Find similar
Re: found bug Eric Blake <eblake@redhat.com> - 2018-08-22 20:55 -0500
csiph-web