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: Regression (last snapshot)

On 2019-08-02 15:58, Eric Blake wrote:
> On 8/2/19 4:53 PM, Ken Brown wrote:
>>>> Putting this all together, Eric's explanation is indeed correct.  All
>>>> processes created by xwin-xdg-menu via fork/exec inherit the property of
>>>> ignoring SIGPIPE.
>>>> I don't know if this is a bug, but it certainly leads to surprising
>>>> behavior.  Jon, maybe xwin-xdg-menu needs to call signal(SIGPIPE,
>>>> SIG_DFL) either after calling gtk_init() or before calling exec()?
>>> How does that relate to this only happening in the latest snapshot, and not in
>>> the current release, or any Linux system?
>> It does happen in the current release, as I said earlier in the thread.
>> There's no way to test it on Linux.  xwin-xdg-menu is a Cygwin-specific 
>> program (written by Jon).
>>> I would certainly expect any shell (or any other program handling pipes) to set
>>> or reset SIGPIPE handling, rather than accept any default.
>> Take a look at the bash source code and the grep source code.  You'll 
>> see that neither one of them does this.  And I don't know why you would 
>> expect it.

I would expect it in bash as bash creates and manages pipes for functions,
internal and external commands, and when I say handling pipes, I mean creating
pipes for internal child sub-shells and other external processes to use (which I
would not expect to touch SIGPIPE, unless they required specially programmed

> Worse, POSIX explicitly requires that the shell is unable to reset
> SIGPIPE back to SIG_DFL if it was inherited ignored (try it - you CANNOT
> use the 'trap' command to undo an inherited ignored SIGPIPE, even though
> it can be used to undo signals ignored locally). It is generally
> considered bad practice to leak ignored SIGPIPE into a child process,
> even if it makes sense in the parent process.

Looking at mintty wiki, it mentions pipe handling, so may reset the signal
action, and it mentions that Cygwin emulates ptys using pipes, so winpty is
needed to deal with some Windows programs that require a native console.

Could Cygwin pty emulation with pipes, under an xterm terminal that perhaps does
not reset signal actions, be causing or having problems under some
circumstances, while running external commands in sub-shells without normal
SIGPIPE signal actions?

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

Problem reports:
Unsubscribe info:

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