[asdf-install-devel] Ugh. CLISP, files, pathnames.

Dan Muller pikdj2002 at sneakemail.com
Sat Dec 29 03:11:11 UTC 2007


Gary King wrote:
>> DELETE-DIRECTORY-AND-FILES and its supporting methods are onerous to
>> get working with CLISP because of its bizarrely strict interpretation
>> of PROBE-FILE and DELETE-FILE, its limited support of :WILD-INFERIORS,
>> and its frequent intolerance of :UNSPECIFIC.
>
> bummer.
>
>> I would have thought that CL-FAD had already dealt with most of
>> this. Did you have problems with it?
>
> No, I didn't have problems. Though there were a few slight design
> issues I didn't like, it worked fine. I removed it because it seemed
> like "just one more thing". If you want to restore it, that would be
> fine. I'm happy to do this too (and hope to have a few hours this
> weekend to look at it and your other patches) so if you'd rather wait,
> that's fine too (just let me know <smile>).


OK, as per a separate reply to Gary (which I guess I didn't send to
the list, my bad), I did work on this for a while tonight. Very
exciting work. Much too exciting. "Portability is hard." I guess I was
overdue for a reminder. :)

So here's a status update. Dropping CL-FAD back in was easy. The
results aren't so good, though, and the reason is
interesting. Symlinks. Bloody symlinks.

The test suites use DELETE-DIRECTORY-AND-FILES (currently defined in
utilities.lisp, but I'm now using the CL-FAD version) to delete their
temporary directory trees, which include both the directory containing
systems, and the directory containing symlinks to system files. Even
on Windows, when I'm testing wth Cygwin's CLISP, I am dealing with
Cygwin's simulated symlinks.

DIRECTORY is specified to return truenames, so it seems that most
Lisps are going to return the symlink targets' pathnames instead of
those of the symlink files themselves. So if
DELETE-DIRECTORY-AND-FILES delets a symlink's target before the
symlink that points to it, then later it encounters a symlink which is
"bad", i.e. it points to a non-existent file. Usually this is fine,
but CLISP, by default, *ignores* bad symlinks. Thus they don't get
deleted, thus the directory containing them can't get deleted because
it's not empty.

Luckily, *this* problem has an easy fix, and I've sent Edi Weitz a
request to add it. I modified my local copy of CL-FAD and kept
testing. (Fix described later, if you're interested.)

If D-D-A-F happens upon the symlink first, then it actually sees the
truename of the target, and deletes *that* instead. Which means you
end up with the same effect: the target is deleted, and the symlink
doesn't get deleted, and the symlink's directory isn't empty and thus
can't be deleted.

Lovely.

Well, I'm sure there's a way around this. It's possible, after all, to
tell if the truename you get from DIRECTORY doesn't refer to something
in the directory you passed it! (That might not lead to a *general*
solution to the problem, because a symlink could point to a target in
the same directory. Although ... then you'd see a duplicate result!
Hmmm.)

Anyway, aside from this problem, there's trouble with the return
values from the CLISP variant of ASDF-INSTALL::SHELL-COMMAND. It
should work more like RETURN-OUTPUT-FROM-PROGRAM, apparently. In fact,
SHELL-COMMAND is used only in two places. One is to unlink a file,
where the program output is ignored. The other is GPG-RESULTS, where
I'm thinking that using RETURN-OUTPUT-FROM-PROGRAM (for all platforms)
would actually make more sense.

Anyway, I'm bouncing back and forth between these two
issues. Hopefully I can spend a bit more time on it later this
weekend.

> thanks for your continuing efforts, this cleanup work is _great_ and
> will let us move into 2008 with the hope for more features!

Indeed, all of this current work is really aimed at getting the unit
tests running cleanly for the variety of Lisps I have handy, so we can
move on to bigger and scarier changes that will really benefit from
having the tests available!

Here's the change to CL-FAD for CLISP that I sent to Edi. In fad.lisp,
look for this:

    #+:clisp (nconc (directory wildcard)
                    (directory (clisp-subdirectories-wildcard wildcard)))

... and make it look like this:

    #+:clisp (nconc (directory wildcard :if-does-not-exist :keep) ; DWM
                    (directory (clisp-subdirectories-wildcard wildcard)))


-- 
Dan Muller



More information about the asdf-install-devel mailing list