bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Paul Eggert
Jim Meyering wrote: Paul, what do you think about making your heuristic apply only for non-pipes? I'm a bit dubious, as grep exits early for other reasons, and did so before the patch in question. For example, here: seq 100 | grep -q . This is as of grep 2.19 (2014), due to a bug re

bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Jim Meyering
On Tue, Nov 15, 2016 at 12:17 AM, Paul Eggert wrote: > Jim Meyering wrote: >> >> Paul, what do you think about making your heuristic apply only for >> non-pipes? > > I'm a bit dubious, as grep exits early for other reasons, and did so before > the patch in question. For example, here: > > seq 1000

bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Norihiro Tanaka
On Tue, 15 Nov 2016 11:35:15 -0800 Jim Meyering wrote: > I suppose you mean in addition to the S_ISFIFO test? That sounds good. > We should retain the optimization when reading from stdin that is a > non-pipe. This can also happen in stdin. If we redirect stdout to /dev/null, grep-2.26 exits i

bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Jim Meyering
On Tue, Nov 15, 2016 at 2:13 PM, Norihiro Tanaka wrote: > > On Tue, 15 Nov 2016 11:35:15 -0800 > Jim Meyering wrote: > >> I suppose you mean in addition to the S_ISFIFO test? That sounds good. >> We should retain the optimization when reading from stdin that is a >> non-pipe. > > This can also ha

bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Paul Eggert
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 con

bug#24941: Early termination bug in grep 2.26

2016-11-15 Thread Jim Meyering
On Tue, Nov 15, 2016 at 3:33 PM, Paul Eggert wrote: > 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 h