|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-22 03:24:35 |
% cmucl -noinit
CMU Common Lisp 19c (19C), running on thalassa
With core:
/local/languages/cmucl-19c/lib/cmucl/lib/lisp.core
Dumped on: Thu, 2005-11-17 15:12:58+01:00 on lorien
See <http://www.cons.org/cm
ucl/> for support information.
Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (setf (logical-pathname-translations
"PACKAGES") nil)
NIL
* (setf (logical-pathname-translations
"PACKAGES")
(list
(LIST
(make-pathname
:host "PACKAGES"
:directory '(:absolute
"COM"
"INFORMATIMAGO" #-cmu #|Un gros
bug!|#"COMMON-LISP"
:wild-inferiors)
:name :wild :type :wild :version :wild)
(make-pathname
:directory (append
(let ((d (pathname-directory
*DEFAULT-PATHNAME-DEFAULTS*)))
(or d '(:relative)))
'(:wild-inferiors))
:name :wild :type :wild :version :wild))))
((#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*.~*~"))
* (defun print-pathname (p)
(format t "~&~{~{~ (~9A~) :
~S~&~}~}"
(mapcar (lambda (name field) (list name (funcall
field p)))
'(host device directory name type
version)
'(pathname-host pathname-device
pathname-directory
pathname-name pathname-type
pathname-version)))
p)
PRINT-PATHNAME
* (print-pathname (second (first
(logical-pathname-translations "PACKAGES"))))
Host : ""
Device : NIL
Directory : (:RELATIVE :WILD-INFERIORS)
Name : :WILD
Type : :WILD
Version : :WILD
#P"**/*.*.~*~"
* (translate-logical-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
#P"/common-lisp/utility.lisp"
* (print-pathname *)
Host : ""
Device : :UNSPECIFIC
Directory : (:ABSOLUTE "common-lisp")
Name : "utility"
Type : "lisp"
Version : NIL
#P"/common-lisp/utility.lisp"
* (DEFUN PRINT-BUG-REPORT-INFO ()
"Prints information for a bug report."
(FORMAT T "~2%~{~28A ~S~%~}~2%"
(LIST "LISP-IMPLEMENTATION-TYPE"
(LISP-IMPLEMENTATION-TYPE)
"LISP-IMPLEMENTATION-VERSION"
(LISP-IMPLEMENTATION-VERSION)
"SOFTWARE-TYPE"
(SOFTWARE-TYPE)
"SOFTWARE-VERSION"
(SOFTWARE-VERSION)
"MACHINE-INSTANCE"
(MACHINE-INSTANCE)
"MACHINE-TYPE"
(MACHINE-TYPE)
"MACHINE-VERSION"
(MACHINE-VERSION)
"*FEATURES*"
*FEATURES*))
(VALUES))
PRINT-BUG-REPORT-INFO
* (PRINT-BUG-REPORT-INFO)
LISP-IMPLEMENTATION-TYPE "CMU Common Lisp"
LISP-IMPLEMENTATION-VERSION "19c (19C)"
SOFTWARE-TYPE "Linux"
SOFTWARE-VERSION "Linux version 2.6.15-c3
(root thalassa) (gcc version 3.3 20030226 (prerelease)
(SuSE Linux)) #3 Mon Apr 10 20:56:51 CEST 2006"
MACHINE-INSTANCE "thalassa"
MACHINE-TYPE "X86"
MACHINE-VERSION "X86"
*FEATURES* (:GERDS-PCL :PCL-STRUCTURES
:PORTABLE-COMMONLOOPS
:PCL :CMU19 :CMU19C :PYTHON
:CONSERVATIVE-FLOAT-TYPE
:MODULAR-ARITH :MP :X86
:LINKAGE-TABLE
:RELATIVE-PACKAGE-NAMES :LINUX
:GLIBC2 :UNIX :RANDOM-MT19937
:GENCGC :PENTIUM
:I486 :HASH-NEW
:HEAP-OVERFLOW-CHECK
:STACK-CHECKING :COMMON
:COMMON-LISP :ANSI-CL
:IEEE-FLOATING-POINT :CMU)
*
--
__Pascal Bourguignon__ http://www.informatimag
o.com/
Nobody can fix the economy. Nobody can be trusted with
their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-22 14:14:31 |
>>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
Pascal> % cmucl -noinit
Pascal> CMU Common Lisp 19c (19C), running on
thalassa
Pascal> With core:
/local/languages/cmucl-19c/lib/cmucl/lib/lisp.core
Pascal> Dumped on: Thu, 2005-11-17 15:12:58+01:00 on
lorien
Pascal> See <http://www.cons.org/cm
ucl/> for support information.
Pascal> Loaded subsystems:
Pascal> Python 1.1, target Intel x86
Pascal> CLOS based on Gerd's PCL 2004/04/14
03:32:47
Pascal> * (setf (logical-pathname-translations
"PACKAGES") nil)
Pascal> NIL
Pascal> * (setf (logical-pathname-translations
"PACKAGES")
Pascal> (list
Pascal> (LIST
Pascal> (make-pathname
Pascal> :host "PACKAGES"
Pascal> :directory '(:absolute
Pascal> "COM"
"INFORMATIMAGO" #-cmu #|Un gros
bug!|#"COMMON-LISP"
Pascal> :wild-inferiors)
Pascal> :name :wild :type :wild :version
:wild)
Pascal> (make-pathname
Pascal> :directory (append
Pascal> (let ((d
(pathname-directory *DEFAULT-PATHNAME-DEFAULTS*)))
Pascal> (or d '(:relative)))
Pascal> '(:wild-inferiors))
Pascal> :name :wild :type :wild :version
:wild))))
Pascal>
((#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*.~*~"))
Pascal> * (defun print-pathname (p)
Pascal> (format t "~&~{~{~ (~9A~) :
~S~&~}~}"
Pascal> (mapcar (lambda (name field) (list
name (funcall field p)))
Pascal> '(host device directory
name type version)
Pascal> '(pathname-host
pathname-device pathname-directory
Pascal> pathname-name
pathname-type pathname-version)))
Pascal> p)
[snip]
Pascal> * (translate-logical-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
Pascal> #P"/common-lisp/utility.lisp"
What exactly is the issue here? I don't follow. Where is
the
relative pathname?
Ray
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-22 14:20:07 |
Raymond Toy writes:
> >>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
>
> Pascal> % cmucl -noinit
> Pascal> CMU Common Lisp 19c (19C), running on
thalassa
> Pascal> With core:
/local/languages/cmucl-19c/lib/cmucl/lib/lisp.core
> Pascal> Dumped on: Thu, 2005-11-17
15:12:58+01:00 on lorien
> Pascal> See <http://www.cons.org/cm
ucl/> for support information.
> Pascal> Loaded subsystems:
> Pascal> Python 1.1, target Intel x86
> Pascal> CLOS based on Gerd's PCL 2004/04/14
03:32:47
> Pascal> * (setf (logical-pathname-translations
"PACKAGES") nil)
>
>
> Pascal> NIL
> Pascal> * (setf (logical-pathname-translations
"PACKAGES")
> Pascal> (list
> Pascal> (LIST
> Pascal> (make-pathname
> Pascal> :host "PACKAGES"
> Pascal> :directory '(:absolute
> Pascal> "COM"
"INFORMATIMAGO" #-cmu #|Un gros
bug!|#"COMMON-LISP"
> Pascal> :wild-inferiors)
> Pascal> :name :wild :type :wild
:version :wild)
> Pascal> (make-pathname
> Pascal> :directory (append
> Pascal> (let ((d
(pathname-directory *DEFAULT-PATHNAME-DEFAULTS*)))
> Pascal> (or d
'(:relative)))
> Pascal>
'(:wild-inferiors))
> Pascal> :name :wild :type :wild
:version :wild))))
>
> Pascal>
((#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*.~*~"))
> Pascal> * (defun print-pathname (p)
> Pascal> (format t "~&~{~{~ (~9A~) :
~S~&~}~}"
> Pascal> (mapcar (lambda (name field)
(list name (funcall field p)))
> Pascal> '(host device
directory name type version)
> Pascal> '(pathname-host
pathname-device pathname-directory
> Pascal> pathname-name
pathname-type pathname-version)))
> Pascal> p)
>
> [snip]
>
> Pascal> * (translate-logical-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
>
> Pascal>
#P"/common-lisp/utility.lisp"
>
> What exactly is the issue here? I don't follow.
Where is the
> relative pathname?
Sorry.
The translation for PACKAGES maps an absolute logical
pathname:
(#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
to a relative physical pathname:
#P"**/*.*.~*~")
Unfortunately, when I translate a pathname:
(translate-logical-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
I get an absolute pathname:
#P"/common-lisp/utility.lisp"
I wanted:
#P"common-lisp/utility.lisp"
(I would have been happy too if the relative physical
pathname generated by:
(make-pathname
:directory (append
(let ((d (pathname-directory
*DEFAULT-PATHNAME-DEFAULTS*)))
(or d '(:relative)))
'(:wild-inferiors))
:name :wild :type :wild :version :wild))))
would have been #P"./**/*.*.~*~" to more
clearly mark the _relative_ property
and the translated path:
#P"./common-lisp/utility.lisp",
but the equivalent #P"common-lisp/utility.lisp"
would be enough).
--
__Pascal Bourguignon__ http://www.informatimag
o.com/
I need a new toy.
Tail of black dog keeps good time.
Pounce! Good dog! Good dog!
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-22 14:46:07 |
>>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
Pascal> The translation for PACKAGES maps an absolute
logical pathname:
Pascal>
(#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
Pascal> to a relative physical pathname:
Pascal>
#P"**/*.*.~*~")
Pascal> Unfortunately, when I translate a pathname:
Pascal> (translate-logical-pathname
Pascal>
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
Pascal> I get an absolute pathname:
Pascal> #P"/common-lisp/utility.lisp"
Pascal> I wanted:
Pascal> #P"common-lisp/utility.lisp"
Ah, I see. Hmm. I guess the question is what is
(translate-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;
#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*.~*~")
supposed to return. I'll have to read up on that. The
comments in
the code say that :relative or :absolute is taken from the
source
directory. Don't know if that's right or not.
Pascal> (I would have been happy too if the relative
physical pathname generated by:
Pascal> (make-pathname
Pascal> :directory (append
Pascal> (let ((d
(pathname-directory *DEFAULT-PATHNAME-DEFAULTS*)))
Pascal> (or d '(:relative)))
Pascal> '(:wild-inferiors))
Pascal> :name :wild :type :wild :version
:wild))))
*default-pathname-defaults* is #p"", which is
slightly different from
#p"./". #p"" has a directory slot
of nil, but #p"./" has a directory
slot of '(:relative).
Pascal> would have been #P"./**/*.*.~*~"
to more clearly mark the _relative_ property
But #P"./**/*.*" is the same object as
#p"**/*.*", so it might be
possible to cause the object to be printed as
#p"./**/*.*".
Ray
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-22 17:30:06 |
>>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
Pascal> Unfortunately, when I translate a pathname:
Pascal> (translate-logical-pathname
Pascal>
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
Pascal> I get an absolute pathname:
Pascal> #P"/common-lisp/utility.lisp"
Pascal> I wanted:
Pascal> #P"common-lisp/utility.lisp"
After looking at the clhs entry for translate-pathname, I
think we're
free to do almost anything sensible. So having the
resulting pathname
take relative or absolute from the to-wildname should be ok.
This could break peoples' existing code, however. And the
comments in
the code are clear about what it wants to do, but not why it
is.
Ray
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-23 15:12:27 |
Raymond Toy writes:
> >>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
>
> Pascal> Unfortunately, when I translate a
pathname:
>
> Pascal> (translate-logical-pathname
> Pascal>
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;)
>
> Pascal> I get an absolute pathname:
>
> Pascal>
#P"/common-lisp/utility.lisp"
>
> Pascal> I wanted:
>
> Pascal>
#P"common-lisp/utility.lisp"
>
> After looking at the clhs entry for translate-pathname,
I think we're
> free to do almost anything sensible. So having the
resulting pathname
> take relative or absolute from the to-wildname should
be ok.
>
> This could break peoples' existing code, however. And
the comments in
> the code are clear about what it wants to do, but not
why it is.
Yes, I should use absolute pathnames. Thank you.
--
__Pascal Bourguignon__ http://www.informatimag
o.com/
Un chat errant
se soulage
dans le jardin d'hiver
Shiki
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-23 15:03:57 |
Raymond Toy writes:
> [Pascal complained about the result of
TRANSLATE-PATHNAME]
> Ah, I see. Hmm. I guess the question is what is
>
> (translate-pathname
>
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP&
quot;
> #P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
> #P"**/*.*.~*~")
>
> supposed to return. I'll have to read up on that.
The comments in
> the code say that :relative or :absolute is taken from
the source
> directory. Don't know if that's right or not.
Well, reading TRANSLATE-PATHNAME, I see that my
expectations were too
high, this is mostly implementation dependant.
(all tests on Linux x86):
clisp 2.38:
(translate-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP.4
2"
#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*") ; clisp doesn't take
versions, grrr!
--> #P"common-lisp/utility.lisp"
sbcl 0.9.12:
(translate-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP.4
2"
#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*") ; sbcl doesn't take
versions either, grrr!
--> #P"/common-lisp/utility.lisp"
ecl-9g:
(translate-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP.4
2"
#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*") ; ecl doesn't take
versions, grrr!
--> #P"COMMON-LISP/UTILITY.LISP"
gcl 2.6.7:
Doesn't define translate-pathname :-(
Allegro 7.0:
(translate-pathname
"PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;UTILITY.LISP.4
2"
#P"PACKAGES:COM;INFORMATIMAGO;**;*.*.*"
#P"**/*.*") ; allegro doesn't like
versions either, grrr!
--> #P"COMMON-LISP/UTILITY.LISP"
I feel the most useful result on a unix-like file system, is
that of clisp.
But I should probably avoid relative pathnames in my
translations to
make a more portable program.
--
__Pascal Bourguignon__ http://www.informatimag
o.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink.
|
|
| translate-logical-pathname gives an
ABSOLUTE for a RELATIVE ! |

|
2006-05-23 16:13:39 |
>>>>> "Pascal" == Pascal
Bourguignon <pjb informatimago.com> writes:
Pascal> clisp 2.38:
--> #P"common-lisp/utility.lisp"
Pascal> sbcl 0.9.12:
--> #P"/common-lisp/utility.lisp"
Pascal> ecl-9g:
--> #P"COMMON-LISP/UTILITY.LISP"
Pascal> gcl 2.6.7:
Pascal> Doesn't define translate-pathname :-(
Pascal> Allegro 7.0:
--> #P"COMMON-LISP/UTILITY.LISP"
Well, except for sbcl which probably behaves that way
because cmucl
does, there's precedent in returning a relative pathname
instead of an
absolute pathname.
But, as you say in a different message, using absolute
pathnames in
your translations solves this problem, portably.
Ray
|
|