Subject: bin/25395: sh(1) closes FD 0 for some pipe members
To: None <gnats-bugs@gnats.netbsd.org>
From: Andy Isaacson <adi@hexapodia.org>
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
>Closed-Date:
>Last-Modified:
>Originator:     Andy Isaacson
>Release:        NetBSD 1.6.1
>Organization:
	<organization of PR author (multiple lines)>
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD netbsd.bitmover.com 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr 8 12:05:52 UTC 2003 autobuild@tgm.daemon.org:/autobuild/netbsd-1-6/i386/OBJ/autobuild/netbsd-1-6/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	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).
>How-To-Repeat:
	$ sh -c 'cat /etc/motd | tr a-z A-Z | grep foo | sed s/zip/zap/g' <&-
	grep: fstat: Bad file descriptor
>Fix:
	workaround: use bash instead.
>Release-Note:
>Audit-Trail:
>Unformatted: