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

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,TW_CG,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o-
Date: Thu, 6 Oct 2011 15:29:49 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.7.9 Missing SIGPIPE?
Message-ID: <20111006192949.GE22971@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
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> <4E8DF37F DOT 8070103 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <4E8DF37F.8070103@gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 Thu, Oct 06, 2011 at 08:29:19PM +0200, Marco Atzeri wrote:
>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.

I was being imprecise in my response.

I understand what you say you did.  There was no reason to reexplain.

Once again, I don't understand why Cygwin's current implementation is
inadequate to handle the problem that you are seeing.  You can assert
that it must be because Cygwin does not explicitly send a SIGHUP on
close and you may be right but, again, I don't see why the current
implementation, which should amount to the same thing, does not work.

Yes.  It isn't explicitly implemented but it shouldn't matter.

cgf

--
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