Bug in new DIRECTORY-FILES on clisp

Bug #1592180 reported by Robert P. Goldman on 2016-06-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ASDF
Undecided
Faré

Bug Description

On the Mac, 3.1.7.1 fails testing on clisp.

On clisp, test-utilities fails as follows:

check to make sure DIRECTORY-FILES doesn't list subdirectories
TEST ABORTED:
These two expressions yield sequences of unequal length

        The first, DIRECTORY-A, has value (#P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x"
 #P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x") of length 2

        The other, (LIST (SUBPATHNAME *BUILD-DIRECTORY* "deleteme/a/1.x")), has value (#P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x") of length 1

This looks like clearly our bug:

[11]> (uiop:directory-files (uiop:subpathname *build-directory* "deleteme/a/"))
1. Trace: (UIOP/FILESYSTEM:DIRECTORY* '#P"/Users/rpg/lisp/asdf/build/deleteme/a/*.*")
1. Trace: UIOP/FILESYSTEM:DIRECTORY* ==> (#P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x")
1. Trace: (UIOP/FILESYSTEM:DIRECTORY* '#P"/Users/rpg/lisp/asdf/build/deleteme/a/*")
1. Trace: UIOP/FILESYSTEM:DIRECTORY* ==> (#P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x")
(#P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x" #P"/Users/rpg/lisp/asdf/build/deleteme/a/1.x")
[12]> (equalp (first *) (second *))
T

This looks like the offending block (from DIRECTORY-FILES in uiop/filesystem.lisp):

(let* ((pat (merge-pathnames* pattern dir))
      (entries (append (ignore-errors (directory* pat))
                       #+(or clisp gcl)
                       (when (equal :wild (pathname-type pattern))
                         (ignore-errors (directory* (make-pathname :type nil :defaults pat)))))))

I could use a comment here, since there's obviously something special going on for clisp and GCL, but there's no explanation of what this second invocation of DIRECTORY* is for. AFAICT DIRECTORY-FILES is always going to tickle this special case, unless the caller overrides PATTERN, which the documentation tells them not to do...

Changed in asdf:
assignee: nobody → Faré (fahree)
Robert P. Goldman (rpgoldman) wrote :

Quick follow-up: the helper function has the additional comment as follows:

(remove-duplicates ;; on CLISP, querying ~/ will return duplicates

But... that code will not be invoked when running on clisp and looking at ~/ because ~ is not a logical pathname.

So do we need to invoke REMOVE-DUPLICATES on clisp unconditionally?

Faré (fahree) wrote :

OK, this vaguely rings a bell as an issue with *.* not matching files that do not have a . in the name.

My, I hate CL pathnames.

Faré (fahree) wrote :

On the other hand * looks like it does match everything on CLISP, unlike in SBCL.

Robert P. Goldman (rpgoldman) wrote :

I have fixed this and pushed a patch. I'm not proud of it, because it adds complexity to the body of the function, and perhaps I should have just made

#+clisp
#+gcl
#-(or clisp gcl)

instead of what I did.

But it fixes the bug I see. I'll wait for a while to see if anyone comments, otherwise this will be 3.1.7.2

Changed in asdf:
status: New → Fix Committed
Faré (fahree) wrote :

Solution much simplified in 3.1.7.8 by introducing *wild-file-for-directory*

Changed in asdf:
status: Fix Committed → Fix Released
milestone: none → 3.3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers