GNU bug report logs - #18750
--line-buffered option doesn't work with --files-with-matches

Previous Next

Package: grep;

Reported by: "Louis S." <sautier.louis <at> gmail.com>

Date: Thu, 16 Oct 2014 21:22: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: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#18750: closed (--line-buffered option doesn't work with
 --files-with-matches)
Date: Thu, 31 Dec 2015 08:30:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 31 Dec 2015 00:29:46 -0800
with message-id <5684E77A.5000808 <at> cs.ucla.edu>
and subject line Re: --line-buffered option doesn't work with --files-with-matches
has caused the debbugs.gnu.org bug report #18750,
regarding --line-buffered option doesn't work with --files-with-matches
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
18750: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18750
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Louis S." <sautier.louis <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: --line-buffered option doesn't work with --files-with-matches
Date: Thu, 16 Oct 2014 23:16:30 +0200
Hi, I'm not quite sure this is a bug but it appears that the
--line-buffered option has no effect when used in conjunction with
--files-with-matches.
Here are some tests I ran with grep 2.20:
$ time for i in {1..100}; do grep --line-buffered -Rl gnome /usr/ |
head -n1 >& /dev/null; done
real    0m54.831s
user    0m37.077s
sys     0m17.550s

$ time for i in {1..100}; do grep -Rl gnome /usr/ | head -n1 >& /dev/null; done
real    0m54.858s
user    0m36.987s
sys     0m17.657s

$ time for i in {1..100}; do grep --line-buffered -R gnome /usr/ |
head -n1 >& /dev/null; done
real    0m7.414s
user    0m4.727s
sys     0m2.613s

Please let me know if line-buffering is supposed to work in that case.

Regards,

Louis


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 18750-done <at> debbugs.gnu.org
Cc: "Louis S." <sautier.louis <at> gmail.com>, Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Subject: Re: --line-buffered option doesn't work with --files-with-matches
Date: Thu, 31 Dec 2015 00:29:46 -0800
[Message part 4 (text/plain, inline)]
Thanks for the bug report. It also seems to me that --line-buffered should apply 
to nulls, not newlines, when -z is used. Also, there are a couple of other 
places where stdout should get flushed after a newline. Perhaps we should use 
setvbuf instead (is it faster?) when -z is not also used, but right now I just 
want to get the bug fixed for the next release, so I installed the attached, 
more-conservative, patch, and am marking this bug as done.
[0001-grep-fix-l-line-buffer-bug.patch (text/x-diff, attachment)]

This bug report was last modified 9 years and 147 days ago.

Previous Next


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