bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25283: grep: (standard input): invalid argument when run from make


From: Mike Frysinger
Subject: bug#25283: grep: (standard input): invalid argument when run from make
Date: Tue, 27 Dec 2016 16:50:18 -0500

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

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]