Subject: bug#24941: Early termination bug in grep 2.26

From: Paul Eggert <[email-masked]>
Date: Tue, 15 Nov 2016 15:33:13 -0800

On 11/15/2016 03:13 PM, Jim Meyering wrote:
>    We should retain the optimization when reading from stdin that is
> neither a pipe nor a tty.

I am toying with the idea of retaining the optimization only if 
lseek-to-EOF succeeds, a heuristic that is a bit more restrictive. This 
arguably would conform better to the POSIX requirement that when grep 
exits "the file offset in the open file description is properly 
positioned just past the last byte processed by the utility." See the 
INPUT FILES section of 
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_04>.