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: Jim Meyering <[email-masked]>
Date: Sun, 19 Jan 2014 17:55:18 -0800

[resending also to the correct bug address]
> Subject: 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
> 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

Thanks for the report.  I am unable to reproduce that on debian
unstable using the latest grep:

  $ env LC_ALL=en_US.UTF-8 time -f %e grep -iP '^S' < /t/1.dat
  Command exited with non-zero status 1
  0.00
  [Exit 1]

A good way for you to diagnose it is to run under strace or, better,
via gdb and find out precisely what code it running when it is making
no progress.