On Sat, 25 Dec 2004, Pascal J.Bourguignon wrote:
> SBCL is inconsistent. MAKE-PATHNAME ignores :VERSION
MAKE-PATHNAME does not ignore :VERSION. More liberal use of INSPECT on
structures returned by MAKE-PATHNAME may be of help.
> but
> TRANSLATE-PATHNAME insists on a match in the presence of the component
> between TO and FROM paths:
>
> #<PACKAGE "COMMON-LISP-USER">
> * (directory "packages:net;telnet;cliki;*")
>
> debugger invoked on a SIMPLE-ERROR in thread 5028: Pathname components from SOURCE and FROM args to TRANSLATE-PATHNAME
> did not match:
> :NEWEST NIL
This may or may not be desireable, but I'm not sure it's obvious that the
translations that you have chosen must necessarily work.
The first thing that you might be missing is that physical pathname
namestring parsing is completely implementation-defined. There is no
requirement that parsing a physical namestring either corresponds to
shell-glob-style parsing or to logical namestring parsing.
Given this, it is /much/ easier to make logical pathname translations work
by not relying on the physical namestring parser to guess what meaning you
intend, but instead to be explicit. That is, I would write your first
translation as
`("**;*"
,(make-pathname
:directory '(:absolute "usr" "local" "share" "lisp" "packages")
:name :wild))
except that even this is poorly-defined, since the default version for a
versionless logical pathname namestring is undefined. I would suggest
that instead of your three translations below, you write just the single
translation
`("**;*.*.*"
,(make-pathname
:directory '(:absolute "usr" "local" "share" "lisp" "packages")
:name :wild :type :wild :version :wild))
which is conforming, and I believe specified to do the right thing in all
cases.
> 0] (dolist (i (logical-pathname-translations "PACKAGES")) (print i))
>
> ("**;*" #P"/usr/local/share/lisp/packages/**/*")
> ("**;*.*" #P"/usr/local/share/lisp/packages/**/*.*")
> ("**;*.*.*" #P"/usr/local/share/lisp/packages/**/*.*")
> NIL
> 0] (make-pathname :name :wild :type :wild :version :wild)
>
> #P"*.*"
Do not be fooled by how physical pathnames print.
Cheers,
Christophe
|