From: Marc Mertens
Subject: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <4116169a$0$294$ba620e4c@news.skynet.be>
Hello,

    I was reading the hyperspec (chapter 19.2) about pathnames and have
difficulties understanding some of the terms used in the text (I have also
read the Pathnames Quick-Start & Quick-Reference guide). More specifically
I don't fully understand the following:

- When they are talking about conversion is this for make-pathname between
its arguments and its internal representation or will the created pathname
keeps the :case settings and will the conversion be done on the moment the
interaction takes place with the filesystem.
- When :common is explained they refer to the 'customary' case of the file
system, what do they exactly mean with that?
- I have the following characterizations of a file system in my mind
        - Support for a case (only lowercase,only upper case or both)
        - Preserving of a case if both cases are supported.
        - Case used for test on equality, sorting or displaying (I suspect this is
'customary', but I'm not sure.
  When :local is discussed, the hyperspec says that the conversion is done
to the supported case, I can understand this for make-pathname but what is
happening for pathname-name, take for example a filesystem that supports
only lower case and let use then (setf a (make-pathname :case :local :name
"ABC")), what should (pathname-name a) give "abc" or "ABC" (see my
confusion about what conversion really means).


Thanks in advance for any clarifications or help.

Marc Mertens

From: Kalle Olavi Niemitalo
Subject: Re: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <87r7qhpvir.fsf@Astalo.kon.iki.fi>
Marc Mertens <············@skynet.be> writes:

> - When :common is explained they refer to the 'customary' case of the file
> system, what do they exactly mean with that?

The case in which users normally store files in the file system.
On Unix, for example, it is customary to name a file "/etc/passwd"
rather than "/ETC/PASSWD", so "PASSWD" :case :common means the
same as "passwd" :case :local.

> - When they are talking about conversion is this for make-pathname between
> its arguments and its internal representation or will the created pathname
> keeps the :case settings and will the conversion be done on the moment the
> interaction takes place with the filesystem.

I thought I knew the answer to this, but now I'm not sure.

It is possible to ask for a case conversion without touching any
files:

  (pathname-name (make-pathname :name "FOO" :case :common
                                :defaults defaults)
                 :case :local)

This should return the name FOO in the customary case of the
file system.  But does the choice of "file system" depend on
(pathname-host defaults) per section 19.2.1.1, and perhaps even
on (pathname-device defaults)?

  (pathname-name (make-pathname :name "FOO" :case :common
                                :defaults (make-pathname :host "HOST"
                                                         :case :common))
                 :case :local)  ; Form 1

  (pathname-name (make-pathname :host "HOST" :case :common
                                :defaults (make-pathname :name "FOO"
                                                         :case :common))
                 :case :local)  ; Form 2

  (pathname-name (make-pathname :host "HOST" :case :common
                                :defaults (make-pathname :name "FOO"
                                                         :case :local))
                 :case :local)  ; Form 3

Suppose the customary case at the default host is lower, and the
customary case at host HOST is upper.  In implementation A,
MAKE-PATHNAME always converts everything to local case.  In
implementation B, MAKE-PATHNAME converts everything to common
case.  In implementation C, MAKE-PATHNAME saves the strings and
:case information as is.  The results would then be:

		1	2	3
	A	"FOO"	"foo"	"FOO"
	B	"FOO"	"FOO"	"foo"
	C	"FOO"	"FOO"	"FOO"

Which implementations are correct?
From: Marco Antoniotti
Subject: Re: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <JjMRc.2$D5.2667@typhoon.nyu.edu>
Kalle Olavi Niemitalo wrote:

> Marc Mertens <············@skynet.be> writes:
> 
> 
>>- When :common is explained they refer to the 'customary' case of the file
>>system, what do they exactly mean with that?
> 
> 
> The case in which users normally store files in the file system.
> On Unix, for example, it is customary to name a file "/etc/passwd"
> rather than "/ETC/PASSWD", so "PASSWD" :case :common means the
> same as "passwd" :case :local.
> 

With the added problem that I think that the "customary case" in - quote 
- UNIX - unquote - is to randomize the case of the characters.  :)

>>- When they are talking about conversion is this for make-pathname between
>>its arguments and its internal representation or will the created pathname
>>keeps the :case settings and will the conversion be done on the moment the
>>interaction takes place with the filesystem.
> 
> 
> I thought I knew the answer to this, but now I'm not sure.
> 
> It is possible to ask for a case conversion without touching any
> files:
> 
>   (pathname-name (make-pathname :name "FOO" :case :common
>                                 :defaults defaults)
>                  :case :local)
> 
> This should return the name FOO in the customary case of the
> file system.  But does the choice of "file system" depend on
> (pathname-host defaults) per section 19.2.1.1, and perhaps even
> on (pathname-device defaults)?
> 
>   (pathname-name (make-pathname :name "FOO" :case :common
>                                 :defaults (make-pathname :host "HOST"
>                                                          :case :common))
>                  :case :local)  ; Form 1
> 
>   (pathname-name (make-pathname :host "HOST" :case :common
>                                 :defaults (make-pathname :name "FOO"
>                                                          :case :common))
>                  :case :local)  ; Form 2
> 
>   (pathname-name (make-pathname :host "HOST" :case :common
>                                 :defaults (make-pathname :name "FOO"
>                                                          :case :local))
>                  :case :local)  ; Form 3
> 
> Suppose the customary case at the default host is lower, and the
> customary case at host HOST is upper.  In implementation A,
> MAKE-PATHNAME always converts everything to local case.  In
> implementation B, MAKE-PATHNAME converts everything to common
> case.  In implementation C, MAKE-PATHNAME saves the strings and
> :case information as is.  The results would then be:
> 
> 		1	2	3
> 	A	"FOO"	"foo"	"FOO"
> 	B	"FOO"	"FOO"	"foo"
> 	C	"FOO"	"FOO"	"FOO"
> 
> Which implementations are correct?

All of them and none of them, as long as we do not sit down and decide 
which is the correct one under UNIX (and Windows, and MVS, and VMS, and 
and, maybe, MacOS etc etc)

This is just one of the problems with the pathname specification in the 
ANSI docs.

Cheers
--
Marco
From: Peter Seibel
Subject: Re: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <m3k6w8uw2c.fsf@javamonkey.com>
Marco Antoniotti <·······@cs.nyu.edu> writes:

> Kalle Olavi Niemitalo wrote:
>
>> Marc Mertens <············@skynet.be> writes:
>>
>>>- When :common is explained they refer to the 'customary' case of the file
>>>system, what do they exactly mean with that?
>> The case in which users normally store files in the file system.
>> On Unix, for example, it is customary to name a file "/etc/passwd"
>> rather than "/ETC/PASSWD", so "PASSWD" :case :common means the
>> same as "passwd" :case :local.
>>
>
> With the added problem that I think that the "customary case" in -
> quote - UNIX - unquote - is to randomize the case of the characters.
> :)

So at least one current Common Lisp implementation (Allegro 6.2)
considers Unix to have *no* customary case. That is the :case argument
to pathname functions is ignored and

  (namestring (make-pathname :directory '(:absolute "ETC") :name "PASSWD" :case :common))
  ==> "/ETC/PASSWD"

But sever other Common Lisps do consider lowercase to be the common
case and return "/etc/passwd" for the above expression.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Christophe Rhodes
Subject: Re: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <sqhdrc8bh7.fsf@cam.ac.uk>
Peter Seibel <·····@javamonkey.com> writes:

> So at least one current Common Lisp implementation (Allegro 6.2)
> considers Unix to have *no* customary case. That is the :case argument
> to pathname functions is ignored and

FWIW, I have a lot of sympathy with this view... as with many aspects
of Unix filesystem semantics, the Common Lisp pathname system really
doesn't map well in terms of case conversion (the most obvious other
example being the notion of pathname-type).

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)
From: Kevin Layer
Subject: Re: Maining of the :case keyword in make-pathname and pathname-name
Date: 
Message-ID: <mku0uzynns.fsf@*n*o*s*p*a*m*franz.com>
Peter Seibel <·····@javamonkey.com> writes:

> So at least one current Common Lisp implementation (Allegro 6.2)
> considers Unix to have *no* customary case. That is the :case argument
> to pathname functions is ignored and
> 
>   (namestring (make-pathname :directory '(:absolute "ETC") :name "PASSWD" :case :common))
>   ==> "/ETC/PASSWD"

Even though I've complained that this feature is just broken and
useless, I implemented it (some time ago) for Allegro CL 7.0 (due out
in a couple of months):

cl-user(43): (namestring (make-pathname :directory '(:absolute "ETC") :name "PASSWD" :case :common))
"/etc/passwd"
cl-user(44): 

> But sever other Common Lisps do consider lowercase to be the common
> case and return "/etc/passwd" for the above expression.

Kevin