From: Christophe Rhodes
Subject: Pathname tests
Date: 
Message-ID: <sqlmk9k1t7.fsf@lambda.jesus.cam.ac.uk>
I've written a pathname test suite that I believe respects the ANSI
standard, though parts of it are unix-specific. I hope that
implementors will take the time to have a look at it and perhaps
address some of the errors that it shows up. Of the implementations in
my tests (debian CMUCL 3.0, SBCL 0.6.13, CLISP 2.27, OpenMCL 0.5.1)
CMUCL and SBCL come off best, with only minor version handling
mistakes; CLISP and OpenMCL are much worse off, with plenty of results
that seem to me to be mistakes.

I hope that the tests are of some help to implementors; I appreciate
that it is possible that my reading of the specification is wrong. If
you believe this to be the case, please let me know that I may correct
any wrong information I may have given out.

The code is available at
<URL:http://www-jcsu.jesus.cam.ac.uk/~csr21/pathname-tests.lisp> or in
cCLan CVS; to run, load that file and then call (run-tests). Copious
output will be sent to *trace-output*, should you wish to redirect it.

Best wishes,

Christophe

PS: As a footnote, is it legal to ask for a logical-pathname-translation 
such as
("**;*.*.*" "**;*;*.*.NEWEST") ; version component translated to directory
?

The reason I ask is that it occurred to me that one could fake version
handling by doing
(setf (logical-pathname-translations "FOO")
      (list '("**;*.*.NEWEST" "/**/*.*")
            '("**;*.*.*" "**;*;*.*.NEWEST")));
I couldn't find anything in the hyperspec ruling it out, but none of
the above implementations seemed terribly happy about it.
-- 
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
Subject: Re: Pathname tests
Date: 
Message-ID: <uk7zoar74.fsf@xchange.com>
> * In message <··············@lambda.jesus.cam.ac.uk>
> * On the subject of "Pathname tests"
> * Sent on 24 Aug 2001 14:47:00 +0100
> * Honorable Christophe Rhodes <·····@cam.ac.uk> writes:
>
> I hope that the tests are of some help to implementors;

they would have been of more help if they
 - printed less junk (like "------", blanks, etc)
 - printed the offending form for each error
   (like CLISP/tests and CLOCC/src/tools/ansi-tests)
 - printed statistics (like 3 tests passed, 5 tests failed)

> I appreciate that it is possible that my reading of the specification
> is wrong. If you believe this to be the case, please let me know that
> I may correct any wrong information I may have given out.

I do not see why you expect

(pathname-version
 (merge-pathnames #s(logical-pathname ... :version nil)
                  #s(logical-pathname ... :version 3)))
        ==> :newest
and not
        ==> 3

--
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/>
The only substitute for good manners is fast reflexes.
From: Daniel Barlow
Subject: Re: Pathname tests
Date: 
Message-ID: <87bskz97xf.fsf@noetbook.telent.net>
Sam Steingold <···@gnu.org> writes:

> I do not see why you expect
> 
> (pathname-version
>  (merge-pathnames #s(logical-pathname ... :version nil)
>                   #s(logical-pathname ... :version 3)))
>         ==> :newest
> and not
>         ==> 3

Was the :name component supplied in the first pathname or not?  You've
elided that bit ...
 
   If pathname does not specify a name, then the version, if not
   provided, will come from default-pathname, just like the other
   components. If pathname does specify a name, then the version is
   not affected by default-pathname.  If this process leaves the
   version missing, the default-version [ default :newest ] is used.

(CLHS, "Function MERGE-PATHNAMES", my insertion in [ ] )

Note that default-version is the third argument to merge-pathnames,
not the version of the default-pathname argument


-dan

-- 

  http://ww.telent.net/cliki/ - Link farm for free CL-on-Unix resources 
From: Christophe Rhodes
Subject: Re: Pathname tests
Date: 
Message-ID: <sq1ylvg6sc.fsf@lambda.jesus.cam.ac.uk>
Sam Steingold <···@gnu.org> writes:

> > * Honorable Christophe Rhodes <·····@cam.ac.uk> writes:
> >
> > I hope that the tests are of some help to implementors;
> 
> they would have been of more help if they
>  - printed less junk (like "------", blanks, etc)
>  - printed the offending form for each error
>    (like CLISP/tests and CLOCC/src/tools/ansi-tests)
>  - printed statistics (like 3 tests passed, 5 tests failed)

I take the substantive point, and will try to adapt these tests to
your particular framework.
 
> > I appreciate that it is possible that my reading of the specification
> > is wrong. If you believe this to be the case, please let me know that
> > I may correct any wrong information I may have given out.
> 
> I do not see why you expect
> 
> (pathname-version
>  (merge-pathnames #s(logical-pathname ... :version nil)
>                   #s(logical-pathname ... :version 3)))
>         ==> :newest
> and not
>         ==> 3

Well, the devil's in the "...".

From fun_merge-pathnames.html in your favourite hyperspec mirror,

  [...] If pathname does specify a name, then the version is not
  affected by default-pathname. If this process leaves the version
  missing, the default version is used. [...]

In the above calls, I strongly suspect that there's a name component
in the first argument to merge-pathnames. Thus, the version is not
copied from default-pathname, and the default-version argument (which
has itself defaulted to :newest) is used.

I think, anyway.

Cheers,

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
Subject: Re: Pathname tests
Date: 
Message-ID: <u1yluabiu.fsf@xchange.com>
> * In message <··············@lambda.jesus.cam.ac.uk>
> * On the subject of "Re: Pathname tests"
> * Sent on 28 Aug 2001 23:26:43 +0100
> * Honorable Christophe Rhodes <·····@cam.ac.uk> writes:
>
> I take the substantive point, and will try to adapt these tests to
> your particular framework.

breath is on hold... :-)

> ...
> Well, the devil's in the "...".
> ...

thanks. another question is:

(MAKE-PATHNAME :DEFAULTS #S(LOGICAL-PATHNAME :HOST "CL-LIBRARY" :DEVICE NIL
   :DIRECTORY (:ABSOLUTE "FOO") :NAME "BAR" :TYPE "BAZ" :VERSION 3))
==>
#S(LOGICAL-PATHNAME :HOST "CL-LIBRARY" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO")
   :NAME "BAR" :TYPE "BAZ" :VERSION 3)

you want version to be :NEWEST.  why?

-- 
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/>
War doesn't determine who's right, just who's left.
From: Christophe Rhodes
Subject: Re: Pathname tests
Date: 
Message-ID: <sqn14hn8jn.fsf@athena.jesus.cam.ac.uk>
[ posted and mailed ]

Sam Steingold <···@gnu.org> writes:

> > * Honorable Christophe Rhodes <·····@cam.ac.uk> writes:
> >
> > I take the substantive point, and will try to adapt these tests to
> > your particular framework.
> 
> breath is on hold... :-)

Well, I've been neglecting both my PhD and my music recently, so it
may not happen immediately... :-/
 
> > ...
> > Well, the devil's in the "...".
> > ...
> 
> thanks. another question is:
> 
> (MAKE-PATHNAME :DEFAULTS #S(LOGICAL-PATHNAME :HOST "CL-LIBRARY" :DEVICE NIL
>    :DIRECTORY (:ABSOLUTE "FOO") :NAME "BAR" :TYPE "BAZ" :VERSION 3))
> ==>
> #S(LOGICAL-PATHNAME :HOST "CL-LIBRARY" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO")
>    :NAME "BAR" :TYPE "BAZ" :VERSION 3)
> 
> you want version to be :NEWEST.  why?

Not sure yet.

You couldn't give me the output of my program, could you? I agree that
on the basis of the above, it should be :version 3, but this isn't in
the output of the tests I forwarded to you.

I presume this was in the "MAKE-PATHNAME tests"; what I get (with
2.27) is:

| Testing make-pathname defaults with *default-pathname-defaults* as:
| #S(LOGICAL-PATHNAME :HOST "CL-LIBRARY" :DEVICE NIL :DIRECTORY (:ABSOLUTE "FOO")
|    :NAME "BAR" :TYPE "BAZ" :VERSION 3)
| 
| [ ... ]
| 
| Version handling in defaults wrong.
| 
| The version in the return from
| (make-pathname :defaults *default-pathname-defaults*)
| should be the same as the version in *default-pathname-defaults*
| (here 3), but
| (pathname-version (make-pathname :defaults *default-pathname-defaults*)) => NIL.

Here's the real question to the newsgroup at large:

What should
(let ((*default-pathname-defaults* (logical-pathname "CL-LIBRARY:FOO;BAR.BAZ.3")))
  (pathname-version (make-pathname :version nil)))

return? I can make plausibility cases for three different answers...

Any possible bug isn't actually in the make-pathname call above, which
I agree should return a pathname with a version of 3, but what it's
testing it against, which in these tests is the above (make-pathname
:version nil).

Note that

(let ((*default-pathname-defaults* (logical-pathname "CL-LIBRARY:FOO;BAR.BAZ.3")))
  (make-pathname)) ;; this one should have :version :newest

Is not the same as

(let ((*default-pathname-defaults* (logical-pathname "CL-LIBRARY:FOO;BAR.BAZ.3")))
  ;; this one should have :version 3
  (make-pathname :defaults *default-pathname-defaults*))

That is another potential source of error.

Cheers,

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
Subject: Re: Pathname tests
Date: 
Message-ID: <uitcewspz.fsf@xchange.com>
> * In message <··············@lambda.jesus.cam.ac.uk>
> * On the subject of "Pathname tests"
> * Sent on 24 Aug 2001 14:47:00 +0100
> * Honorable Christophe Rhodes <·····@cam.ac.uk> writes:
>
> The code is available at
> <URL:http://www-jcsu.jesus.cam.ac.uk/~csr21/pathname-tests.lisp> or in
> cCLan CVS; to run, load that file and then call (run-tests). Copious
> output will be sent to *trace-output*, should you wish to redirect it.

Based on these tests:

(pathname-type
 (make-pathname :defaults (make-pathname :directory
                                         '(:relative :wild-inferiors)
                                         :type "foo" :case :common)
                :host "CL-LIBRARY" :case :common))

should this return "FOO" or "foo"?

Kent said that his answer is "FOO", and that is what LW does.  His
argument goes like this: "foo" is turned into "FOO" by :CASE :COMMON in
the first MAKE-PATHNAME, but :CASE :COMMON in the second MAKE-PATHNAME
applies only to _strings_ and not the :DEFAULTS pathname, thus the
second MAKE-PATHNAME has "FOO" as the type [I hope Kent will repeat
here his lucid argument which he posted to <clisp-list>].

CMUCL and ACL return "foo".
Why?  What is the right answer?

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
(let((a'(list'let(list(list'a(list'quote a)))a)))`(let((a(quote ,a))),a))