[asdf-devel] Bug in directory-files

Pascal Costanza pc at p-cos.net
Tue Nov 1 20:24:12 UTC 2011


Hi,

There is a problem in the function directory-files (at least for LispWorks). Currently it is defined like this:

(defun* directory-files (directory &optional (pattern *wild-file*))
  (when (wild-pathname-p directory)
    (error "Invalid wild in ~S" directory))
  (unless (member (pathname-directory pattern) '(() (:relative)) :test 'equal)
    (error "Invalid file pattern ~S" pattern))
  (let ((entries (ignore-errors (directory* (merge-pathnames* pattern directory)))))
    (filter-logical-directory-results
     directory entries
     #'(lambda (f)
         (make-pathname :defaults directory :version (pathname-version f)
                        :name (pathname-name f) :type (pathname-type f))))))

However, passing (pathname-version f) unchanged makes make-pathname throw errors in most cases in LispWorks. It should rather say something like that:

(defun* directory-files (directory &optional (pattern *wild-file*))
  (when (wild-pathname-p directory)
    (error "Invalid wild in ~S" directory))
  (unless (member (pathname-directory pattern) '(() (:relative)) :test 'equal)
    (error "Invalid file pattern ~S" pattern))
  (let ((entries (ignore-errors (directory* (merge-pathnames* pattern directory)))))
    (filter-logical-directory-results
     directory entries
     #'(lambda (f)
         (make-pathname :defaults directory :version (unless (eq (pathname-version f) :unspecific)
                                                       (pathname-version f))
                        :name (pathname-name f) :type (pathname-type f))))))

…or something similar.

There is also a redundant 'u in the 'and form in filter-logical-directory-results.


Best,
Pascal

--
Pascal Costanza







More information about the asdf-devel mailing list