GNU bug report logs - #25283
grep: (standard input): invalid argument when run from make

Previous Next

Package: grep;

Reported by: Benno Fünfstück <benno.fuenfstueck <at> gmail.com>

Date: Tue, 27 Dec 2016 18:29:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


Message #13 received at 25283 <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: 25283 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, benno.fuenfstueck <at> gmail.com
Subject: Re: bug#25283: grep: (standard input): invalid argument when run
 from make
Date: Tue, 27 Dec 2016 16:50:18 -0500
[Message part 1 (text/plain, inline)]
On 27 Dec 2016 11:23, Paul Eggert wrote:
> Thanks for reporting that problem. I wonder why GNU 'make' sets stdout to append 
> mode? That surprises me, and I don't see where POSIX allows it. Anyway, it's 
> clearly a bug in 'grep' no matter what 'make' is doing. I wrote up a test case 
> for the bug and installed the attached, which is a bit more conservative than 
> the patch you submitted.

fwiw, this patch also fixes misbehavior when stdout & stderr are the same fd.
i mention it only because the NEWS entry was documenting different cases the
failure could come up.

this fails:
	(make -v | grep .) >/dev/null 2>&1

but this works:
	(make -v | grep .) >/dev/null 2>/dev/null

stracing shows same issue:
splice(0, NULL, 1, NULL, 32768, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument)
write(2, "/bin/grep: ", 11)       = 11
write(2, "(standard input)", 16)  = 16
write(2, ": Invalid argument", 18) = 18
write(2, "\n", 1)                 = 1
close(1)                          = 0
close(2)                          = 0
exit_group(2)                     = ?
-mike
[signature.asc (application/pgp-signature, inline)]

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

Previous Next


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