GNU bug report logs - #33162
Pattern partially greps windows line-endings since 3.1

Previous Next

Package: grep;

Reported by: "Holger Klene" <h.klene <at> gmx.de>

Date: Fri, 26 Oct 2018 12:54:01 UTC

Severity: wishlist

Merged with 32838

To reply to this bug, email your comments to 33162 AT debbugs.gnu.org.

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#33162; Package grep. (Fri, 26 Oct 2018 12:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Holger Klene" <h.klene <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Fri, 26 Oct 2018 12:54:01 GMT) Full text and rfc822 format available.

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

From: "Holger Klene" <h.klene <at> gmx.de>
To: bug-grep <at> gnu.org
Subject: Pattern partially greps windows line-endings since 3.1
Date: Fri, 26 Oct 2018 14:41:59 +0200
Hello!

I think, I may have stumbled upon a bug in gnu-grep version 3.1 which was not present in 3.0 and 2.6.3

Steps to reproduce:
A) generate test-file: printf "a --\r\nb --\nc --\rd --\n\r" > test.txt

B) check test-file: md5sum.exe test.txt
e3ef5d742eee3a7f326bc7b4b391cc42 *test.txt

C) run old grep 3.0 or 2.6.3:
$ grep -ce '--[^ -]' test.txt
1
$ grep -ne '--[^ -]' test.txt
3:c --d --

D) run new grep 3.1:
$ grep -ce '--[^ -]' test.txt
2
$ grep -ne '--[^ -]' test.txt

d --

It looks as if the 3.1 has an issue with alternative line-ending styles sometimes matched as part of the pattern:
a --\r\n    (windows) is messed around
b --\n      (unix) seems to work OK
c --\r      just for completenes
d --\n\r    just for completenes

You can modify the printf statement to generate each test-case into it's own file. b and d are equally not found, c is always found. The behavior changed for a: [^ -] now matches the \r in 3.1 which was ignored in older versions.

Thanks
Holger

PS: This version of grep was distributed along with git-bash for Windows 64bit
https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/Git-2.19.1-64-bit.exe
grep (GNU grep) 3.1
GNU bash, version 4.4.19(2)-release (x86_64-pc-msys)
git version 2.19.1.windows.1




Merged 32838 33162. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2020 01:13:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 21 Sep 2020 22:39:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-grep <at> gnu.org:
bug#33162; Package grep. (Mon, 21 Sep 2020 22:42:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Konstantin Kolinko <knst.kolinko <at> gmail.com>, Holger Klene <h.klene <at> gmx.de>
Cc: 33162 <at> debbugs.gnu.org, 32838 <at> debbugs.gnu.org
Subject: Re: bug#32838: Regression in grep 3.1: Grep '$' matcher no longer
 works on CRLF files on Windows
Date: Mon, 21 Sep 2020 15:41:23 -0700
On 9/25/18 1:15 AM, Konstantin Kolinko wrote:

> https://github.com/git-for-windows/git/issues/1841
Looking at that downstream bug report, it appears that this is a wishlist 
request and that there have been no takers for implementing an 
MS-Windows-specific --strip-trailing-cr option. I have marked Bug#32838 and 
Bug#33162 as wishlist in the grep bug database.




This bug report was last modified 4 years and 267 days ago.

Previous Next


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