On 1 Nov 2011, at 23:28, Robert Goldman wrote:
On 11/1/11 Nov 1 -3:24 PM, Pascal Costanza wrote:
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.
Thanks for the bug report. Would you also pass along please an example call that shows this error in LispWorks? It would help us determine whether other implementations have similar issues.
I don't know exactly how to pass along an example, because it involves having a corresponding directory structure. You can construct an example by using a logical pathname for a directory and add it to a configuration. Current ASDF (>= 2.017) won't find .asd files in such directories. (The error is masked by ignore-errors.)
For make-pathname itself, here is an example that triggers the error:
(setf (logical-pathname-translations "test") `(("**;*.*.*" "/**/*.*")))
(make-pathname :defaults #p"test:test;" :version :unspecific :name "test" :type "lisp")
Pascal
-- Pascal Costanza