Subject: bug#16499: GNU grep-2.16-1.mga4 , grep-2.16 from sources and grep from git master HEAD get stuck during an LC_ALL=en_US.UTF-8 search inside a short binary file

From: Shlomi Fish <[email-masked]>
Date: Sun, 19 Jan 2014 17:10:11 +0200

Hi all,

after I save the attached file as 1.dat , I see that grep -iP on '^Subject:'
or on '^S' gets stuck in the en_US.UTF-8 locale. It is fine in pcregrep and in
ack.

[SHELL]
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -iP '^Subject:' < 1.dat ^C

real    0m4.199s
user    0m4.195s
sys     0m0.003s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -iP '^S' < 1.dat ^C

real    0m3.486s
user    0m3.485s
sys     0m0.001s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -iE '^S' < 1.dat

real    0m0.002s
user    0m0.002s
sys     0m0.000s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -P '^S' < 1.dat ^C

real    0m1.887s
user    0m1.885s
sys     0m0.000s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -P '^Subject:' < 1.dat

real    0m0.003s
user    0m0.000s
sys     0m0.002s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -P '^Subject:' < 1.dat time LC_ALL=C
~/apps/TEST-grep-from-git-TO-DEL/bin/grep -iP '^Subject:' < 1.dat

real    0m0.003s
user    0m0.001s
sys     0m0.001s
shlomif@telaviv1:~$ time LC_ALL=C pcregrep -i '^Subject:' < 1.dat

real    0m0.002s
user    0m0.001s
sys     0m0.000s
shlomif@telaviv1:~$ time LC_ALL=C ack -i '^Subject:' 1.dat

real    0m0.066s
user    0m0.059s
sys     0m0.007s
shlomif@telaviv1:~$ time LC_ALL=en_US.UTF-8 ack -i '^Subject:' 1.dat

real    0m0.070s
user    0m0.063s
sys     0m0.006s
[/SHELL]

The same thing happens with grep-2.16 built from the sources. I'm on Mageia
Linux x86-64 Cauldron (what will be Mageia 4). 

shlomif@telaviv1:~$ ldd ~/apps/TEST-grep-from-git-TO-DEL/bin/grep 
        linux-vdso.so.1 (0x00007fff2a7fe000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f19ed302000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f19ecf4d000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f19ecd30000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f19ed568000)
shlomif@telaviv1:~$ rpm -qf /lib64/libpcre.so.1
lib64pcre1-8.33-2.mga4

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Humanity - Parody of Modern Life - http://shlom.in/humanity

Linux — Because Software Problems Should not Cost Money.

Please reply to list if it's a mailing list post - http://shlom.in/reply .