From: Aleksandr S. <al....@gm...> - 2010-01-18 17:33:20
|
Hi, On my machine with Mac OS X 10.5.8 TRANSLATE-LOGICAL-PATHNAME seems to be broken. Below is transcript of the session that illustrates that. Please note two points: 1) translate-logical-pathname failed for "SYS:", but succeeded for "SYS:SRC;" 2) it returned a proper pathname for "home", but for "home:Library;" it didn't keep case of characters and returned #P"/Users/asko/library/" while it should return #P"/Users/asko/Library/" On Mac OS X with case-sensitive file-system as it is on my mac, the item 2 leads to producing invalid paths. Here is the transcript: $ sbcl This is SBCL 1.0.34.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. * (translate-logical-pathname "sys:") debugger invoked on a SB-INT:SIMPLE-FILE-ERROR: no translation for #P"SYS:" Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. (TRANSLATE-LOGICAL-PATHNAME #P"SYS:")[:EXTERNAL] 0] 0 * (translate-logical-pathname "sys:src;") #P"/Users/asko/Library/sbcl/sbcl/src/" * (setf (logical-pathname-translations "home") `(("**;*.*.*" ,(concatenate 'string (posix-getenv "HOME") "/**/*.*")))) (("**;*.*.*" "/Users/asko/**/*.*")) * (translate-logical-pathname "home:") #P"/Users/asko/" * (translate-logical-pathname "home:Library;") #P"/Users/asko/library/" * Thanks, Aleksandr -- "Perfection is attained by slow degrees. She requires the hand of time." – Voltaire |
From: Christophe R. <cs...@ca...> - 2010-01-18 18:53:50
|
Aleksandr Skobelev <al....@gm...> writes: > On my machine with Mac OS X 10.5.8 TRANSLATE-LOGICAL-PATHNAME seems to > be broken. > Below is transcript of the session that illustrates that. Please note > two points: > 1) translate-logical-pathname failed for "SYS:", but succeeded for > "SYS:SRC;" What are the translations for the "SYS" host? Is there actually a valid translation for "SYS:"? (By default, there isn't; there are for SYS:SRC;**;*.* and SYS:CONTRIB;**;*.*) > 2) it returned a proper pathname for "home", but for "home:Library;" > it didn't keep case of characters and returned > #P"/Users/asko/library/" while it should return > #P"/Users/asko/Library/" > On Mac OS X with case-sensitive file-system as it is on my mac, the > item 2 leads to producing invalid paths. I refer you to CLHS 19.3.1.17: Logical pathnames destroy case information. If you need case sensitivity in your pathnames, don't use logical pathnames. Best, Christophe |
From: Aleksandr S. <al....@gm...> - 2010-01-19 09:22:46
|
Hi, Christophe Please see my comments below On Mon, Jan 18, 2010 at 9:53 PM, Christophe Rhodes <cs...@ca...> wrote: > Aleksandr Skobelev <al....@gm...> writes: > >> 2) it returned a proper pathname for "home", but for "home:Library;" >> it didn't keep case of characters and returned >> #P"/Users/asko/library/" while it should return >> #P"/Users/asko/Library/" >> On Mac OS X with case-sensitive file-system as it is on my mac, the >> item 2 leads to producing invalid paths. > > I refer you to CLHS 19.3.1.17: Logical pathnames destroy case > information. If you need case sensitivity in your pathnames, don't use > logical pathnames. As far as I understand CLHS 19.3.1.1.7 "Lowercase Letters in a Logical Pathname Namestring" refers to constructing of logical pathnames not to translating them. And CLHS 19.4 "Function TRANSLATE-LOGICAL-PATHNAME" and "function TRANSLATE-PATHNAME" supposes that some required translations of letter case can occur. Also it looks strange that there is direct translation to logical-pathname, but there is no appropriate reverse translation. And I see that Closure CL handles this situation correctly returning the pathname with proper letter case. Thanks, Aleksandr -- "Perfection is attained by slow degrees. She requires the hand of time." – Voltaire |
From: Christophe R. <cs...@ca...> - 2010-01-19 10:29:30
|
Aleksandr Skobelev <al....@gm...> writes: > On Mon, Jan 18, 2010 at 9:53 PM, Christophe Rhodes <cs...@ca...> wrote: >> Aleksandr Skobelev <al....@gm...> writes: >> >>> 2) it returned a proper pathname for "home", but for "home:Library;" >>> it didn't keep case of characters and returned >>> #P"/Users/asko/library/" while it should return >>> #P"/Users/asko/Library/" >>> On Mac OS X with case-sensitive file-system as it is on my mac, the >>> item 2 leads to producing invalid paths. >> >> I refer you to CLHS 19.3.1.17: Logical pathnames destroy case >> information. If you need case sensitivity in your pathnames, don't use >> logical pathnames. > > As far as I understand CLHS 19.3.1.1.7 "Lowercase Letters in a Logical > Pathname Namestring" refers to constructing of logical pathnames not > to translating them. In order to translate a logical pathname, you must first construct one. When you do (translate-logical-pathname "home:Library;") the namestring "home:Library;" is coerced to a pathname by TRANSLATE-LOGICAL-PATHNAME; because the HOME host exists, that pathname will be a logical pathname. Logical pathname namestrings upcase lower-case letters in the namestring, so the pathname you will get, by the standard, has components. :host "HOME" :directory (:relative "LIBRARY") at which point you have lost the information If you need to refer to mixed-case pathnames with logical pathnames, you must define explicit translations, such as an entry ("LIBRARY;**;*.*" "/Users/asko/Library/**/*.*") in (logical-pathname-translations "HOME"). > Also it looks strange that there is direct translation to > logical-pathname, but there is no appropriate reverse translation. And > I see that Closure CL handles this situation correctly returning the > pathname with proper letter case. "correctly" according to whom? Conveniently, perhaps, but I believe not conformingly. Cheers, Christophe |
From: Aleksandr S. <al....@gm...> - 2010-01-19 13:28:41
|
Hi Christopher, I see your point. On the other hand, I think that the paragraph below, from 19.4 "The Filenames Dictionary. Function TRANSLATE-LOGICAL-PATHNAME", makes behavior of Clozure CL pretty conforming: "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 translations." In any case thanks for your response and help. Aleksandr On Tue, Jan 19, 2010 at 1:29 PM, Christophe Rhodes <cs...@ca...> wrote: > Aleksandr Skobelev <al....@gm...> writes: > >> On Mon, Jan 18, 2010 at 9:53 PM, Christophe Rhodes <cs...@ca...> wrote: >>> Aleksandr Skobelev <al....@gm...> writes: >>> >>>> 2) it returned a proper pathname for "home", but for "home:Library;" >>>> it didn't keep case of characters and returned >>>> #P"/Users/asko/library/" while it should return >>>> #P"/Users/asko/Library/" >>>> On Mac OS X with case-sensitive file-system as it is on my mac, the >>>> item 2 leads to producing invalid paths. >>> >>> I refer you to CLHS 19.3.1.17: Logical pathnames destroy case >>> information. If you need case sensitivity in your pathnames, don't use >>> logical pathnames. >> >> As far as I understand CLHS 19.3.1.1.7 "Lowercase Letters in a Logical >> Pathname Namestring" refers to constructing of logical pathnames not >> to translating them. > > In order to translate a logical pathname, you must first construct one. > > When you do > (translate-logical-pathname "home:Library;") > the namestring "home:Library;" is coerced to a pathname by > TRANSLATE-LOGICAL-PATHNAME; because the HOME host exists, that pathname > will be a logical pathname. Logical pathname namestrings upcase > lower-case letters in the namestring, so the pathname you will get, by > the standard, has components. > :host "HOME" :directory (:relative "LIBRARY") > at which point you have lost the information > > If you need to refer to mixed-case pathnames with logical pathnames, you > must define explicit translations, such as an entry > ("LIBRARY;**;*.*" "/Users/asko/Library/**/*.*") > in (logical-pathname-translations "HOME"). > >> Also it looks strange that there is direct translation to >> logical-pathname, but there is no appropriate reverse translation. And >> I see that Closure CL handles this situation correctly returning the >> pathname with proper letter case. > > "correctly" according to whom? Conveniently, perhaps, but I believe not > conformingly. > > Cheers, > > Christophe > -- "Perfection is attained by slow degrees. She requires the hand of time." – Voltaire |