Changeset 15376


Ignore:
Timestamp:
09/09/20 17:09:45 (2 years ago)
Author:
Mark Evenson
Message:

Fix regression in CL:DIRECTORY for wild pathnames

We re-enable listing sub-directories of directories for wild pathnames
that have NAME and TYPE of :wild. This behavior was inadvertently
disabled with
<https://github.com/armedbear/abcl/commit/889a50534dde062f037b01f4b8e2b6c108561709>.

This regression broke Quicklisp's indexing of local projects directory
which has implementation specific code which depends on

(directory "~/quicklisp/*.*")

returning both immediate sub-directories as well as files under
<file:~/quicklisp/>.

According to
<http://www.lispworks.com/documentation/HyperSpec/Body/f_pn_mat.htm>
CL:PATHNAME-MATCH-P is supposed to be consistent with CL:DIRECTORY, but
this doesn't seem to be the case for SBCL, CCL, LWpro, but *is* true
for ECL.

;;; This should return (t t t …) for every wildcard that one can pass
;;; to DIRECTORY

(let ((wildcard #p"/Users/evenson/quicklisp/local-projects/*.*"))

(mapcar

(lambda (e) (pathname-match-p e wildcard))
(directory wildcard)))

At this time, we choose to be compatible with the previous behavior of
ABCL and the current behavior of SBCL/CCL rather than strict
conformance here.

This should fix <https://github.com/qitab/cl-protobufs/issues/199>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/directory.lisp

    r15369 r15376  
    3333(in-package "SYSTEM")
    3434
    35 (defun pathname-as-file (pathname)
     35;;; utility function for LIST-DIRECTORIES-WITH-WILDCARDS
     36(defun directory-as-file (pathname)
     37  "Convert a PATHNAME referencing a directory to a file"
    3638  (let ((directory (pathname-directory pathname)))
    3739    (make-pathname :host nil
     
    4244                   :version nil)))
    4345
     46;;; utility function for LIST-DIRECTORIES-WITH-WILDCARDS
    4447(defun wild-inferiors-p (component)
    4548  (eq component :wild-inferiors))
     
    143146                      matching-entries)
    144147                  (dolist (entry entries)
    145                     (when (pathname-match-p entry pathname)
     148                    (when
     149                        (or
     150                         (and
     151                          (file-directory-p entry :wild-error-p nil)
     152                          (pathname-match-p
     153                           (directory-as-file entry) pathname))
     154                         (pathname-match-p entry pathname))
    146155                      (push
    147156                       (if resolve-symlinks
Note: See TracChangeset for help on using the changeset viewer.