Reading directories

William Roberts liam at cs.qmc.ac.uk
Thu Oct 20 20:24:18 AEST 1988


In article <331 at talos.UUCP> kjones at talos.UUCP (Kyle Jones) writes:
>It is clear why directories should not be arbitrarily writable but I
>don't see any such reason why they shouldn't be readable.  The portable
>directory reading routines could use the existing read(2) system call,
>instead of adding (yet another) system call just to read directories.

This is too narrow a view in the world of networks and
distributed systems - the "portable directory routines" exist
so that the code *above* them is portable, not so that the
routines themselves are portable. We have lots of grief because
of programs which try to interpret directories via read(2), not
noticing that they are actually coming from

1) a fileserver with a different byte ordering,
   e.g. a Sun mounted on a Sequent anything,
2) a different type of UNIX, e.g. an A/UX (== SysV.2.2)
   filestore mounted on a Sun (== BSD 4.2)
3) (God help us) a completely different kind of beast
   altogether, such as the NFS-served MacOS filesystem that
   we have here at QMC.

The grief, incidentally, comes from the effect when the errant
program fails to notice that its information is garbage - the
server spends lots of time printing messages such as "NFS
read request on non-file" on the console....

If someone out there is listening - please fix "tar" and
"ranlib" so that they don't expect to use read(2) on
directories, and furthermore, make *your* NFS implementation
follow the rule that open(2)ing a directory is not permitted.
-- 

William Roberts         ARPA: liam at cs.qmc.ac.uk  (gw: cs.ucl.edu)
Queen Mary College      UUCP: liam at qmc-cs.UUCP
LONDON, UK              Tel:  01-975 5250



More information about the Comp.unix.wizards mailing list