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 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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