Re: The Logical Pathname (Song)
Martin Simmons <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Yes, the spec allows host nil to be treated as a default host when
constructing a pathname.
If you are merging a physical pathname with a logical pathname (in either
direction) then you are in even more danagerous waters than just using
physical pathnames.
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
>>>>> On Sat, 14 Mar 2026 16:26:03 +0100, Marco Antoniotti (as marco dot antoniotti at unimib dot it) said:
>
> Hi
>
> that's (somewhat) logical.
>
> However...
>
> In SBCL
>
> CL-USER> (merge-pathnames (make-pathname :directory '(:relative) :defaults
> "ASD.F") "LP:FOO;BAR;")
> #P"/foo/bar/ASD.F"
>
> CL-USER> (describe *)
> #P"/foo/bar/ASD.F"
> [pathname]
>
> HOST = #<SB-IMPL::UNIX-HOST {1200039983}>
> DEVICE = :UNSPECIFIC
> DIRECTORY = (:ABSOLUTE "foo" "bar")
> NAME = "ASD"
> TYPE = "F"
> VERSION = :NEWEST
> ; No value
> CL-USER>
>
> ... while in LW
>
> CL-USER 98 > (merge-pathnames (make-pathname :directory '(:relative)
> :defaults "ASD.F") "LP:FOO;BAR;")
> #P"LP:FOO;BAR;ASD.F.NEWEST"
>
> CL-USER 99 > (describe *)
>
> #P"LP:FOO;BAR;ASD.F.NEWEST" is a LOGICAL-PATHNAME
> HOST "LP"
> DEVICE :UNSPECIFIC
> DIRECTORY (:ABSOLUTE "FOO" "BAR")
> NAME "ASD"
> TYPE "F"
> VERSION :NEWEST
>
> ... because in SBCL the host slot is not NIL after parsing the pathname.
> Therefore merging works differently.
>
> Other CLs are somewhat consistent with themselves.
>
> MA
>
>
>
> On Fri, Mar 13, 2026 at 10:40 PM Rainer Joswig (as joswig at lisp dot de) <
> [email protected]> wrote:
>
> > Okay, we need to infer that this is about the pathname argument. Which
> > kind of makes sense.
> >
> >
> > a) the namestring "ASD.F" will be parsed as a logical pathname inside
> > MERGE-PATHNAMES
> >
> > CL-USER 18 > (merge-pathnames "ASD.F" "LP:FOO;QWE;")
> > #P"LP:ASD.F.NEWEST"
> >
> >
> >
> > b) the namestring "ASD.F" will be parsed as a PATHNAME (unless
> > *default-pathname-defaults* is a LOGICAL-PATHNAME).
> >
> > CL-USER 19 > (merge-pathnames (parse-namestring "ASD.F") "LP:FOO;QWE;")
> > #P"LP:FOO;QWE;ASD.F.NEWEST"
> >
> >
> > Also:
> >
> >
> > CL-USER 28 > (let ((*default-pathname-defaults* #p""))
> > (pathname "ASD.F"))
> > #P"ASD.F"
> >
> > CL-USER 29 > (let ((*default-pathname-defaults* "LP:FOO;QWE;"))
> > (pathname "ASD.F"))
> > #P"LP:ASD.F"
> >
> >
> >
> > Given that, I'd think SBCL and LispWorks have the correct result.
> >
> > Regards,
> >
> > Rainer
> >
> >
> > > Am 13.03.2026 um 22:15 schrieb Martin Simmons <[email protected]>:
> > >
> > > Because the spec for merge-pathnames says it is in this case:
> > >
> > > "merge-pathnames recognizes a logical pathname namestring when
> > > default-pathname is a logical pathname, or when the namestring begins
> > with the
> > > name of a defined logical host followed by a colon. In the first of
> > these two
> > > cases, the host portion of the logical pathname namestring and its
> > following
> > > colon are optional."
> > >
> > > --
> > > Martin Simmons
> > > LispWorks Ltd
> > > http://www.lispworks.com/
> > >
> > >
> > >
> > >>>>>> On Fri, 13 Mar 2026 21:52:15 +0100, Rainer Joswig (as joswig at
> > lisp dot de) said:
> > >>
> > >> why would "ASD.F" be parsed as a logical pathname?
> > >>
> > >>> Am 13.03.2026 um 21:49 schrieb Martin Simmons <[email protected]>:
> > >>>
> > >>> Because merge-pathnames merges the directory components rather than
> > just
> > >>> copying them.
> > >>>
> > >>> The directory of "ASD.F" is (:absolute) so this overrides any
> > directory in
> > >>> default-pathname.
> > >>>
> > >>> The reason that the directory of "ASD.F" has to be (:absolute) is
> > because that
> > >>> is the only way to represent a logical pathname namestring at the top
> > level of
> > >>> the hierarchy.
> > >>>
> > >>> --
> > >>> Martin Simmons
> > >>> LispWorks Ltd
> > >>> http://www.lispworks.com/
> > >>>
> > >>>
> > >>>
> > >>>>>>>> On Fri, 13 Mar 2026 21:35:09 +0100, Rainer Joswig (as joswig at
> > lisp dot de) said:
> > >>>>
> > >>>> If it constructs a logical pathname using the host from the
> > default-pathname, why would the directory from the default-pathname not be
> > copied, too?
> > >>>>
> > >>>>> Am 13.03.2026 um 19:35 schrieb Martin Simmons <[email protected]
> > >:
> > >>>>>
> > >>>>> It looks correct to me. What are other CL's doing differently?
> > >>>>>
> > >>>>> --
> > >>>>> Martin Simmons
> > >>>>> LispWorks Ltd
> > >>>>> http://www.lispworks.com/
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>>>>>> On Wed, 11 Mar 2026 19:54:07 +0100, Marco Antoniotti (as marco
> > dot antoniotti at unimib dot it) said:
> > >>>>>>
> > >>>>>> Hi
> > >>>>>>
> > >>>>>> I have the following
> > >>>>>>
> > >>>>>> CL-USER 225 >
> > >>>>>> (setf (logical-pathname-translations "LP")
> > >>>>>> '(("**;*.*.*" "~/Projects/Foo/Bar/**/")))
> > >>>>>> (("**;*.*.*" "~/Projects/Foo/Bar/**/"))
> > >>>>>>
> > >>>>>> Then
> > >>>>>>
> > >>>>>> CL-USER 256 > (merge-pathnames "ASD.F" "LP:FOO;QWE;")
> > >>>>>> #P"LP:ASD.F.NEWEST"
> > >>>>>>
> > >>>>>> Which is ... different from what other CL's do.
> > >>>>>>
> > >>>>>> Any hermeneutics about this in LW?
> > >>>>>>
> > >>>>>> Cheers
> > >>>>>> MA
> > >>>>>>
> > >>>>>>
> > >>>>>> --
> > >>>>>> Marco Antoniotti, Professor, Director tel. +39 - 02 64 48
> > 79 01
> > >>>>>> DISCo, University of Milan-Bicocca U14 2043
> > http://dcb.disco.unimib.it
> > >>>>>> Viale Sarca 336
> > >>>>>> I-20126 Milan (MI) ITALY
> > >>>>>>
> > >>>>>> REGAINS: https://regains.disco.unimib.it/
> > >>>>>>
> > >>>>>
> > >>>>> _______________________________________________
> > >>>>> Lisp Hug - the mailing list for LispWorks users
> > >>>>> [email protected]
> > >>>>> http://www.lispworks.com/support/lisp-hug.html
> > >>>>
> > >>>>
> > >>>> _______________________________________________
> > >>>> Lisp Hug - the mailing list for LispWorks users
> > >>>> [email protected]
> > >>>> http://www.lispworks.com/support/lisp-hug.html
> > >>>>
> > >>>
> > >>> _______________________________________________
> > >>> Lisp Hug - the mailing list for LispWorks users
> > >>> [email protected]
> > >>> http://www.lispworks.com/support/lisp-hug.html
> > >>
> > >>
> > >> _______________________________________________
> > >> Lisp Hug - the mailing list for LispWorks users
> > >> [email protected]
> > >> http://www.lispworks.com/support/lisp-hug.html
> > >>
> > >
> > > _______________________________________________
> > > Lisp Hug - the mailing list for LispWorks users
> > > [email protected]
> > > http://www.lispworks.com/support/lisp-hug.html
> >
> >
> > _______________________________________________
> > Lisp Hug - the mailing list for LispWorks users
> > [email protected]
> > http://www.lispworks.com/support/lisp-hug.html
> >
>
>
> --
> Marco Antoniotti, Professor, Director tel. +39 - 02 64 48 79 01
> DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it
> Viale Sarca 336
> I-20126 Milan (MI) ITALY
>
> REGAINS: https://regains.disco.unimib.it/
>
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html