Subject: [clisp-list] Bug? in make-pathname

From: Christophe Rhodes <[email-masked]>
Date: Mon, 9 Jul 2001 13:25:37 +0100

I'm afraid I have a slightly clobbered CVS version of clisp; could you
check whether the following occurs for you:

[1]> *ansi*
T
[2]> (setf (logical-pathname-translations "MY-HOST") 
           (list '(";**;*.*.*" "/tmp/**/*.*")))
[...]
[3]> (pathname-directory "**/.cl")
(:RELATIVE :WILD-INFERIORS)
[4]> (make-pathname :defaults "**/.cl" :host "MY-HOST")
#S(LOGICAL-PATHNAME :HOST "MY-HOST" :DEVICE NIL
   :DIRECTORY (:ABSOLUTE :WILD-INFERIORS) :NAME NIL :TYPE "CL" :VERSION NIL)

Should the directory component of the result of the make-pathname call
there not be (:RELATIVE :WILD-INFERIORS)?

Thanks,

Christophe
-- 
Jesus College, Cambridge, CB5 8BL                           +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/                  (defun pling-dollar 
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)

---

From: Sam Steingold <[email-masked]>
Date: 09 Jul 2001 11:01:03 -0400

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Bug? in make-pathname"
> * Sent on Mon, 9 Jul 2001 13:25:37 +0100
> * Honorable Christophe Rhodes <[email-masked]> writes:
>

this behavior is correct.
_physical_ pathname "**/foo" is _relative_
_physical_ pathname "/**/foo" is _absolute_
_logical_ pathname "**;foo" is _absolute_
_logical_ pathname ";**;foo" is _relative_

see CLHS.  this is idiotic (IMHO), but this is the standard.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
I'd give my right arm to be ambidextrous.

---

From: Christophe Rhodes <[email-masked]>
Date: Mon, 9 Jul 2001 16:28:48 +0100

> this behavior is correct.

I don't think so; see my slightly more detailed reasoning below.

> _logical_ pathname ";**;foo" is _relative_

I'm aware of this, but I think it has little bearing on the issue.

#p"**/foo" is equivalent to (modulo *read-eval* and friends)
#.(make-pathname :directory '(:relative :wild-inferiors) :name "foo")

So, (make-pathname :defaults "**/foo" :host "MY-HOST") should fill in
missing components (i.e. those not directly specified in the call)
from the value of the :defaults keyword argument, which has a
:directory component of (:relative :wild-inferiors). It is this that
should be copied over to the newly-created pathname, not a
quasi-physical namestring representation.

So in other words I think the logic in
(make-pathname :defaults #p"**/foo" :host "MY-HOST") should go:

1. Find all the explicitly-named components, and make a new pathname
structure with those values. Here, this would be a pathname structure
with host "MY-HOST" and everything else some magical uninitialized
value.

2. For each of the slots containing magical uninitialized values, copy
across the value of the corresponding slot from the :defaults
argument. In this case, this would add a :directory of (:relative
:wild-inferiors), a :name of "foo" and the other uninitialized
components would come from the values of *default-pathname-defaults*
that prevailed when that (make-pathname ...) form was read (since #p
effectively calls parse-namestring).

I hope that this is clear (at least as clear as the HS on
make-pathname and merge-pathnames, which I think we can agree aren't
terribly...). But basically I think that the :directory component
shouldn't be changed by being copied from a physical to a logical
pathname.

(Note that at least cmucl/sbcl and OpenMCL disagree with your
interpretation and seem to follow my reasoning; I accept that this in
itself isn't evidence, but it at least indicates that it's deeper than
it might at first seem).

Cheers,

Christophe

---

From: Sam Steingold <[email-masked]>
Date: 11 Jul 2001 14:05:27 -0400

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] Bug? in make-pathname"
> * Sent on Mon, 9 Jul 2001 16:28:48 +0100

okay, I think I fixed this.
what a mess!

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
A professor is someone who talks in someone else's sleep.