[Openmcl-devel] Directory and symlinks

Gary Byers gb at clozure.com
Wed Nov 9 08:40:29 PST 2011

On Wed, 9 Nov 2011, Zach Beane wrote:

> Gary Byers <gb at clozure.com> writes:
>> I couldn't reproduce this.
>> If you're calling DIRECTORY with a relative pathname, what's the value of
>> *DEFAULT-PATHNAME-DEFAULTS* ?  What does calling
> *default-pathname-defaults* is #p"" and :pwd returns
> #p"/home/xach/tmp/", the directory in which I created the test directory
> structure.
>> If neither of those things explain it:
>> On a Linux system, my home directory is "/home/gb" and CCL is installed
>> in "/usr/local/src/ccl". If I do (in the shell):
>> $ cd
>> $ ln -sf ../../usr/local/src/ccl .   # also tried absolute name here
>> and in CCL:
>> ? :pwd                          ; can also call (CCL:DEFAULT-DERECTORY)
>> #P"/home/gb/"
>> ? (directory "ccl/*/*.lx64fsl")
>> => list of .lx64fsl files in immediate subdirectories of CCL directory.
>> What's different about what I'm doing and what you're doing ?
> The symlink in my case is behind the wildcard, perhaps that makes the
> difference?

Yes, it seems to.

> Does (directory "*/*.image") return the /usr/local/src/ccl/*.image files
> for you?

No, and there's at least some argument that it shouldn't.  (I'm not absoulutely
sure that I believe that argument ...)

The argument is that DIRECTORY is supposed to find matching files that are
present in the filesystem and return their truenames.  Does "foo" (or "ccl")
match the first wildcard in the argument to (directory "*/*.image") ?  The
truenames of those links clearly do, but it's less clear that the links themselves
do.  (I can imagine wanting both behaviors.)

A fairly recent CLISP returns a list containing the .image files in
the link's target in your example; a fairly recent SBCL and current CCL don't.

(directory "ccl")       ; same environment as above

returns a list of that file's truename in SBCL, NIL in CCL, and errors in CLISP.
(I think that SBCL's result is more consistent here than CCL's is.)

This is probably only one of several ways in which DIRECTORY behaves differently
across implementations.

> Thanks,
> Zach

More information about the Openmcl-devel mailing list