GNU bug report logs -
#63819
Gnu `grep '.*'` does not match an empty string.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63819 in the body.
You can then email your comments to 63819 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#63819
; Package
grep
.
(Wed, 31 May 2023 23:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Bob Vincent Il (US)" <robert.a.vincent.ii <at> pwc.com>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Wed, 31 May 2023 23:02: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)]
I discovered only today that the following commands all behave identically:
* grep -q '.*'
* grep -q '.\+'
* grep -q .
* grep -qE '.*'
* grep -qE '.+'
* grep -qE .
Gnu grep documentation says:
The period ‘.’ matches any single character. It is unspecified whether ‘.’ matches an encoding error.
and
‘*’
The preceding item is matched zero or more times.
I would think that an empty string matches "zero or more of any single character".
Can anyone point out where the documentation says otherwise?
Bob Vincent (US)<mailto:robert.a.vincent.ii <at> pwc.com>
PwC IT - NGC - PUPPET DEV OPS<https://wwwpwcnetwork.pwc.myshn.net/nav_to.do?uri=sys_user_group.do?sys_id=16aec8f0db7e145cd9703423f39619de> | Senior Manager
Work: 906-984-3549<tel:+1.906.984.3549>
Mobile: 770-744-1792<tel:+1.770.744.1792>
PricewaterhouseCoopers LLP
@workday<https://wd3.myworkday.com/pwc/d/inst/1$37/247$701091.htmld> @github<https://github.pwc.com/robert-a-vincent-ii> @ServiceNow<https://wwwpwcnetwork.pwc.myshn.net/nav_to.do?uri=sys_user.do?sys_id=2421e2591b2e081483c254207e4bcb7b%26sysparm_view=ess>
________________________________
The information transmitted, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited, and all liability arising therefrom is disclaimed. If you received this in error, please contact the sender and delete the material from any computer.
In the event the content of this email includes Tax advice, the content of this email is limited to the matters specifically addressed herein and is not intended to address other potential tax consequences or the potential application of tax penalties to this or any other matter.
PricewaterhouseCoopers LLP is a Delaware limited liability partnership. This communication may come from PricewaterhouseCoopers LLP or one of its subsidiaries.
________________________________
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-grep <at> gnu.org
:
bug#63819
; Package
grep
.
(Thu, 01 Jun 2023 00:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 63819 <at> debbugs.gnu.org (full text, mbox):
On 2023-05-31 10:18, Bob Vincent Il (US) via Bug reports for GNU grep wrote:
> I discovered only today that the following commands all behave identically:
>
> * grep -q '.*'
> * grep -q '.\+'
> * grep -q .
> * grep -qE '.*'
> * grep -qE '.+'
> * grep -qE .
No they don't. For example:
$ echo '' | grep -q . ; echo $?
1
$ echo '' | grep -q '.*' ; echo $?
0
Information forwarded
to
bug-grep <at> gnu.org
:
bug#63819
; Package
grep
.
(Thu, 01 Jun 2023 02:18:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 63819 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Okay, but `echo ''` does not output an empty string. It outputs a line feed character.
Bob Vincent (US-TSO)
PwC IT - NGC - PUPPET DEV OPS | Senior Manager
Work: 906-984-3549
Mobile: 770-744-1792
PricewaterhouseCoopers LLP
________________________________
From: Paul Eggert <eggert <at> cs.ucla.edu>
Sent: Wednesday, May 31, 2023 8:42:47 PM
To: Bob Vincent Il (US) <robert.a.vincent.ii <at> pwc.com>
Cc: 63819 <at> debbugs.gnu.org <63819 <at> debbugs.gnu.org>
Subject: Re: bug#63819: Gnu `grep '.*'` does not match an empty string.
On 2023-05-31 10:18, Bob Vincent Il (US) via Bug reports for GNU grep wrote:
> I discovered only today that the following commands all behave identically:
>
> * grep -q '.*'
> * grep -q '.\+'
> * grep -q .
> * grep -qE '.*'
> * grep -qE '.+'
> * grep -qE .
No they don't. For example:
$ echo '' | grep -q . ; echo $?
1
$ echo '' | grep -q '.*' ; echo $?
0
________________________________
The information transmitted, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited, and all liability arising therefrom is disclaimed. If you received this in error, please contact the sender and delete the material from any computer.
In the event the content of this email includes Tax advice, the content of this email is limited to the matters specifically addressed herein and is not intended to address other potential tax consequences or the potential application of tax penalties to this or any other matter.
PricewaterhouseCoopers LLP is a Delaware limited liability partnership. This communication may come from PricewaterhouseCoopers LLP or one of its subsidiaries.
________________________________
[Message part 2 (text/html, inline)]
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Thu, 01 Jun 2023 03:16:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Bob Vincent Il (US)" <robert.a.vincent.ii <at> pwc.com>
:
bug acknowledged by developer.
(Thu, 01 Jun 2023 03:16:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 63819-done <at> debbugs.gnu.org (full text, mbox):
On 2023-05-31 19:17, Bob Vincent Il (US) wrote:
> Okay, but `echo ''` does not output an empty string. It outputs a line feed character.
The line feed is not considered. Grep looks only for matches of "any
part of the line excluding the terminating <newline>"
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html>.
Closing the bug report as it appears to be due to a misunderstanding of
how 'grep' works.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 29 Jun 2023 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 315 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.