Should \"ls -R\" traverse symlinks?
Root Boy Jim
rbj at dsys.ncsl.nist.gov
Sat Aug 5 07:42:23 AEST 1989
? From: Jonathan <jonathan at comp.vuw.ac.nz>
? In article <558 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
? >flee at shire.cs.psu.edu (Felix Lee) sez:
? >> No. Not unless "ls -R" detects cycles and guarantees termination.
? >> If you really want to traverse links, "ls -RL" is almost adequate.
? >
? >Agreed
? These postings have completely lost the point of the original query, which
? was ``Should ls -R traverse symlinks on a *Pyramid*''?
? Pyramid's OSx is a dual-universe Un*x implemented using conditional symbolic
? links---symlinks that contain the names of two files, one each for the bsd
? and att universe. For instance, /bin is a csymlink to .ucbbin and .attbin,
? respectively.
So far, so good.
? Since OSx's lstat(2) does not distinguish between ordinary symlinks
? and csymlinks (perhaps because Pyramid didn't want to break user code
? that happened to do an lstat on a c-symlink; perhaps because the
? implementation is a kludge), having OSx commands do different things for
? ordinary symlinks and conditional symlinks is well-nigh impossible.
? Pyramid have modified several OSx commands to grok conditional symbolic
? links. OSx's ls follows symlinks symlinks by default,
? *doesn't* follow them for ls -L.
But this is exactly *backwards* according to the definition. The -L
option is supposed to pretend that the symbolic link is a hard one.
? (This makes sense to me. Seeing the conditional symlinks is
? generally not what people or shell scripts want to do. The
? incompatibility of ls itself is rather annoying, especially in an
? environment with other Unix implementations.)
? Since ls follows symlinks by default, it seems consistent and least
? surprising for ls -R to to traverse symlinks, which can lead to the
? problems already discussed. Perhaps an option meaning "follow
? conditional, but not ordinary, symlinks" is what's wanted.
BSD ls *sometimes* follows symlinks. Without `-l', it does, with it it
doesn't. It always does with `-L'. Since symlinks were a BSD invention
(well, the first implementation anyway), it must be either considered
the standard, or called into question and changed by mutual agreement.
SunOS, on the other hand, *never* follows symlinks, unless given `-L'.
? Despite Pyramid's inelegant implementation, there is an interesting
? issue here: What should the behaviour of ls (+ system calls, other
? commands) be when the mapping from pathnames to files is a relation
? rather than a function?
Actually, I think I prefer Sun's behavior, but would rather see the
new name pointing to the old in the listing: foo -> bar.
? Are there any other systems that use conditional symbolic links?
? Do Sequent systems deal with this issue, and if so, how? Are there
? any heterogenous distributed systems that use conditional symbolic links?
Sequent uses conditional symbolic links and the dual universe scheme.
They use one of the spare fields in the stat structure to tell the
difference between symlinks and csymlinks.
Are you sure there is no way to tell the difference in OSx?
How does ls print the value of a csymlink? Sequent's does it like:
% ls -ld /bin
lrwxr-xr-w ...... /bin -> ucb=.bin att=/usr/att/bin
? sane mailers: jonathan at comp.vuw.ac.nz | NZ Industrial democracy:
? UUCP path: ...!uunet!vuwcomp!jonathan | One factory, one vote!
Root Boy Jim
Have GNU, Will Travel.
More information about the Comp.unix.wizards
mailing list