From: Richard M Kreuter <kreuter@pr...> - 2009-03-03 01:24:11
Patrick Stein writes:
> % ls -li
> 2608982 -rw-r--r-- 2 pat staff 0 Mar 2 15:56 a
> 2608982 -rw-r--r-- 2 pat staff 0 Mar 2 15:56 b
> 2608985 lrwxr-xr-x 1 pat staff 1 Mar 2 15:56 c -> a
> 2608986 lrwxr-xr-x 1 pat staff 1 Mar 2 15:56 d -> e
> % sbcl
> * (directory #P"./*.*")
> ... DIRECTORY returns me the names of symlinks
> that don't really point to files, but skips those that do.
> Is this intended behavior?
Sorta. From the Hyperspec entry for DIRECTORY:
| Determines which, if any, files that are present in the file system
| have names matching PATHSPEC, and returns a fresh list of pathnames
| corresponding to the truenames of those files.
"truename" is an implementation-dependent concept; SBCL defines the
truename of a broken or circular symlink to be the link itself (mostly
so that DIRECTORY won't signal an error in such cases). Further,
DIRECTORY removes duplicates after truename resolution. So because "c"
points to "a", it appears that "c" is being omitted from the output; if
"c" pointed to some file in another directory, the result would be less
> Do I have to switch to (sb-posix:opendir) if I want to see "c" also?
Maybe not: a few months ago SBCL's DIRECTORY was extended to take a
keyword argument :RESOLVE-SYMLINKS, which, if false, inhibits symlink
Get latest updates about Open Source Projects, Conferences and News.