develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000326.003] Not OK: perl v5.6.0 +v5.6.0-RC3 on i386-AT386-gnu 0.2 (UNINSTALLED)

Thread Previous | Thread Next
From:
Dominic Dunlop
Date:
March 31, 2000 01:19
Subject:
Re: [ID 20000326.003] Not OK: perl v5.6.0 +v5.6.0-RC3 on i386-AT386-gnu 0.2 (UNINSTALLED)
Message ID:
p04310103b5093daf6c38@[192.168.1.4]
At 19:16 +0200 2000-03-29, Mark Kettenis wrote:
>On the Hurd, pipes are implemented in the same way as in BSD 4.4.
>They're bidirectional and implemented using sockets.  S_ISFIFO() will
>probably return false on the ends, since it only checks for FIFO-ness
>and not for the ends being sockets (S_ISSOCK() will return true).  So
>there is indeed a problem with POSIX-compliance.

On MachTen, the file type is zero for pipe ends -- they are not even 
being marked as being sockets.  If they were, S_ISFIFO would succeed 
because of the rather tacky contents of sys/stat.h:

  *      @(#)stat.h      8.6 (Berkeley) 3/8/94
...
#define S_IFIFO  0010000                /* named pipe (fifo) */
...
#define S_IFSOCK 0140000                /* socket */
...
#define S_ISFIFO(m)     ((m & 0170000) == 0010000 || \
                          (m & 0170000) == 0140000)      /* fifo or socket */
...
#ifndef _POSIX_SOURCE
...
#define S_ISSOCK(m)     ((m & 0170000) == 0010000 || \
                          (m & 0170000) == 0140000)      /* fifo or socket */
#endif

The fact that MachTen appears to be trying to kludge around the 
issue, yet still fails, leads me conclude that it's buggy.  I hope 
the Hurd does better.  Can you tell me what octal filetype my test 
program reports, and what sys/stat.h maps that number to?

>However, I disagree that this is something that Perl should not work
>around.  There is a long history of pipes being implemented using
>sockets in BSD, and they're bidirectional since at least BSD 4.4.  So
>there will be quite a few systems out there that implement pipes that
>way.  We'll probably fix the Hurd to follow POSIX (and Linux) a bit
>more closely, but that might not happen to other systems.

I wouldn't mind seeing a work-around on systems which, for historical 
reasons, identify pipe-ends as sockets; but I'm reluctant to put in a 
hack to accommodate systems which don't bother to identify pipe-ends 
at all.  That said, the comment at line 459 in doio.c suggests that 
MachTen's not alone in being slapdash:

                IoTYPE(io) = 's'; /* some OS's return 0 on fstat()ed socket */
                                 /* but some return 0 for streams too, sigh */

Do feel free to submit a patch: I'm fighting other stuff just now.
-- 
Dominic Dunlop

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About