delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/04/12:40:15

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.6 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: Tue, 4 Oct 2011 12:39:34 -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: <20111004163934.GA30117@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>
MIME-Version: 1.0
In-Reply-To: <4E8B193D.4000700@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 Tue, Oct 04, 2011 at 04:33:33PM +0200, Marco Atzeri wrote:
>On 10/4/2011 4:09 PM, Christopher Faylor wrote:
>> On Tue, Oct 04, 2011 at 04:00:13PM +0200, Marco Atzeri wrote:
>>> On 10/4/2011 3:53 PM, Peter Rosin wrote:
>>>> Peter Rosin skrev 2011-09-28 17:26:
>>>>> Hi!
>>>>>
>>>>> When I use bash to build pipelines, they sometimes don't finish but
>>>>> instead some process remains running. Example:
>>>>>
>>>>> $ tail -f -n 10000 log.txt | grep . | head -n 2
>>>>>
>>>>> Almost instantly I get the expected two lines of output, but no prompt
>>>>> back. I have to use ctrl-c. If I don't ctrl-c I can run pstree in
>>>>> another terminal and see this:
>>>>>
>>>>> $ pstree
>>>>> ??????????mintty?????????bash?????????tail
>>>>>     ??????mintty?????????bash?????????pstree
>>>>
>>>> This example is a poor one, as tail simply waits for a new line, when it
>>>> gets a new line it forwards it to the pipe and promptly receives a
>>>> SIGPIPE as grep is not there anymore.
>>>>
>>>> I'll get back when I have distilled a better STC. If I can...
>>>
>>> Hi Peter,
>>> are you referring on something like SIGHUP on PTY closure ?
>>>
>>> http://cygwin.com/ml/cygwin/2011-07/msg00295.html
>>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
>>
>> Note that this thread contains your assertion that something isn't
>> happening correctly but it isn't clear that your analysis is correct.
>>
>> But, no, SIGPIPE != SIGHUP and the above example clearly shows a
>> completely different scenario than what is described in the above
>> thread.
>>
>> cgf
>
>Hi Cgf,
>I know that SIGPIPE != SIGHUP, but Peter mentioned that the example
>is not really representative of the PIPE problem he found, so eventually
>he catched the same problem I saw on mc.
>Of course, it could be a different one.
>
>Referring to the SIGHUP thread
>This portion of the standard, if I am not wrong,
>it is not currently implemented in cygwin:
>
>"If fildes refers to the master side of a pseudo-terminal, and this is 
>the last close, a SIGHUP signal shall be sent to the controlling 
>process, if any, for which the slave side of the pseudo-terminal is the 
>controlling terminal. It is unspecified whether closing the master side 
>of the pseudo-terminal flushes all queued input and output."

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

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