Ticket #1071 (closed defect: fixed)
#'Directory with no type returns results different from wild type
|Reported by:||svspire||Owned by:||svspire|
|Component:||ANSI CL Compliance||Version:||trunk|
(directory #P"foo/*" :directories nil) [(directory #P"foo:*" :directories nil) in MCL]
MCL: Returns all files under the foo directory, regardless of whether they have a type or not.
CCL: Returns only files that have no type under foo directory.
Test: (= (length (directory #P"ccl:*.*")) (length (directory #P"ccl:*"))) Should return T if this bug is fixed.
Technically, this is probably not an ANSI compliance issue since ANSI is vague on what #'directory is supposed to do. But current behavior is different from MCL, which is presumably where many CCL users come from. It would be interesting to see what ACL does here.
Fix is simple:
--- pathnames.lisp (revision 15751) +++ pathnames.lisp (working copy) @@ -582,6 +582,10 @@
(%path-str*= pstr pattern))
(defun %file*= (name-pat type-pat pstr)
+ (when (and (eq name-pat :wild) + (or (null type-pat) + (eq type-pat :unspecific))) + (setq type-pat :wild))
(if (eq name-pat :wild) (setq name-pat "*")) (if (eq type-pat :wild) (setq type-pat "*")) (when (and (null name-pat) (null type-pat))