libera/#ccl - IRC Chatlog
Search
14:46:09
yitzi
CCL appears to preserve case in the parsing of logical pathnames and in translate-logical-pathname. Does anyone know if this is intentional? Seems like this isn't permitted according to CLHS 19.3.1 and CLHS 19.3.1.1.7, unless I just misreading the spec.
16:05:25
pjb
yitzi: it's intentional. But indeed, I don't agree with this choice. on unix (posix even in general), the customary case is lowercase even if normally the unix file systems are case-sensitive.
16:06:22
pjb
CCL comes from MCL that ran on Mac OS where there was no customary case per se (the file systems were case insensitive, case preserving, and file names were kept as the user wrote them, usually mixed case).
16:07:00
pjb
yitzi: but one problem anyway is that CL doesn't expect that different file systems may be mounted one onto the other, so that a given path may have components in different customary case!
16:08:31
pjb
so you could have to translate "MNT:SOME-UNIX-FS;SOME-MACOS-FS;SOME-DOS-FS;SOME-WINDOWS-FS;EXAMPLE.TXT" to "/mnt/some-unix-fs/Some Mac OS FS/SOMEDOSF/Some Windows FS/Example.text"
16:08:59
pjb
the only way this can be achieved properly within the specification, is using an explicit logical pathname translation entry for each pathname!
16:10:25
pjb
yitzi: for the former, I usually do something like: https://github.com/informatimago/patchwork/blob/dialog/loghosts.lisp#L145
16:11:08
pjb
yitzi: for the later: https://github.com/informatimago/patchwork/blob/dialog/loghosts.lisp#L90
16:17:52
yitzi
pjb: It's not breaking anything in my code. It's just suprissing that intentionally not following the spec (at least in parsing) isn't a choice.
17:17:01
pjb
yitzi: the problem is that the CL specification doesn't specify anything about physical pathname, specifies very little about logical pathnames, and cannot specify much at all for translations.
17:18:06
yitzi
Really? CLHS 19.3.1.1.7 says that logical pathname words are upper case but CCL permits mixed case and doesn't upcase them.
18:36:13
pjb
(setf (logical-pathname-translations "MYHOST") '()) (pathname-name #P"MYHOST:fooBar") #| --> "fooBar" |# is not conforming.
18:41:49
pjb
(setf (logical-pathname-translations "MYHOST") '(("**;*" "/tmp/**/*"))) (translate-logical-pathname #P"MYHOST:FOOBAR") #| --> #P"/tmp/FOOBAR" |#
18:42:26
yitzi
I know. I reread and I think it is a little gray in that area. The spec says that it doesn't have to upcase in translate-logical-pathname.
18:43:19
pjb
To get /tmp/foobar in a conforming way, you need to write: (setf (logical-pathname-translations "MYHOST") '(("FOOBAR" "/tmp/foobar") ("**;*" "/tmp/**/*"))) (translate-logical-pathname #P"MYHOST:FOOBAR") #| --> #P"/tmp/foobar" |#
18:44:13
pjb
yitzi: but there's a :case argument that can be :common or :local. The default is :local.
18:47:31
yitzi
SBCL: https://plaster.tymoon.eu/view/2574#2574 and CCL: https://plaster.tymoon.eu/view/2572#
19:03:47
pjb
Since you specified :case :local (by default) and since ccl consider that the local case is uppercase, and since you gave lower case name, I think your call is not conforming, and ccl can do whatever.
19:05:11
pjb
(make-pathname :host "FU" :name "WIBBLE" :type "QUUX" :case :common) #| --> #P"FU:wibble.quux" |#
19:05:11
pjb
(make-pathname :host "FU" :name "WIBBLE" :type "QUUX" :case :local) #| --> #P"FU:WIBBLE.QUUX" |#
19:05:11
pjb
(translate-logical-pathname (make-pathname :host "FU" :name "WIBBLE" :type "QUUX" :case :common)) #| --> #P"/bar/wibble.quux" |#
19:05:15
pjb
(translate-logical-pathname (make-pathname :host "FU" :name "WIBBLE" :type "QUUX" :case :local)) #| --> #P"/bar/WIBBLE.QUUX" |#
19:05:59
pjb
yitzi: when you call (pathname "FU:wibble.quux") #| --> #P"FU:wibble.quux" |# (which is done by #P"FU:wibble.quux").
19:06:14
pjb
So you see that's consistent with (translate-logical-pathname (make-pathname :host "FU" :name "WIBBLE" :type "QUUX" :case :common))
19:06:54
yitzi
Actually, I still think my example is fine. Logical pathnames can only have uppercase in name and type according to CLHS 19.3.1
19:07:06
pjb
(translate-logical-pathname (make-pathname :host "FU" :name "wibble" :type "quux" :case :local)) #| --> #P"/bar/wibble.quux" |#
19:07:36
pjb
Yes, it's an extension, where logical pathname can contain mixed case, to generate mixed case physical pathnames.
19:09:40
yitzi
But it the spec says translate-logical-pathname doesn't have to change the case. It does say the logical pathnames should be upcased though.
19:11:21
pjb
"translate-logical-pathname might perform additional translations, typically to provide translation of file types to local naming conventions, to accomodate physical file systems with limited length names, or to deal with special character requirements such as translating hyphens to underscores or uppercase letters to lowercase. Any such additional translations are implementation-defined. Some implementations do no additional
19:12:37
yitzi
But they also chose to do nothing in the constructor/parser for logical pathnames, which isn't permitted.
19:14:18
yitzi
I understand not respecting the spec in this case, just wish that there was a dynamic variable to make it follow the spec maybe.
19:15:11
pjb
One problem is that the CLHS doesn't specify what to do on specific platforms. We need substandards to specify that, when there are inconsistencies between implementations on the same platform.