delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/06/09:03:25

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4A51F60F.2030304@byu.net>
Date: Mon, 06 Jul 2009 07:03:11 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: [1.7] fifo regression
X-IsSubscribed: yes
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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My earlier request for bi-directional named pipes is not portable (POSIX
does not require it), so I don't care if we delay it until later.  But
here is a case that (usually) works in 1.5 but now (always) fails in 1.7,
and which obeys POSIX as far as I can tell (at any rate, it always works
on Linux, Solaris, and OpenBSD).  It would be really nice to have the
regression fixed before 1.7 goes golden, so that autoconf 2.64 can do
parallel testsuites on cygwin.  Expected:

$ mkfifo fifo # create a channel for process flow control
$ # spawn a background task which blocks until someone opens the
$ # fifo for reads, then sleeps 25 seconds before writing
$ (exec 5>fifo; sleep 25; echo one >&5)&
[1] 5216
$ # likewise, but sleep less
$ (exec 5>fifo; sleep 15; echo one >&5)&
[2] 5235
$ # open fifo for reading, to kick off parallel background processes
$ exec 5<fifo
$ # wait for clients to complete
$ read a <&5
[2]+  Done                    ( exec 5> fifo; sleep 15; echo two 1>&5 )
$ read b <&5
[1]+  Done                    ( exec 5> fifo; sleep 25; echo one 1>&5 )
$ # clean up
$ exec 5<&-
$ rm fifo
$ # see how clients were reaped
$ echo $a $b
two one

But on cygwin 1.7, when you attempt to create multiple writers to a single
fifo, the second writer creates an fd just fine but then fails on any
attempt to write to that fd:

$ mkfifo fifo
$ (exec 5>fifo; sleep 25; echo one >&5)&
[1] 4200
$ (exec 5>fifo; sleep 15; echo two >&5)&
[2] 204
$ exec 5<fifo
$ read a <&5
bash: line 6: echo: write error: Communication error on send
[2]+  Exit 1                  ( exec 5> fifo; sleep 15; echo two 1>&5 )
$ read b <&5
[1]+  Done                    ( exec 5> fifo; sleep 25; echo one 1>&5 )
$ exec 5<&-
$ rm fifo
$ echo -$a-$b-
- --one-

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpR9g8ACgkQ84KuGfSFAYA7dACeMQ/n1J6k8BFICyjLyTjGU5Er
/+sAoJGidQ31qFMDfY7/QFM/h6guUWQh
=Veq6
-----END PGP SIGNATURE-----

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