MAP-DIRECTORY didn't :CLASSIFY-SYMLINKS by default
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 9 Nov 2011 11:24:54 +0000 (13:24 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 9 Nov 2011 12:05:35 +0000 (14:05 +0200)
  ...even though it said it did.

  Given

    foo/bar => ../src/bar
    src/bar/quux.asd

  now

    (directory "foo/*/*.asd")

  finds the .asd as expected.

NEWS
src/code/filesys.lisp
tests/filesys.test.sh

diff --git a/NEWS b/NEWS
index f79f635..9c29c28 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@
 changes relative to sbcl-1.0.53:
   * bug fix: on 64-bit targets, atomic-incf/aref does index computation
     correctly, even on wide-fixnum builds. (lp#887220)
+  * bug fix: (directory "foo/*/*.*") did not follow symlinks in foo/ that
+    resolved to directories.
 
 changes in sbcl-1.0.53 relative to sbcl-1.0.52:
   * enhancement: on 64-bit targets, in src/compiler/generic/early-vm.lisp,
index c25818f..be6cc69 100644 (file)
@@ -737,7 +737,7 @@ matching filenames."
 ;;; This is our core directory access interface that we use to implement
 ;;; DIRECTORY.
 (defun map-directory (function directory &key (files t) (directories t)
-                      (classify-symlinks) (errorp t))
+                      (classify-symlinks t) (errorp t))
   #!+sb-doc
   "Map over entries in DIRECTORY. Keyword arguments specify which entries to
 map over, and how:
@@ -753,12 +753,12 @@ map over, and how:
    pathname. Defaults to T.
 
  :CLASSIFY-SYMLINKS
-   If T, the decision to call FUNCTION with the pathname of a symbolic link
+   If true, the decision to call FUNCTION with the pathname of a symbolic link
    depends on the resolution of the link: if it points to a directory, it is
    considered a directory entry, otherwise a file entry. If false, all
-   symbolic links are considered file entries. Defaults to T. In both cases
-   the pathname used for the symbolic link is not fully resolved, but names it
-   as an immediate child of DIRECTORY.
+   symbolic links are considered file entries. In both cases the pathname used
+   for the symbolic link is not fully resolved, but names it as an immediate
+   child of DIRECTORY. Defaults to T.
 
  :ERRORP
    If true, signal an error if DIRECTORY does not exist, cannot be read, etc.
index a02e368..50f985d 100644 (file)
@@ -206,6 +206,7 @@ mkdir foo
 touch foo/aa.txt
 touch foo/aa.tmp
 mkdir foo/x
+
 mkdir far
 touch far/ab.txt
 touch far/ab.tmp
@@ -213,11 +214,19 @@ mkdir far/x
 mkdir far/y
 mkdir far/y/x
 mkdir far/x/x
+
 mkdir qar
 touch qar/ac.txt
 touch qar/ac.tmp
+
 mkdir foo.moose
 touch foo.bar
+
+mkdir -p a/z c
+touch a/z/foo.bar
+touch a/z/foo.dummy
+ln -s ../a/z c/z
+
 run_sbcl <<EOF
 (setf (logical-pathname-translations "foo")
       (list (list "**;*.txt.*" (merge-pathnames "foo/**/*.txt"))
@@ -248,6 +257,7 @@ run_sbcl <<EOF
 (test "foo:foo;*.txt" "foo/aa.txt")
 (test "foo:**;*.tmp" "foo/aa.tmp" "far/ab.tmp" "qar/ac.tmp")
 (test "foo:foo;*.tmp" "foo/aa.tmp")
+(test "c/*/*.bar" "a/z/foo.bar")
 (quit :unix-status $EXIT_LISP_WIN)
 EOF
 check_status_maybe_lose "DIRECTORY/PATTERNS" $?