hang on exit bug under Linux
Nicolas Williams
Nicolas.Williams at ubsw.com
Sat Jan 5 03:30:34 EST 2002
On Fri, Jan 04, 2002 at 09:32:29AM -0500, Nicolas Williams wrote:
> On Fri, Jan 04, 2002 at 09:15:26AM +0100, Peter Stuge wrote:
> > (The deal is that I want to make a certain PID a child of a different PID
> > than it is right now.)
>
> You can't do that.
>
> You can put ssh into the background by forking off a child and exiting,
> but then the shell cannot bring that child back to the foreground.
> Which makes the background option not so useful. Perhaps you can just
> have ssh send itself a SIGTSTP, but then you have to rely on the user to
> ask the shell to actually background the process.
In fact, I just tested that approach and it works, mostly, though the
shell I tested it with becomes confused about the status of the jobs
after it gets SIGCONT. But it works. If ssh is going to do any stdio
when it gets SIGCONT, then it will likely get SIGTTIN or SIGTTOU
though.
Personally, I don't think the self-background option is very practical.
I would be happy with an option to close the channels and exit when ssh
receives the session exit message.
Here's a script to emulate what I'm saying:
#!/bin/ksh
date
foo=$$
print $foo
trap 'print continue' CONT
( sleep 5 ; kill -CONT $foo ) > /dev/null 2>&1 &
print "Stopping $foo"
kill -TSTP $foo
sleep 10
print "hey there"
date
exit 0
> > //Peter
> >
>
Cheers,
Nico
--
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-
Visit our website at http://www.ubswarburg.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
More information about the openssh-unix-dev
mailing list