robustify DIRECTORY on logical pathnames
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 11 Jun 2011 12:37:32 +0000 (15:37 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 11 Jun 2011 13:56:41 +0000 (16:56 +0300)
  PATHNAME-INTERSECTIONS used to return pathnames with name or type
  NIL if there was a mismatch -- but it should not return any
  pathnames at all for a mismatch.

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

diff --git a/NEWS b/NEWS
index e10971e..091a08b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ changes relative to sbcl-1.0.49:
     boa-construtors can be used to initialized structure slots.
   * bug fix: FMAKUNBOUND removes the MACRO-FUNCTION, should one exist.
     (lp#795705, regression)
+  * bug fix: DIRECTORY works better on logical pathnames.
 
 changes in sbcl-1.0.49 relative to sbcl-1.0.48:
   * minor incompatible change: WITH-LOCKED-HASH-TABLE no longer disables
index d1933d6..c8a3999 100644 (file)
@@ -991,7 +991,7 @@ Experimental: interface subject to change."
            ((or (null one) (eq one :unspecific)) two)
            ((or (null two) (eq two :unspecific)) one)
            ((string= one two) one)
-           (t nil)))
+           (t (return-from pathname-intersections nil))))
        (intersect-directory (one two)
          (aver (typep one '(or null (member :wild :unspecific) list)))
          (aver (typep two '(or null (member :wild :unspecific) list)))
index c91324f..77aff65 100644 (file)
@@ -219,12 +219,15 @@ touch qar/ac.tmp
 mkdir foo.moose
 touch foo.bar
 run_sbcl <<EOF
+(setf (logical-pathname-translations "foo")
+      (list (list "**;*.txt.*" (merge-pathnames "foo/**/*.txt"))
+            (list "**;*.*.*" (merge-pathnames "**/*.*"))))
+
 (defun test (pattern &rest expected)
   (let ((wanted (sort (mapcar #'truename expected) #'string< :key #'namestring))
         (got (sort (directory pattern) #'string< :key #'namestring)))
     (unless (equal wanted got)
-      (format t "wanted:~%  ~Sgot:~%  ~S" wanted got)
-      (error "wanted:~%  ~Sgot:~%  ~S" wanted got))))                 
+      (error "wanted:~%  ~S~%got:~%  ~S" wanted got))))
 (test "*/a*.txt" "foo/aa.txt" "far/ab.txt" "qar/ac.txt")
 (test "fo*/a*.t*" "foo/aa.txt" "foo/aa.tmp")
 (test "*/*b.*" "far/ab.txt" "far/ab.tmp")
@@ -240,6 +243,11 @@ run_sbcl <<EOF
 (test "*/x" "foo/x/" "far/x/")
 (test "far/*/x" "far/y/x/" "far/x/x/")
 (test "**/x/" "foo/x/" "far/x/" "far/x/x" "far/y/x/")
+(test "foo:*.txt" "foo/aa.txt")
+(test "foo:far;*.txt" "far/ab.txt")
+(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")
 (quit :unix-status $EXIT_LISP_WIN)
 EOF
 check_status_maybe_lose "DIRECTORY/PATTERNS" $?