delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/12/11/09:42:55

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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-id:content-transfer-encoding
:mime-version; q=dns; s=default; b=xnVkuFAeOPcUGEUkSmMk+kzcXCN0A
TIJTGyIC9DZmkx8TjMFLOndz6cecc4N0YIuvBrTC+7vQduQ7He2fXIjEGRJ5ruaS
bNLYuxHH+u74SXqmOdUZyyGUrFAbpE1s97jxuRWUIulB93Y5BnInzanjarHcftfS
fhbM6Tvod1wqjE=
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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-id:content-transfer-encoding
:mime-version; s=default; bh=IGHBhvPiV/uUQhPaSLusdoNZxCU=; b=vT7
wy85udd1DxhQOH4RvsB4MJ+V+r6vx3s83IbSj0BqRmy7nMTHWpgUeDmwocB9Bb4o
eE2o+GcBUjNowfQiCgNi4Kz1CJf6LLEfPyVPIF9ePw6fc3f1E0RIJljjxkr2Wr4N
+C9yohwHMLB6dFuG0Z5QhNM1gTu3j+lSQ6qH8bO8=
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=-1.9 required=5.0 tests=BAYES_00,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=terminal, Terminal, Problem, thorough
X-HELO: NAM01-BY2-obe.outbound.protection.outlook.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BpJOX97vUw3JIRlRhKQfIC2srPAMtQfly26beK7bPW8=; b=OUi++YCb7tWHLVJc6ntde91z68Rv0PQfrHWTLG4Q8QEi0+6Sl8ILB7bgMOCFKgCh97+a3NhtaQ8iht911sv2KCl0atx6W0kHV6mA7+fWi8oFDfsoX4oFVSyrbegQPYeb0si3DPZEMn+HBoHt0t44F/Ce45ISlvTJfB/jfr+jTQY=
From: Ken Brown <kbrown AT cornell DOT edu>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: Problem with named pipes
Date: Tue, 11 Dec 2018 14:42:40 +0000
Message-ID: <d5ff7ebb-6fc2-5ce6-e38b-6e6c9113d102@cornell.edu>
References: <567DB7AB DOT 5060606 AT cornell DOT edu> <20160108205008 DOT GM20447 AT calimero DOT vinschen DOT de>
In-Reply-To: <20160108205008.GM20447@calimero.vinschen.de>
user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu;
received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts)
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id wBBEgsmh028136

On 1/8/2016 3:50 PM, Corinna Vinschen wrote:
> On Dec 25 16:39, Ken Brown wrote:
>> I've noticed a difference between Cygwin and Linux involving named pipes.  I
>> don't know if this a bug or simply a difference.
>>
>> Consider the following two scripts:
>>
>> $ cat fifo1.sh
>> #!/bin/sh
>> set -x
>> rm -f foo
>> mkfifo foo
>> exec 7>foo
>> echo blah > foo
>>
>> $ cat fifo2.sh
>> #!/bin/sh
>> set -x
>> read bar < foo
>> echo $bar
>>
>> I run fifo1.sh in Terminal 1 and get the following on both Cygwin and Linux:
>>
>> [Terminal 1]
>> $ ./fifo1.sh
>> + rm -f foo
>> + mkfifo foo
>> + exec
>>
>> The call to echo in the next line blocks, because foo has not yet been
>> opened for reading.  Now I run fifo2.sh in Terminal 2.  On Linux, the "read"
>> in fifo2.sh unblocks fifo1.sh, and I see the following:
>>
>> [Terminal 1, Linux]
>> $ ./fifo1.sh
>> + rm -f foo
>> + mkfifo foo
>> + exec
>> + echo blah
>>
>> [Terminal 2, Linux]
>> $ ./fifo2.sh
>> + read bar
>> + echo blah
>> blah
>>
>> On Cygwin, however, Terminal 1 remains blocked, and Terminal 2 is blocked
>> when it tries to read:
>>
>> [Terminal 2, Cygwin]
>> $ ./fifo2.sh
>> + read bar
>>
>> The problem disappears if I remove the line "exec 7>foo" from fifo1.sh.  The
>> problem also disappears if I leave that line in, but change the last line to
>> "echo blah >&7".
> 
> Very tricky problem.  The FIFO code falls over its own feet trying to
> handle more than one writer (exec 7> is the first, echo blah is the
> second writer).  Sigh.  This code needs a thorough rewrite...

Hi Corinna,

I'm coming back to this thread after three years.  I'd be willing to put in some 
time working on this, if you could point me in the right direction.  Do you have 
ideas about what a rewrite of the FIFO code might look like?

The one idea that I had was that a reader could open several instances of the 
Windows named pipe, allowing several writers to connect to it simultaneously.  I 
think that would solve the particular problem I reported (and the similar 
problem cited by Houder up-thread).  But it would just be a band-aid, and Cygwin 
FIFOs still wouldn't be POSIX compliant.

Ken

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