SVR4 /bin/sh BUG

Rick Richardson rick at digibd.com
Thu May 30 13:42:23 AEST 1991


I'm posting this here in the hopes that the various
vendors of SVR4 fix this in their next releases.
Known to fail on AT&T, HCI, Commodore, and i860 SVR4's.

#
#	Demonstrates bug in SVR4 /bin/sh
#	Works OK with /bin/sh on SVR3 and XENIX
#	Works OK with /bin/ksh on SVR4
#
#	Should output the first line of /etc/passwd four times
#	Only does it three times on SVR4 and then hangs
#
#	Seems to be related to changing fd0 in a function
#
read_by_func() {
	exec 3<&0 0<$1
	read x
	echo $x
	exec 0<&3 3<&-
}

exec 3<&0 0</etc/passwd
read x
echo $x
exec 0<&3 3<&-

exec 3<&0 0</etc/passwd
read x
echo $x
exec 0<&3 3<&-

read_by_func /etc/passwd

# Gets stuck here with /bin/sh...
read_by_func /etc/passwd
-- 
Rick Richardson		Email: rick at digibd.com
Senior MTS		Fax: (612) 943-0803
DigiBoard, Inc.		Tel: (612) 943-5383



More information about the Comp.bugs.sys5 mailing list