GNU bug report logs - #50025
Strange? grep behaviour

Previous Next

Package: grep;

Reported by: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>

Date: Thu, 12 Aug 2021 15:02:02 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 50025 in the body.
You can then email your comments to 50025 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#50025; Package grep. (Thu, 12 Aug 2021 15:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Forsberg <daniel.forsberg <at> dsv.su.se>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Thu, 12 Aug 2021 15:02:02 GMT) Full text and rfc822 format available.

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

From: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>
To: bug-grep <at> gnu.org
Subject: Strange? grep behaviour
Date: Thu, 12 Aug 2021 10:27:43 +0200
[Message part 1 (text/plain, inline)]
Hello fellow Grepers!

the following line:

echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p |
base32 | grep -E "[0-9A-Z]+" -o

produces the following output

LCBSPBBX6BY6
VZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA

expected output:

LCBSPBBX6BY6WVZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA

As you can see it removes a single 'W' and replaces it with a new line.

Running Gnu grep 3.6, zsh and Gnome Terminal

uname: Linux 5.13.9-arch1-1 #1 SMP PREEMPT Sun, 08 Aug 2021 11:25:35
+0000 x86_64 GNU/Linux

Tried bash as well with same result.

On macOs i get the expected result, a colleague running the same base os
on similar hwconfig computer but other device but with XFCE terminal
also gets expected result so this seems to be something particular to my
system but I have not been able to find why.

Everything looks the same up till the last grep. If I change the regexp
to \w+ I get the expected output.

Honestly, dont know if this is a bug or just something iffy on my device
but thought it might be better to contact you anyways to see if you can
reproduce this in any way



-- 
____________________________________
*Daniel Forsberg*
Developer at eGovlab

Department of Computer and Systems Sciences
*Stockholm University*
Postbox 7003, SE-164 07 Kista
Visiting address: Borgarfjordsgatan 12, Kista
https://egovlab.eu/
https://dsv.su.se
____________________________________
[Message part 2 (text/html, inline)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#50025; Package grep. (Thu, 12 Aug 2021 21:05:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>, 50025 <at> debbugs.gnu.org
Subject: Re: Strange? grep behaviour
Date: Thu, 12 Aug 2021 14:04:15 -0700
On 8/12/21 1:27 AM, Daniel Forsberg wrote:

> this seems to be something particular to my
> system but I have not been able to find why.

I cannot reproduce the problem on my machine (Fedora 34) either.

Try running "env - /usr/bin/grep" instead of plain "grep". If this fixes 
the problem, then your environment is busted somehow. Perhaps your PATH 
is pointing to the wrong 'grep'.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Fri, 13 Aug 2021 19:27:02 GMT) Full text and rfc822 format available.

Notification sent to Daniel Forsberg <daniel.forsberg <at> dsv.su.se>:
bug acknowledged by developer. (Fri, 13 Aug 2021 19:27:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>
Cc: 50025-done <at> debbugs.gnu.org
Subject: Re: Strange? grep behaviour
Date: Fri, 13 Aug 2021 12:26:40 -0700
On 8/13/21 12:36 AM, Daniel Forsberg wrote:
> That fixed it. Will continue digging a bit on this. Will keep you posted
> if I find out what it is that causes this

Thanks. Closing the bug report in the meantime.




Information forwarded to bug-grep <at> gnu.org:
bug#50025; Package grep. (Sun, 15 Aug 2021 14:28:02 GMT) Full text and rfc822 format available.

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

From: Simon Josefsson <simon <at> josefsson.org>
To: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>
Cc: 50025 <at> debbugs.gnu.org
Subject: Re: bug#50025: Strange? grep behaviour
Date: Sun, 15 Aug 2021 16:27:53 +0200
[Message part 1 (text/plain, inline)]
Daniel Forsberg <daniel.forsberg <at> dsv.su.se> writes:

> Hello fellow Grepers!
>
> the following line:
>
> echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p |
> base32 | grep -E "[0-9A-Z]+" -o
>
> produces the following output
>
> LCBSPBBX6BY6
> VZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA

This is because W is not part of the Swedish collate class, so A-Z does
not match W, for some strange reason -- I think this has been changed in
recent glibc though.

jas <at> latte:~$ LANG=sv_SE.UTF-8
jas <at> latte:~$ echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p | base32 | grep -E "[0-9A-Z]+" -o
LCBSPBBX6BY6
VZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA
jas <at> latte:~$ LANG=C
jas <at> latte:~$ echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p | base32 | grep -E "[0-9A-Z]+" -o
LCBSPBBX6BY6WVZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA
jas <at> latte:~$ 

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

Information forwarded to bug-grep <at> gnu.org:
bug#50025; Package grep. (Sun, 15 Aug 2021 21:34:02 GMT) Full text and rfc822 format available.

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

From: Daniel Forsberg <daniel.forsberg <at> dsv.su.se>
To: Simon Josefsson <simon <at> josefsson.org>
Cc: 50025 <at> debbugs.gnu.org
Subject: Re: bug#50025: Strange? grep behaviour
Date: Sun, 15 Aug 2021 20:31:11 +0200
[Message part 1 (text/plain, inline)]
wow!

nice find Simon.

Thnx!

On 2021-08-15 16:27, Simon Josefsson wrote:
> Daniel Forsberg <daniel.forsberg <at> dsv.su.se> writes:
>
>> Hello fellow Grepers!
>>
>> the following line:
>>
>> echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p |
>> base32 | grep -E "[0-9A-Z]+" -o
>>
>> produces the following output
>>
>> LCBSPBBX6BY6
>> VZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA
> This is because W is not part of the Swedish collate class, so A-Z does
> not match W, for some strange reason -- I think this has been changed in
> recent glibc though.
>
> jas <at> latte:~$ LANG=sv_SE.UTF-8
> jas <at> latte:~$ echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p | base32 | grep -E "[0-9A-Z]+" -o
> LCBSPBBX6BY6
> VZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA
> jas <at> latte:~$ LANG=C
> jas <at> latte:~$ echo -n "9999:egov" | sha256sum | grep -E "[0-9a-f]+" -o | xxd -r -p | base32 | grep -E "[0-9A-Z]+" -o
> LCBSPBBX6BY6WVZX6P6TZMMRETTCSPXZU7GJTAPPZCPKF2UJEYDA
> jas <at> latte:~$ 
>
> /Simon
-- 
____________________________________
*Daniel Forsberg*
Developer at eGovlab

Department of Computer and Systems Sciences
*Stockholm University*
Postbox 7003, SE-164 07 Kista
Visiting address: Borgarfjordsgatan 12, Kista
https://egovlab.eu/
https://dsv.su.se
____________________________________
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Sep 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 337 days ago.

Previous Next


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