Hi
suppose I have a logical pathname translation "MYLP" and I am on a
UNIX host.
What should the following return?
(merge-pathnames "foo/bar" "MYLP:")
According to an interpretation of the following passage, I would
surmise that it should signal an error.
"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."
OTOH,
(merge-pathnames "foo;bar" "MYLP:")
should return
#<LP "MYLP:foo;bar">
(or something similar)
At the same time, the following should mess up portability, since
different CL implementations have a different :host for pathnames
returned by PARSE-NAMETRING.
(merge-pathnames (pathname "foo/bar") "MYLP:")
In CMUCL this returns #p"foo/bar", but this is because the host
supplied by PARSE-NAMESTRING is #<UNIX-HOST xxxx>
Any interpretation on the matter?
Cheers
--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
715 Broadway 10th Floor fax +1 - 212 - 995 4122
New York, NY 10003, USA http://bioinformatics.cat.nyu.edu
"Hello New York! We'll do what we can!"
Bill Murray in `Ghostbusters'.
Marco Antoniotti <·······@cs.nyu.edu> writes:
> suppose I have a logical pathname translation "MYLP" and I am on a
> UNIX host.
>
> What should the following return?
>
> (merge-pathnames "foo/bar" "MYLP:")
>
> According to an interpretation of the following passage, I would
> surmise that it should signal an error.
Yeah, "/" is a bad letter to use in a logical namestring, so I guess so.
(Though mostly I think it's poor form to merge strings using MERGE-PATHNAMES
since that's a parsing problem, not a merging problem.)
> "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."
>
> OTOH,
>
> (merge-pathnames "foo;bar" "MYLP:")
>
> should return
>
> #<LP "MYLP:foo;bar">
>
> (or something similar)
>
> At the same time, the following should mess up portability, since
> different CL implementations have a different :host for pathnames
> returned by PARSE-NAMETRING.
>
>
> (merge-pathnames (pathname "foo/bar") "MYLP:")
>
> In CMUCL this returns #p"foo/bar", but this is because the host
> supplied by PARSE-NAMESTRING is #<UNIX-HOST xxxx>
Right, and that's correct behavior ... for better or worse. That is,
it's conforming behavior. It's all part of the big "pathname host fiasco"
I'm always complaining about.
> Any interpretation on the matter?
For what you're trying to do, I'd find it way clearer to write:
(defun parse-logical-host (name)
(pathname-host (parse-namestring (format nil "~A:" name))))
(parse-namestring "foo/bar" (parse-logical-host "MYLP"))