Opened 9 years ago

Last modified 3 years ago

#814 new defect

ENOUGH-NAMESTRING on Windows does not take drives into account

Reported by: lovesan Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: pathname, namestring, filesystem, windows Cc:

Description

i.e.

(enough-namestring "d:\\dir\\file.txt" "c:\\users\\username\\")
==>  "/dir/file.txt"
while it should return "d:/dir/file.txt"

This seems like a violation of ANSI CL standard: http://www.lispworks.com/documentation/HyperSpec/Body/f_namest.htm#enough-namestring

enough-namestring returns an abbreviated namestring that is just
sufficient to identify the file named by pathname when considered
relative to the defaults. It is required that

 (merge-pathnames (enough-namestring pathname defaults) defaults)
==  (merge-pathnames (parse-namestring pathname nil defaults) defaults)

i.e.

(let ((defaults #P"c:\\users\\username\\")
      (path #P"d:\\dir\\file.txt"))
  (equal (merge-pathnames (enough-namestring path defaults) defaults)
         (merge-pathnames (parse-namestring path nil defaults) defaults)))
==> NIL

Moreover, ENOUGH-NAMESTRING erases equal components of path and defaults pathnames, for some reason:

(enough-namestring #P"d:\\dir\\file1.txt" #P"d:\\some\\path\\file2.txt")
==> "/dir/file1"

(enough-namestring #P"d:\\dir\\file.txt" #P"d:\\some\\path\\file.txt")
==> "/dir/"

Change History (3)

comment:1 Changed 8 years ago by rme

  • Milestone set to Clozure CL 1.8

comment:2 Changed 8 years ago by rme

What should (enough-namestring "c:/foo/bar.txt" #p"ccl:") be? What about (enough-namestring "d:/foo/bar.txt" #p"c:/")?

comment:3 Changed 3 years ago by rme

  • Milestone Clozure CL 1.9 deleted

Milestone Clozure CL 1.9 deleted

Note: See TracTickets for help on using tickets.