X-Spam-Check-By: sourceware.org
Message-ID: <45F3376B.2080507@byu.net>
Date: Sat, 10 Mar 2007 15:55:39 -0700
From: Eric Blake <ebb9@byu.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: bash process substitution "<(list)" possible bug
References: <200703101514.l2AFEkOW002199@tigris.pounder.sol.net>
In-Reply-To: <200703101514.l2AFEkOW002199@tigris.pounder.sol.net>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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

According to Tom Rodman on 3/10/2007 8:14 AM:
>   ~ $ /tmp/foo <(echo ABC)
>   + test -s /proc/self/fd/63
>   + echo 1
> 
> The 'test -s "$file"' in the test run above should return 0.

How do you figure?  pipes are special file types, and st_size is
unspecified in a stat() call on a pipe, so the -s test is unreliable in
the first place.  Not to mention there is an inherent race in your script
(did the 'echo ABC' process run before or after the 'test -s
/proc/self/fd/63' builtin of the script?).  I maintain that there is no
bug except in your script.

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

Eric Blake             ebb9@byu.net
volunteer cygwin bash maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF8zdr84KuGfSFAYARAnUYAKCW2DUrKcY5FMpz7DXTjErLE4CnNQCdEZWA
xDpzpb8nzuShkWgw2GJi/Yo=
=FcmH
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

