Comment 6 for bug 1114689

Revision history for this message
pipping (pipping) wrote :

Here's a test case. On Linux, I create the following set of files, links, and directories:

$ mkdir /home/pipping/sbcl-test
$ mkdir /home/pipping/sbcl-test/dir
$ mkdir /home/pipping/sbcl-test/.dir
$ mkdir /home/pipping/sbcl-test/dir/dir-in-dir
$ touch /home/pipping/sbcl-test/file
$ touch /home/pipping/sbcl-test/dir/file-in-dir
$ ln -s dir /home/pipping/sbcl-test/link-to-dir
$ ln -s file /home/pipping/sbcl-test/link-to-file
$ ln -s dir/dir-in-dir /home/pipping/sbcl-test/link-to-dir-in-dir
$

Here's an overview over the resulting situation:

$ ls -AlR /home/pipping/sbcl-test/
/home/pipping/sbcl-test/:
total 8
drwxrwxr-x 3 pipping pipping 4096 Sep 29 11:18 dir
drwxrwxr-x 2 pipping pipping 4096 Sep 29 11:05 .dir
-rw-rw-r-- 1 pipping pipping 0 Sep 29 11:06 file
lrwxrwxrwx 1 pipping pipping 3 Sep 29 11:06 link-to-dir -> dir
lrwxrwxrwx 1 pipping pipping 14 Sep 29 11:18 link-to-dir-in-dir -> dir/dir-in-dir
lrwxrwxrwx 1 pipping pipping 4 Sep 29 11:07 link-to-file -> file

/home/pipping/sbcl-test/dir:
total 4
drwxrwxr-x 2 pipping pipping 4096 Sep 29 11:18 dir-in-dir
-rw-rw-r-- 1 pipping pipping 0 Sep 29 11:06 file-in-dir

/home/pipping/sbcl-test/dir/dir-in-dir:
total 0

/home/pipping/sbcl-test/.dir:
total 0
$

Leaving files and links to files alone, we have
- two physical directories, dir and .dir
- two symlinks to directories, link-to-dir and link-to-dir-in-dir

With sbcl-1.3.9.108-e34dd00-linux-x64, I get:

* (directory "/home/pipping/sbcl-test/*/" :resolve-symlinks t)

(#P"/home/pipping/sbcl-test/.dir/" #P"/home/pipping/sbcl-test/dir/"
 #P"/home/pipping/sbcl-test/dir/dir-in-dir/")
*

This is not unexpected (dir could show up either once or twice here since link-to-dir points to dir).

* (directory "/home/pipping/sbcl-test/*/" :resolve-symlinks nil)

(#P"/home/pipping/sbcl-test/.dir/" #P"/home/pipping/sbcl-test/dir/"
 #P"/home/pipping/sbcl-test/link-to-dir-in-dir/"
 #P"/home/pipping/sbcl-test/link-to-dir/")
*

This is unexpected. The fact that #P"/home/pipping/sbcl-test/link-to-dir/" and #P"/home/pipping/sbcl-test/link-to-dir-in-dir/" are contained in this list means that SBCL must have internally dereferenced the link when I thought I had asked it not to. If I apply Faré's patch, I get this instead:

* (directory "/home/pipping/sbcl-test/*/" :resolve-symlinks t)

(#P"/home/pipping/sbcl-test/.dir/" #P"/home/pipping/sbcl-test/dir/"
 #P"/home/pipping/sbcl-test/dir/dir-in-dir/")
* (directory "/home/pipping/sbcl-test/*/" :resolve-symlinks nil)

(#P"/home/pipping/sbcl-test/.dir/" #P"/home/pipping/sbcl-test/dir/")
*

This makes more sense to me.