Subject: bin/25395: sh(1) closes FD 0 for some pipe members
To: None <>
From: Andy Isaacson <>
List: netbsd-bugs
Date: 04/29/2004 14:08:30
>Number:         25395
>Category:       bin
>Synopsis:       sh(1) closes FD 0 for some pipe members
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 29 19:09:00 UTC 2004
>Originator:     Andy Isaacson
>Release:        NetBSD 1.6.1
	<organization of PR author (multiple lines)>
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr 8 12:05:52 UTC 2003 i386
Architecture: i386
Machine: i386
	When sh(1) runs a multiprogram pipeline with FD 0 closed,
	it can fail to plumb the pipeline correctly.
	I do not know if this bug is still present in newer releases
	(I am downloading 1.6.2 to test).
	$ sh -c 'cat /etc/motd | tr a-z A-Z | grep foo | sed s/zip/zap/g' <&-
	grep: fstat: Bad file descriptor
	workaround: use bash instead.