Newsgroups: comp.unix.shell
Path: utzoo!utgpu!watserv1!watmath!mks.com!mks!eric
From: eric@mks.mks.com (Eric Gisin)
Subject: Re: Remote shell question
Sender: eric@mks.com (Eric Gisin)
Distribution: na
References: <1991Feb1.145242.16915@bradley.bradley.edu>
	<1991Feb1.170808.24481@cbnews.att.com>
	<1991Feb6.043021.7019@NCoast.ORG>
	<1991Feb6.203453.20443@cbnews.att.com>
In-Reply-To: smk@cbnews.att.com's message of 6 Feb 91 20:34:53 GMT
Organization: Mortice Kern Systems Inc., Waterloo, Ontario, CANADA
Date: 7 Feb 91 13:21:44
Message-ID: <ERIC.91Feb7132145@mks.mks.com>

>+---------------
>| 	remsh/rsh remote-host 'sleep 30 <&- >&- 2>&- 7>&- &'
>| 
>| The offending fd #7 showed up in a "/etc/pstat -u pid-of-sleep-process" in
>| the file section.
>+---------------
>*7* ????!  Was ist los?

This is a rshd bug. Csh seems to close fd 3-9 at some point.
This bug causes lots of wasted time when trying to write an xrsh
shell script for X11.  You try
	rsh host "DISPLAY=$DISPLAY $@ 0<>/dev/null 1<&0 2<&0 &"
but the rsh doesn't exit after starting the remote command.
You have to close fd 0-2 otherwise rshd will wait for them to be closed
by the background command ($@ &). But the socket has been dup'd to 6 or 7,
so you have to use
	rsh host "exec 3<&- 4<&- 5<&- 6<&- 7<&- 8<&- 9<&-; DISPLAY=..."
