Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh tests (dev-15)



Oliver Kiddle wrote:
> I've never looked at the new tests before but thought I'd run them
> today. They all pass except one in 07cond.ztst: [[ -e /dev/fd/0 ]]
> fails. I thought that this /dev/fd/0 stuff was Linux specific (I'm using
> AIX 3.2) so what is it doing as part of the zsh tests? Is zsh trying to
> emulate them on other systems? If so, maybe AIX's /dev/fd0 and similar
> devices (which I think are for the floppy drive) are getting in the way?

Yes, it's supposed to be emulated:  the conditional expressions part of the
manual says:

       In each of the above expressions, if file is of  the  form
       `/dev/fd/n',  where n is an integer, then the test applied
       to the open file whose descriptor number is n, even if the
       underlying  system does not support the /dev/fd directory.

so something on your system is confusing it (unless, of course, you're
really running the test with no stdin).  There's a run-time test for
this in cond.c:getstat():

/* /dev/fd/n refers to the open file descriptor n.  We always use fstat *
 * in this case since on Solaris /dev/fd/n is a device special file     */
    if (!strncmp(s, "/dev/fd/", 8)) {
	if (fstat(atoi(s + 8), &st))
	    return NULL;
        return &st;
    }

There doesn't look to be much to go wrong, but somehow you seem to be
getting NULL here.  (Actually, there's a lie in the manual page since the
code doesn't care if there's an integer next or not, but it's not
disastrous.)

I'd appreciate any help I can get with system-specific fixes for the tests,
I'm pretty much limited to Linux most of the time at the moment.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



Messages sorted by: Reverse Date, Date, Thread, Author