From: ··············@yahoo.com
Subject: More CMUCL bugs (possibly ACL also?): enough-namestring
Date: 
Message-ID: <76k9g4$ur9$1@nnrp1.dejanews.com>
Hmmmmm...

Under ACL5:
  USER(68): (setf (logical-pathname-translations "source")
              '(("demos;**;*.*" "/home/rmiles/code/source/demos/")))
  (("demos;**;*.*" "/home/rmiles/code/source/demos/"))
  USER(69): (enough-namestring "source:demos;foo.lisp")
  "/demos/foo.lisp"

Under CMUCL:
  * (setf (logical-pathname-translations "source")
      '(("demos;**;*.*" "/home/rmiles/code/source/demos/")))
  (("demos;**;*.*" "/home/rmiles/code/source/demos/"))
  * (enough-namestring "source:demos;foo.lisp")

  Invalid number of arguments: 2

  Restarts:
    0: [ABORT] Return to Top-Level.

  Debug  (type H for help)

  (IDENTITY 2 #.(logical-pathname "SOURCE:DEMOS;FOO.LISP"))[:EXTERNAL]
  Source: (DEFUN IDENTITY (THING) "Returns what was passed to it." THING)

Hyperspec:
  Syntax: pathname &optional defaults => 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)

  in all cases, and the result of enough-namestring is the shortest
reasonable     string that will satisfy this criterion.

ACL5:
  USER(71): (merge-pathnames (enough-namestring
 			      "source:demos;foo.lisp"
			      *default-pathname-defaults*)
			     *default-pathname-defaults*)
  #p"/demos/foo.lisp"
  USER(72): (merge-pathnames (parse-namestring
			      "source:demos;foo.lisp"
			      nil
			      *default-pathname-defaults*)
			     *default-pathname-defaults*)
  #p"source:demos;foo.lisp"

CMUCL:
  * (merge-pathnames (enough-namestring
			      "source:demos;foo.lisp"
			      *default-pathname-defaults*)
			     *default-pathname-defaults*)

  Invalid number of arguments: 2
  [same error as above snipped]
  * (merge-pathnames (parse-namestring
			      "source:demos;foo.lisp"
			      nil
			      *default-pathname-defaults*)
			     *default-pathname-defaults*)
  #.(logical-pathname "SOURCE:DEMOS;FOO.LISP")

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

From: Martin Cracauer
Subject: Re: More CMUCL bugs (possibly ACL also?): enough-namestring
Date: 
Message-ID: <76nvae$1b4g$1@counter.bik-gmbh.de>
I can only repeat my advice that you send CMUCL bug reports to a
fourum that is read by CMUCL developers, i.e. cmucl-imp at cons point
org. 

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <········@bik-gmbh.de> http://www.bik-gmbh.de/~cracauer/
There is a business like showbusiness. http://www.microsoft.com/
Where you want to go. Today.           http://www.freebsd.org/
From: R. Toy
Subject: Re: More CMUCL bugs (possibly ACL also?): enough-namestring
Date: 
Message-ID: <36918AA8.6FFDDC20@mindspring.com>
Martin Cracauer wrote:
> 
> I can only repeat my advice that you send CMUCL bug reports to a
> fourum that is read by CMUCL developers, i.e. cmucl-imp at cons point
> org.
> 

Indeed.

However, I took a look at this.  It is a genuine bug in CMUCL, probably
due to an oversight.  enough-namestring wants to return the entire
pathname but inadvertently passes two parameters to #'identity.

As a simple workaround, you can use this replacement.  Just place it in
your .cmucl-init.lisp:

(defun enough-namestring (pathname
			  &optional (defaults *default-pathname-defaults*))
  "Returns an abbreviated pathname sufficent to identify the pathname
relative
   to the defaults."
  (declare (type path-designator pathname))
  (with-pathname (pathname pathname)
    (let ((host (%pathname-host pathname)))
      (if host
	  (with-pathname (defaults defaults)
	    (funcall (host-unparse-enough host) pathname))
	  (error
	   "Cannot determine the namestring for pathnames with no host:~%  ~S"
	   pathname)))))

It gets rid of the error, but doesn't really return the shortest
reasonable namestring.

Ray
-- 
---------------------------------------------------------------------------
----> Raymond Toy	····@mindspring.com
                        http://www.mindspring.com/~rtoy