delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/08/02/23:51:04

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=HofdcoigORjE7r8Z
aZWGWp1SpsuDYxgKQeWfSDCG0QEF5KWurV36HjI8M8YvpuPOYr2qN9VANvYotr1f
zDZZE4ady0WUDR1BhfExTs8glBkOnnGgVKLlGgjmyp+pTh2GSJDqwWLQRWz/2+Bu
8t+ht3G7AHxSeOhMwPOXnQkva7w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=qvfDNQcHhnVqKchXGE2JGp
nDTaY=; b=j/Tn+Zu05rpSJcdWuvCh2Z+3833lT8X8fTVmdNYJupaX+r91iJjPaU
WKYvp8BAbwVqTqYpiOGv8aPTlBzuUkN0eEXQgtsVnuCEFNvph0Rf3jpXpTn6Ppmd
Da2ksOg3OftK6t1ajIYqhFVF6bT1+u5EQ+tK59sqevuyG107sZUrQ=
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=mentions
X-HELO: smtp-out-no.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: Regression (last snapshot)
To: cygwin AT cygwin DOT com
References: <20190729134700 DOT GO11632 AT calimero DOT vinschen DOT de> <ced2750a-0a52-1396-b6c1-f4228116bde7 AT cornell DOT edu> <20190729152327 DOT GQ11632 AT calimero DOT vinschen DOT de> <20190729154049 DOT GR11632 AT calimero DOT vinschen DOT de> <c5d01965-80b9-cece-54d2-f7462f84c0a2 AT cornell DOT edu> <8e57d4da-722d-1b9a-bd28-5f96ed182f6a AT cornell DOT edu> <0a09679b-1a0f-613b-04c8-1a63da8a00c2 AT cornell DOT edu> <33aead20-540c-ee3b-0d38-ff053fbac040 AT dronecode DOT org DOT uk> <12269538-c387-1f1e-ab5a-b36b60d09937 AT cornell DOT edu> <a61264b5-80da-52fc-7093-8e8d9a8ace33 AT redhat DOT com> <20190801160440 DOT GC11632 AT calimero DOT vinschen DOT de> <19e73527-cb9a-a106-a57a-2895b8a520c9 AT cornell DOT edu> <e922144a-1f02-9398-4223-dbf76c69231f AT cornell DOT edu> <b4d57d88-3ec4-939f-c591-e50aaef607f3 AT cornell DOT edu> <5f4a0400-a173-1948-6048-69ba54df2571 AT SystematicSw DOT ab DOT ca> <400eebe3-3ba9-5448-85a8-92e6e0dfdf0c AT cornell DOT edu> <1d2c03d5-8534-405e-b150-c899508712fc AT redhat DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <93bdffad-7a57-415d-c7db-94c17acb417e@SystematicSw.ab.ca>
Date: Fri, 2 Aug 2019 21:50:09 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <1d2c03d5-8534-405e-b150-c899508712fc@redhat.com>
X-IsSubscribed: yes

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
handling).

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