X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Michael Hoffman <b3i4old02@sneakemail.com>
Subject:  1.5.24: rxvt or console fail to shutdown due to ssh -f still running  despite setsid()
Date:  Mon, 09 Apr 2007 16:29:35 +0100
Lines: 42
Message-ID: <evdm5e$7j8$1@sea.gmane.org>
References:  <egiis5$dms$1@sea.gmane.org> <Pine.GSO.4.63.0610110848550.26268@access1.cims.nyu.edu> <egisev$lsl$1@sea.gmane.org>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Thunderbird 1.5.0.8 (Windows/20061025)
In-Reply-To: <egisev$lsl$1@sea.gmane.org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

I originally reported this in October 2006 
<http://cygwin.com/ml/cygwin/2006-10/msg00399.html>:

[Michael Hoffman]
>>> When I log out of or shutdown my Windows login session, if I had a
>>> background process that I started within a Win32 rxvt session, I get an
>>> error that rxvt00000<some other hex numbers> has not shut down. For
>>> example if I use ssh -f or run ssh in the background using &, this
>>> symptom manifests.
>>>
>>> I can also see a related symptom if I am running using a Windows
>>> console. When I log out of bash, the console window will stick around
>>> until the ssh process is killed.
>>>
>>> I would like for these console windows and hidden rxvt windows to shut
>>> down without further confirmation. Is there a way to do this? Or a good
>>> workaround?
>>>
>>> I have Googled for this problem, and while I have found other related
>>> problems (such as ssh-agent continuing to run) I have not found any
>>> solutions for this case.

[Igor Peshansky]
>> "man nohup", "man setsid", in bash: "help disown".

[Michael Hoffman]
> Thanks, setsid works fine if I do not need to enter a password but 
> unfortunately will not work if I am using ssh -f to get an interactive 
> password before forking.
> 
> Looking in the openssh source, I can see that ssh -f calls daemon(), 
> which should call setsid(). Is that correct? If so, why is it still 
> hanging onto the terminal?

I have just checked the source for the daemon() function and the setsid 
executable. They both call fork() and then setsid(). Do the console/rxvt 
process stick after calling ssh -f because file descriptors are left 
open? Can you suggest a strategy to deal with this?

Many thanks,
-- 
Michael Hoffman


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

