From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6082 invoked from network); 25 Nov 2008 23:27:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Nov 2008 23:27:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 6258 invoked from network); 25 Nov 2008 23:27:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Nov 2008 23:27:49 -0000 Received: (qmail 28359 invoked by alias); 25 Nov 2008 23:27:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26093 Received: (qmail 28342 invoked from network); 25 Nov 2008 23:27:41 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Nov 2008 23:27:41 -0000 Received: from ripple.fruitbat.org (69-12-150-177.dsl.static.sonic.net [69.12.150.177]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 9745380525B4 for ; Wed, 26 Nov 2008 00:27:36 +0100 (CET) Received: (from daemon@localhost) by ripple.fruitbat.org (8.13.4/8.8.8/PAC-1.3) id mAPNQo7e016743; Tue, 25 Nov 2008 15:26:50 -0800 Received: from ming.fruitbat.org(192.168.55.2) by ripple.fruitbat.org via smap (V2.1+anti-relay+anti-spam) id xma016737; Tue, 25 Nov 08 23:26:10 GMT Received: from gremlin.fruitbat.org (IDENT:202@gremlin.fruitbat.org [192.168.55.4]) by ming.fruitbat.org (8.12.10/8.10.2/PAC-1.6) with ESMTP id mAPNQ90w025522; Tue, 25 Nov 2008 15:26:10 -0800 Date: Tue, 25 Nov 2008 15:26:09 -0800 (PST) From: "Peter A. Castro" To: Peter Stephenson cc: zsh-workers@sunsite.dk Subject: Re: D03 test hang on cygwin with latest sources In-Reply-To: <200811250956.mAP9ukDw026001@news01.csr.com> Message-ID: References: <20a807210811202008o34865319qe1840896992ac48d@mail.gmail.com> <081120211244.ZM30106@torch.brasslantern.com> <20081124173230.31422068@news01> <20081124223104.GA37873@redoubt.spodhuis.org> <200811250956.mAP9ukDw026001@news01.csr.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: ClamAV 0.92.1/8680/Tue Nov 25 19:37:58 2008 on bifrost X-Virus-Status: Clean On Tue, 25 Nov 2008, Peter Stephenson wrote: > Phil Pennock wrote: >> On 2008-11-24 at 17:32 +0000, Peter Stephenson wrote: >>> Right, the behaviour isn't new. It seems as if the subprocess is >>> reading EOF from the input. >>> >>> % foo() { print $1; print hello >$1; [[ -e $1 ]] || print Ouch! } >>> % foo >(sleep 1; read foo || print Failed) >>> /proc/self/fd/12 >>> Failed >> >> ...% zsh -f >> redoubt% echo $ZSH_VERSION >> 4.3.6 >> redoubt% foo() { print $1; print hello >$1; [[ -e $1 ]] || print Ouch! } >> redoubt% foo >(sleep 1; read foo || print Failed) >> /tmp/zshQCDdM0 >> redoubt% >> >> Looks like a regression after all. > > Did you try it in 4.3.9? I tried it on three different versions, before > and after 4.3.6, and got the same result. If your system is doing > something different I'd like to find out what. > > I *can* get the test to pass if I undefine PATH_DEV_FD and define > HAVE_FIFOS, so it looks like this is the way forward. Some > investigation of why HAVE_FIFOS doesn't get define automatically would > be useful. Well, configure.ac has an explicit check for cygwin and disables the feature: dnl ----------- dnl named FIFOs dnl ----------- AC_CACHE_CHECK(if named FIFOs work, zsh_cv_sys_fifo, [if test "$host_os" = cygwin; then zsh_cv_sys_fifo=no else The other thing about this is that the fifo test code fails but the reason appears to be a race condition between the parent and child creating the fifo. I've modified the example thus: #include #include main() { char c; int fd; int pid, ret; unlink("/tmp/fifo$$"); #ifdef HAVE_MKFIFO if(mkfifo("/tmp/fifo$$", 0600) < 0) #else if(mknod("/tmp/fifo$$", 0010600, 0) < 0) #endif exit(1); pid = fork(); if(pid < 0) exit(1); if(pid) { fd = open("/tmp/fifo$$", O_RDONLY); exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); } sleep(1); /* prevent race */ fd = open("/tmp/fifo$$", O_WRONLY); ret = (fd < 0 || write(fd, "x", 1) < 1); unlink("/tmp/fifo$$"); exit(ret); } With this, the test runs, and HAVE_FIFOS gets defined. I hacked configure to not set PATH_DEV_FD too. :-) With the above changes the 'foo' test above works, though Test/C02cond.ztst still generates an error. Cygwin (really Windows) has some issues with fifos and the order in which they are created, and for the longest time fifos were really just not usable under Cygwin. Recent versions of Cygwin have updated the fifo/pipe code but it's still subject to Windows underlying functions. I understand the up coming Cygwin-1.7 will have a completely new implemention of pipes which should behave more like what the POSIX spec says it should. I could probably provide a sample configure.ac for all of this if you'd like, but the changes are pretty trivial. > (I tried adding a "sync" pipe to getpipe() in the same way as in the > other pipe code, but it didn't seem to help.) > > I'm also finding that I can read files with mode 000, so the [[ -r > ... ]] test fails (but it's clearly doing the right thing, since "cat" > on the file works, too). This may be because I have administrator > rights. Unless some Cygwin expert can do this better, I'll apply the > following. > > This is with Cygwin updated from the stable versions yesterday. > > Index: Test/C02cond.ztst > =================================================================== > RCS file: /cvsroot/zsh/zsh/Test/C02cond.ztst,v > retrieving revision 1.22 > diff -u -r1.22 C02cond.ztst > --- Test/C02cond.ztst 26 Feb 2008 20:50:13 -0000 1.22 > +++ Test/C02cond.ztst 25 Nov 2008 09:54:00 -0000 > @@ -94,6 +94,10 @@ > if (( EUID == 0 )); then > print -u$ZTST_fd 'Warning: Not testing [[ ! -r file ]] (root reads anything)' > [[ -r zerolength && -r unmodish ]] > + elif [[ $OSTYPE = cygwin ]]; then > + print -u$ZTST_fd 'Warning: Not testing [[ ! -r file ]] > + (all files created by user may be readable)' > + [[ -r zerolength ]] > else > [[ -r zerolength && ! -r unmodish ]] > fi -- Peter A. Castro or "Cats are just autistic Dogs" -- Dr. Tony Attwood