This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.7.9 Missing SIGPIPE?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]