GNU bug report logs - #59639
Is this a bug?

Previous Next

Package: grep;

Reported by: Klaus Dittrich <kladit <at> t-online.de>

Date: Sun, 27 Nov 2022 17:53:01 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 59639 in the body.
You can then email your comments to 59639 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#59639; Package grep. (Sun, 27 Nov 2022 17:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Klaus Dittrich <kladit <at> t-online.de>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sun, 27 Nov 2022 17:53:02 GMT) Full text and rfc822 format available.

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

From: Klaus Dittrich <kladit <at> t-online.de>
To: bug-grep <at> gnu.org
Subject: Is this a bug?
Date: Sun, 27 Nov 2022 18:29:28 +0100
Given file.txt with three lines:

/usr/local/lib/gdk-pixbuf-2.0
empty
/usr/local/lib/libgd2

When I do:

grep gdk file.txt
this results in : /usr/local/lib/gdk-pixbuf-2.0

Which looks ok for me.

When I do:

grep  gdk* file.txt
this results in : /usr/local/lib/gdk-pixbuf-2
                  /usr/local/lib/libgd2.0

This looks like then '*' eats the 'k'
from 'gdk*' and looks for 'gd'' instead of 'gdk*'.
Or equivalent to grep  gd* file.txt
Or equivalent to grep  gd file.txt

grep   gdk.* file.txt
this results in : /usr/local/lib/gdk-pixbuf-2.0

Which looks ok for me.
Either now the point is eaten or the point is correctly replaced by 'any 
character'



grep is grep-3.8 and linked with


Can you please verify if this is a bug or anything in my thinking is 
wrong beacuse I have overlooked something?

-- 
Regards Klaus




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 27 Nov 2022 18:13:02 GMT) Full text and rfc822 format available.

Notification sent to Klaus Dittrich <kladit <at> t-online.de>:
bug acknowledged by developer. (Sun, 27 Nov 2022 18:13:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Klaus Dittrich <kladit <at> t-online.de>
Cc: 59639-done <at> debbugs.gnu.org
Subject: Re: bug#59639: Is this a bug?
Date: Sun, 27 Nov 2022 10:11:57 -0800
On 2022-11-27 09:29, Klaus Dittrich wrote:
> grepĀ  gdk* file.txt

You should quote the pattern for the shell, e.g.:

grep 'gdk*' file.txt

You can see what's going on by using the shell command 'set -x' before 
running 'grep'.




Information forwarded to bug-grep <at> gnu.org:
bug#59639; Package grep. (Sun, 27 Nov 2022 18:59:02 GMT) Full text and rfc822 format available.

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

From: Gary Johnson <garyjohn <at> spocom.com>
To: bug-grep <at> gnu.org
Subject: Re: bug#59639: Is this a bug?
Date: Sun, 27 Nov 2022 10:54:07 -0800
On 2022-11-27, Klaus Dittrich wrote:
> Given file.txt with three lines:
> 
> /usr/local/lib/gdk-pixbuf-2.0
> empty
> /usr/local/lib/libgd2
> 
> When I do:
> 
> grep gdk file.txt
> this results in : /usr/local/lib/gdk-pixbuf-2.0
> 
> Which looks ok for me.
> 
> When I do:
> 
> grep  gdk* file.txt
> this results in : /usr/local/lib/gdk-pixbuf-2
>                   /usr/local/lib/libgd2.0
> 
> This looks like then '*' eats the 'k'
> from 'gdk*' and looks for 'gd'' instead of 'gdk*'.
> Or equivalent to grep  gd* file.txt
> Or equivalent to grep  gd file.txt
> 
> grep   gdk.* file.txt
> this results in : /usr/local/lib/gdk-pixbuf-2.0
> 
> Which looks ok for me.
> Either now the point is eaten or the point is correctly replaced by
> 'any character'

> Can you please verify if this is a bug or anything in my thinking is
> wrong beacuse I have overlooked something?

I think you are confusing regular expressions with globs.

The pattern used by most if not all shells for file-name expansion
is a glob.  In a glob, an asterisk is replaced by zero or more
characters.  In a glob, gdk* means gdk followed by zero or more
characters.

The pattern argument to grep is a regular expression.  In a regular
expression, an asterisk means zero or more of the preceding element,
which in the simplest case is a single character.  In a regular
expression, gdk* means gd followed by zero or more of the letter k.

HTH,
Gary





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 26 Dec 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 173 days ago.

Previous Next


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