delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/06/14:29:52

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4E8DF37F.8070103@gmail.com>
Date: Thu, 06 Oct 2011 20:29:19 +0200
From: Marco Atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.7.9 Missing SIGPIPE?
References: <4E833CB4 DOT 3060004 AT lysator DOT liu DOT se> <4E8B0FC6 DOT 9050600 AT lysator DOT liu DOT se> <4E8B116D DOT 3030905 AT gmail DOT com> <20111004140927 DOT GC20825 AT ednor DOT casa DOT cgf DOT cx> <4E8B193D DOT 4000700 AT gmail DOT com> <20111004163934 DOT GA30117 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20111004163934.GA30117@ednor.casa.cgf.cx>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 10/4/2011 6:39 PM, Christopher Faylor wrote:

> As I mentioned in the thread, that is supposed to be implemented in
> Cygwin.  I could never see a case where it wasn't sent.
>
> cgf

Hi Cgf,
my understanding of your explanation:

"Sort of.  If the process is doing a read, it is supposed to detect that
the tty has been closed and a SIGHUP is supposed to be sent.  It is not
precisely the same thing as sending a SIGHUP when the master closes but
I'm surprised that, in principle, it doesn't amount to the same thing.

Just see any of the SIGHUPs in fhandler_tty.cc.  They are all supposed
to be dealing with this scenario.

So, unless bash is not waiting for input (which is unlikely) this should
work."

was :
- it is not implemented
- you see no pratical case were this could be a problem as
   the program waiting for data should recognize the closure
   and correctly handling it

Checking fhandler_tty.cc , I see no implementation, but I can be wrong
as my understanding of cygwin internals is limited.

I admit that mc expectation is a corner case, but the subshell closure 
was based on such assumption (src/subshell.c)

/* Close master side of pty.  This is important; apart from */
/* freeing up the descriptor for use in the subshell, it also       */
/* means that when MC exits, the subshell will get a SIGHUP and     */
/* exit too, because there will be no more descriptors pointing     */
/* at the master side of the pty and so it will disappear.  */

so as workaround I added a SIGHUP

     kill (subshell_pid, SIGHUP);

just before mc exit on the main, to simulate the behaviour
and the subshell closes as needed.

Linux and BSD correctly handle the situation while only cygwin
was reported missing this behaviour.


Regards
Marco

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019