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
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.
thanks, r
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
Dear Pascal,
On Tue, Nov 1, 2011 at 16:24, Pascal Costanza pc@p-cos.net wrote:
Hi,
There is a problem in the function directory-files (at least for LispWorks). Currently it is defined like this [...]
Thanks a lot for reporting that issue. Please try ASDF 2.018.2 which includes your suggested fix, and tell us if that solves your problem.
Also, if you can isolate an simplified example that triggers the bug, we could add it to our test suite to avoid future regressions.
There is also a redundant 'u in the 'and form in filter-logical-directory-results.
I beg to differ. The first u avoids a relatively expensive ignore-errors that is sure to fail when it's NIL, and the last u is the result we want to return.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Living on Earth may be expensive, but it includes an annual free trip around the Sun.