X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4C65A83F.4010608@redhat.com> Date: Fri, 13 Aug 2010 14:17:03 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Broken process substitution References: <00c301cb3b22$ae416800$0ac43800$@gmail.com> In-Reply-To: <00c301cb3b22$ae416800$0ac43800$@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigB65460134C04D85A4979FF36" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------enigB65460134C04D85A4979FF36 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 08/13/2010 02:04 PM, Daniel Colascione wrote: > Try "echo hello > >(cat)" -- that's supposed to output "hello". What makes you think it's supposed to echo hello? That's system specific on what will happen. According to the bash manual, >(cat) is evaluated first, and will result in a /dev/fd reference, or a named pipe (it so happens that it is a /dev/fd reference in cygwin). But this pipe is tied to the subprocess, so it only exists as long as the subprocess exists. Then bash does the redirection. If >(cat) has already gone away, then the resulting string /dev/fd/63 no longer exists. So redirecting to a non-existent file fails. But if cat hasn't finished executing yet, then the redirection will succeed. Classic data race. Your expectations are wrong, and this is not a bug in cygwin, per se. On the other hand, a named fifo might be more persistent; bash might keep the fifo around until the entire statement is complete, rather than keeping the pipe and /dev/fd reference for the life of the subprocess. But I'd have to recompile bash to force it to use a named fifo, and we already know that named fifos have bugs in cygwin. --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigB65460134C04D85A4979FF36 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMZag/AAoJEKeha0olJ0NqKBsH/iOoPdArdPEt8p+ieXTXw39f PbOxrqusG7wBBZpUdJzx9pVwextD4/6Uhl+ywusQxFn4aopP3930dm6r8MKP9KCC 3pxOPy9mGzzLEPGYR3qPsldgWQvfj6ldnnOr8r1znhNDYEDc6+1g9PSB8t5wG1uG v1wgnwafRXCyOcmfgLebxKQAn/7z4hEi9X55hgkwE7WqFa1DtRvROP3XyjcX4OWO myTnkokBsXKA2CMLWuVmS4wdg21Rb+KaTjaMC3beMinPge3Vi4Eipr9DlA54Ie2i UvMsxcqhyvIChGb9CPQ9bOdyElKMuBJTqCKws7Ec8gNZLkfoZfPVI+p9QDsqI8M= =5sDm -----END PGP SIGNATURE----- --------------enigB65460134C04D85A4979FF36--