GNU bug report logs - #20443
grep pattern is forward slash + star

Previous Next

Package: grep;

Reported by: Clay Hansen <clayh <at> ayre.com>

Date: Mon, 27 Apr 2015 19:31:04 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

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 20443 in the body.
You can then email your comments to 20443 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#20443; Package grep. (Mon, 27 Apr 2015 19:31:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clay Hansen <clayh <at> ayre.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Mon, 27 Apr 2015 19:31:07 GMT) Full text and rfc822 format available.

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

From: Clay Hansen <clayh <at> ayre.com>
To: bug-grep <at> gnu.org
Subject: grep pattern is forward slash + star
Date: Mon, 27 Apr 2015 13:05:11 -0600
Dear Coders,

if I echo 'a  *  z' | grep '/*' it succeeds and prints 'a  *  z'.
Can this be right?

echo 'a  *  z' | grep -F '/*' fails as expected.

Tested in Salix on grep-2.14 and freshly compiled grep-2.21.

Thanks,





Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Mon, 27 Apr 2015 20:54:01 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Mon, 27 Apr 2015 20:54:02 GMT) Full text and rfc822 format available.

Notification sent to Clay Hansen <clayh <at> ayre.com>:
bug acknowledged by developer. (Mon, 27 Apr 2015 20:54:03 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: Clay Hansen <clayh <at> ayre.com>, 20443-done <at> debbugs.gnu.org
Cc: GNU bug tracker automated control server <control <at> debbugs.gnu.org>
Subject: Re: bug#20443: grep pattern is forward slash + star
Date: Mon, 27 Apr 2015 14:53:02 -0600
[Message part 1 (text/plain, inline)]
tag 20443 notabug
thanks

On 04/27/2015 01:05 PM, Clay Hansen wrote:
> Dear Coders,
> 
> if I echo 'a  *  z' | grep '/*' it succeeds and prints 'a  *  z'.
> Can this be right?

Yes.  The regular expression '/*' says to match 0-or-more instances of
'/'. 'a  *  z' has zero instances of '/', so it matches and gets printed.

> 
> echo 'a  *  z' | grep -F '/*' fails as expected.

That's the literal pattern '/*', which does not appear in your input.

Remember, to convert the literal pattern of '/*' under -F to a regular
expression when not using -F, you must escape any characters that are
otherwise special to regular expressions.  Your second command would be
equivalent to:

echo 'a  *  z' | grep '/\*'

where the '*' now matches a literal star rather than being the
0-or-more-operator.

As such, this is not a bug, so I'm closing the report.  However, feel
free to ask further questions on the topic.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 26 May 2015 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 111 days ago.

Previous Next


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