delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/12/25/16:40:05

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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=aC/
1Y73p3d9ngSJpU52DaA+U4HxYcTJGuaaiyHfWkJQ6QcxDk+BSGyCFekn93Ahqib7
rN4frtWlVLgv1F6QvIagMuMQJgv5hrJFmBY1W1sr/4vRgyCJPxa5BrrBz2AEc2Vk
/04d4ZkIGbGg/jLpPMoVyxfCj6/TUwsqB5VMyeyE=
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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; s=default; bh=tdGJI/Mmg
gsr4rWIGA3rqzK4dAI=; b=XegEMzinY8hFKV69Y8ptO9jDVKdX0a7aU2dbjyv59
Il+Rj07rltlWxUgEXc44nWPvUrajXgkXO/H5CwP3iT4pmVJIzQuHLYEHpKMPW+6P
qiTEGD4xn6frQDVrRxR8tmhT8p/yIs6AQW1zyIe+XC8ENGoesiBO3MYAAASBwUX9
wc=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=involving, disappears
X-HELO: limerock02.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
To: cygwin <cygwin AT cygwin DOT com>
From: Ken Brown <kbrown AT cornell DOT edu>
Subject: Problem with named pipes
Message-ID: <567DB7AB.5060606@cornell.edu>
Date: Fri, 25 Dec 2015 16:39:55 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
MIME-Version: 1.0
X-IsSubscribed: yes

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

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