Subject: Re: [clisp-list] logical-pathname

From: Marco Antoniotti <[email-masked]>
Date: Wed Jan 29 09:37:02 2003

On Tuesday, Jan 28, 2003, at 23:27 America/New_York, Pascal Bourguignon 
wrote:

> Hello,
>
> [37]> (lisp-implementation-version)
> "2.30 (released 2002-09-15) (built 3251450717) (memory 3251450977)"
>
>
> I'm wondering if there is not a problem with logical-pathname on unix:
>
> [38]> (namestring (pathname "/home/pascal/tmp/test/*"))
> "/home/pascal/tmp/test/*"
>
> OK.
>
>

The following discussion is moot since

	"/home/pascal/tmp/test/*"

is not a logical pathname designator.

This is a bug in CLisp, as it should signal an error, as per CLHS 
definition of the function LOGICAL-PATHNAME.

You may argue that the CLHS is bogus here, but that is a totally 
different issue.

Cheers

Marco

> [39]> (namestring (logical-pathname "/home/pascal/tmp/test/*"))
> ";HOME;PASCAL;TMP;TEST;*"
>
> Oops !  A relative path!
>
>
> [40]> (logical-pathname "/home/pascal/tmp/test/*")
> #S(LOGICAL-PATHNAME :HOST NIL :DEVICE NIL
>    :DIRECTORY (:RELATIVE "HOME" "PASCAL" "TMP" "TEST") :NAME :WILD 
> :TYPE NIL
>    :VERSION NIL)
>
> Since the namestring started with '/', I expected an :ABSOLUTE logical
> path name.
>
> As  it  is, the  :RELATIVE  logical-pathname  can't  be used,  because
> DIRECTORY really works relatively  to the current directory instead of
> relatively to the root:
>
> [41]> (directory (logical-pathname "/home/pascal/tmp/test/*"))
> NIL
>
> [42]> (directory (pathname "/home/pascal/tmp/test/*"))
> (#P"/home/pascal/tmp/test/a"
>  #P"/home/pascal/tmp/test/b"
>  #P"/home/pascal/tmp/test/c")
>
>
>
> Note  also  the  dot  appended  to  the  pathname  when  translating  a
> logical-path name:
>
> (translate-logical-pathname "/home/pascal/tmp/test/*")
> #P"home/pascal/tmp/test/*."
>
> could prevent DIRECTORY to work too even if the logical path built was
> :ABSOLUTE.
>
> [150]> (directory #P"/home/pascal/tmp/test/*.")
> NIL
> [151]> (directory #P"/home/pascal/tmp/test/*")
> (#P"/home/pascal/tmp/test/a"
>  #P"/home/pascal/tmp/test/b"
>  #P"/home/pascal/tmp/test/c")
>
>
>
> The paths  in Common-Lisp is  already complicated enough. It  would be
> nice if the implementation showed a little more regularity there.
>
>
>
>
>
>
>
>
> If I've understood correctly the section 19.4 of CLHS and the relative
> glossary entries, we have the following "class diagram" anontated with
> transitions denoting the functions available to manipulate the paths.
>
> Please correct me if I've misunderstood a specification here.
>
>
>    (Perhaps, pathname and physical-pathname are identical?)
>
>
>                               parse-namestring
>                                    +--+
>                                    |  |
>                                    V  |
>                      +------------------------+
>                      |        pathname        
> |---------------------------+
>                      +------------------------+                        
>    |
>       make-pathname  | + device               |                        
>    |
>    *---------------->| + directory            |                        
>    |
>                      | + host                 
> |<----------------------+   |
>                      | + name                 |                       
> |   |
>                      | + type                 |                       
> |   |
>                      | + version              |                       
> |   |
>                      +------------------------+                       
> |   |
>                                   |                                   
> |   |
>                                  / \                                  
> |   |
>         logical-pathname        /___\                                 
> |   |
>               +--+                |                                   
> |   |
>               |  |    +-----------+-------------+                     
> |   |
>               V  |    |                         |                     
> |   |
>              +------------------+      +-------------------+          
> |   |
>     +------->| logical-pathname |      | physical-pathname |          
> |   |
>     |        +------------------+      +-------------------+          
> |   |
>     |                                                  ^              
> |   |
>     |                     translate-logical-pathname   |              
> |   |
>     |                             +--------------------+              
> |   |
>     |                             |                                   
> |   |
>     |                             |                                   
> |   |
>     |logical-pathname             |                                   
> |   |
>     |                             |             parse-namestring      
> |   |
>     |            +---------------------+           pathname           
> |   |
>     +------------| pathname-designator 
> |------------------------------+   |
>                  +---------------------+                               
>    |
>                             |                                          
>    |
>                            / \                                         
>    |
>                           /___\                   enough-namestring    
>    |
>                             |                       host-namestring    
>    |
>                 +-----------+----------+           
> directory-namestring   |
>                 |                      |              file-namestring  
>    |
>              +--------+         +------------+          namestring     
>    |
>              | stream |         | namestring 
> |<---------------------------+
>              +--------+         +------------+
>                                        |
>                                       / \
>                                      /___\
>                                        |
>                           +------------+---------------+
>                           |                            |
>                +---------------------+      +-----------------------+
>                | string-standardized |      | string-implementation |
>                +---------------------+      +-----------------------+
>           aka logical-pathname-namestring
>
>
>
> Standardized  string and logical  pathname namestring  seem to  be the
> same thing.   Then pathname should  probably build a  logical pathname
> when  given  a  logical  pathname  namestring contrarily  to  what  is
> currently implemented.
>
>
>
> Note also  about pathname  that it's specified  over a pathspec,  ie a
> pathname designator,  (stream or  namestring), not over  pathname. So:
> (pathname (pathname "/tmp")) should probably raise an error instead of
> returning (pathname "/tmp")...
>
>
> --
> __Pascal_Bourguignon__                   http://www.informatimago.com/
> ----------------------------------------------------------------------
> There is a fault in reality. Do not adjust your minds. -- Salman 
> Rushdie
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> clisp-list mailing list
> [email-masked]
> https://lists.sourceforge.net/lists/listinfo/clisp-list
>
--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.