Weird /bin/sh bug

Dave Mason mason at tmsoft.uucp
Fri Jul 28 01:47:46 AEST 1989


I have the following shell program called 'uw' to tell me what is
going on with uucp:
	cd /usr/spool/uucp
	ls LCK* 2>/dev/null
	echo tail ${@+"$@"} SYSLOG
of course the 'echo' is only there for debugging purposes.  Now, if I
say 'uw' from my login shell, I get:
	LCK..dial    LCK..dptcdc
	tail LCK..dial LCK..dptcdc SYSLOG
!!!  If I first create a subshell, then it does what I expected:
	LCK..dial    LCK..dptcdc
	tail SYSLOG
If I create a new shell explicitly, e.g. with 'sh uw' then it works,
but if it is a clone of the login shell, then I get the erroneous
results, even if I try '(cd;(cd;uw))'.  This implies to me that some
garbage is left lying around by the login process that causes the
shell to go a bit bonkers.

I have a work-around for this case, although the semantics are subtly
different:
	TF="${@+$@} SYSLOG"
	cd /usr/spool/uucp
	ls LCK* 2>/dev/null
	echo tail $TF
(the only time it's different is if I say 'uw ""', but as the only
intended argument is 'uw -f', it's OK here.)

So, I don't need a fix, just thought I'd see whether the bug exists
elsewhere or has been fixed.
	../Dave



More information about the Comp.bugs.sys5 mailing list