[Openmcl-devel] Regression in pathname-device in 1.3

Gary Byers gb at clozure.com
Thu Feb 12 22:51:35 UTC 2009


At first glance, that looks like a case where (PATHNAME stream) is
returning a STRING, not a pathname.

? (with-open-file (f "/home/gb/ccl-init.lisp") (pathname f))
"/home/gb/ccl-init.lisp"

That's wrong; the function PATHNAME should return a PATHNAME or die trying:

Index: level-1/l1-files.lisp
===================================================================
--- level-1/l1-files.lisp	(revision 11733)
+++ level-1/l1-files.lisp	(working copy)
@@ -490,7 +490,7 @@
      (string (string-to-pathname path))))

  (defun %path-from-stream (stream)
-  (or (stream-filename stream) (error "Can't determine pathname of ~S ." stream)))      ; ???
+  (or (pathname (stream-filename stream)) (error "Can't determine pathname of ~S ." stream)))      ; ???

  ;Like (pathname stream) except returns NIL rather than error when there's no
  ;filename associated with the stream.

The bug's probably been there for a while; it's exposed by the fact that
PATHNAME-DEVICE can actually return something useful, e.g.,

#p"c:/some/awful/windows/pathname"

and

#p"d:/some/awful/windows/pathname"

differ in their PATHNAME-DEVICEs.



On Thu, 12 Feb 2009, Daniel Dickison wrote:

> I just switched from 1.2 to the 1.3 RC, and it looks like
> PATHNAME-DEVICE now errs when called with a file that was opened with
> a namestring.  In 1.2, this would return NIL instead.
>
> Below is a comparison of 1.2 and 1.3 behavior, as well as a trivial
> patch to restore the 1.2 behavior.  However, perhaps the correct fix
> is to parse the string in case it's a Windows namestring that contains
> a valid device specifier.
>
> Let me know if I should open a ticket on Trac.  And as always, thank
> you for your great work on CCL!
>
> [/Applications/Lisp]$ ./ccl-1.2/dppccl --no-init
> Welcome to Clozure Common Lisp Version 1.2-r11710M  (DarwinPPC32)!
> ? (with-open-file (f "~/.profile") (pathname-device f))
> NIL
> ? (quit)
> [/Applications/Lisp]$ ./ccl-1.3/dppccl --no-init
> Welcome to Clozure Common Lisp Version 1.3-RC1-r11719M  (DarwinPPC32)!
> ? (with-open-file (f "~/.profile") (pathname-device f))
>> Error: value "/Users/ddickison/.profile" is not of the expected type (OR LOGICAL-PATHNAME PATHNAME).
>> While executing: PATHNAME-DEVICE, in process listener(1).
>> Type :POP to abort, :R for a list of available restarts.
>> Type :? for other options.
> 1 > :b
> (F019ABB0) : 0 (PATHNAME-DEVICE #<BASIC-FILE-CHARACTER-INPUT-STREAM
> ("/Users/ddickison/.profile"/4 ISO-8859-1) #x84EA266> :CASE NIL) 136
> (F019ABD0) : 2 (FUNCALL #'#<Anonymous Function #x84EB26E>) 172
> (F019AC00) : 4 (TOPLEVEL-EVAL (WITH-OPEN-FILE (F "~/.profile")
> (PATHNAME-DEVICE F)) NIL) 476
> (F019AC30) : 5 (READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to
> *TERMINAL-IO* #x84DE2FE> :OUTPUT-STREAM #<SYNONYM-STREAM to
> *TERMINAL-IO* #x84DE166> :BREAK-LEVEL 0 :PROMPT-FUNCTION
> #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global)
> #x81A7596>) 1080
> (F019AC70) : 6 (TOPLEVEL-LOOP) 72
> (F019AC90) : 7 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION
> (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 68
> (F019ACB0) : 9 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>) 392
> (F019ACE0) : 11 (RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1)
> [Active] #x84DC58E> (#<COMPILED-LEXICAL-CLOSURE # #x84DC29E>)) 404
> (F019AD20) : 13 (FUNCALL #'#<(:INTERNAL
> CCL::%PROCESS-PRESET-INTERNAL)> #<TTY-LISTENER listener(1) [Active]
> #x84DC58E> (#<COMPILED-LEXICAL-CLOSURE # #x84DC29E>)) 164
> (F019AD40) : 14 (FUNCALL #'#<(:INTERNAL
> CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 176
> 1 > (quit)
>
>
> Index: level-1/l1-files.lisp
> ===================================================================
> --- level-1/l1-files.lisp       (revision 11731)
> +++ level-1/l1-files.lisp       (working copy)
> @@ -776,7 +776,7 @@
>  (declare (ignore case))
>  (let* ((p (pathname thing)))
>    (etypecase p
> -      (logical-pathname :unspecific)
> +      ((or logical-pathname string) :unspecific)
>      (pathname (%physical-pathname-device p)))))
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list