GNU bug report logs - #24941
Early termination bug in grep 2.26

Previous Next

Package: grep;

Reported by: Gary Johnson <garyjohn <at> spocom.com>

Date: Mon, 14 Nov 2016 02:42:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Gary Johnson <garyjohn <at> spocom.com>
Subject: bug#24941: closed (Re: bug#24941: Early termination bug in grep 2.26)
Date: Sat, 19 Nov 2016 09:49:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#24941: Early termination bug in grep 2.26

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 24941 <at> debbugs.gnu.org.

-- 
24941: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24941
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jim Meyering <jim <at> meyering.net>
Cc: Gary Johnson <garyjohn <at> spocom.com>, Norihiro Tanaka <noritnk <at> kcn.ne.jp>,
 24941-done <at> debbugs.gnu.org
Subject: Re: bug#24941: Early termination bug in grep 2.26
Date: Sat, 19 Nov 2016 01:47:48 -0800
[Message part 3 (text/plain, inline)]
This turned into more work than I expected, as I kept finding performance 
glitches and/or correctness bugs in the neighborhood. I installed the attached 
set of patches. Patch 03 is the crucial one. Patch 10 trivially fixes an earlier 
test of mine and I'm too lazy to write a separate email for it.

This fixes the problem for me, so I'm taking the liberty of closing this bug report.
[0001-grep-avoid-unnecessary-isatty-calls.patch (text/x-diff, attachment)]
[0002-grep-improve-diagnostic-on-lseek-failure.patch (text/x-diff, attachment)]
[0003-grep-scale-back-dev-null-speedup.patch (text/x-diff, attachment)]
[0004-grep-drain-the-input-pipe-faster.patch (text/x-diff, attachment)]
[0005-grep-avoid-unnecessary-gettext-call.patch (text/x-diff, attachment)]
[0006-grep-avoid-O-N-2-buffer-reallocation.patch (text/x-diff, attachment)]
[0007-grep-treat-f-dev-null-like-m0.patch (text/x-diff, attachment)]
[0008-grep-tune-f-dev-null.patch (text/x-diff, attachment)]
[0009-grep-f-dev-null-L-PAT-FILE-outputs-FILE.patch (text/x-diff, attachment)]
[0010-tests-use-returns_-rather-than.patch (text/x-diff, attachment)]
[Message part 14 (message/rfc822, inline)]
From: Gary Johnson <garyjohn <at> spocom.com>
To: bug-grep <at> gnu.org
Subject: Early termination bug in grep 2.26
Date: Sun, 13 Nov 2016 17:56:32 -0800
There was some recent discussion on the vim_dev list of a failure to
update a Vim package which was found to be due to an update of grep
from 2.25 to 2.26.  The details of the grep behavior are discussed
here:

https://www.linuxquestions.org/questions/slackware-14/pkgtools-grep-bug-in-slackware[64]-current-4175593054/

In short, it seems to be due to the "grep: /dev/null output
speedup" commit of 2016-05-01, af6af288eac28951b5eee1eaaf373e22b2193b7b.
When grep terminates early, it closes the pipe it's reading stdin
from, which terminates the program on the other side of that pipe
early, before that program has completed its task.

Oops.

Regards,
Gary




This bug report was last modified 8 years and 278 days ago.

Previous Next


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