Bug report: COMPILE-FILE, COMPILE-FILE-PATHNAME disagree on output dir

Robert Munyer 2433647181 at munyer.com
Sun Nov 8 21:52:24 UTC 2020


> Your implementation of COMPILE-FILE-PATHNAME has now been merged into
> [abcl-1.8.1-dev][1][2].
>
> Thanks for your analysis, thinking, and implementation here.
>
> This will be part of abcl-1.8.1 which will be released in the next couple
> weeks, pending further shakedown of abcl-1.8.0 issues.  Until then, you will
> need to build abcl from source to get a version which includes your fix.
>
> I have closed [ticket 476][476] as your implementation addresses the problems
> you uncovered, and continues to pass the CI tests at the same level as without.

COMPILE-FILE-PATHNAME seems good now, but I'm still finding pathname-
related bugs in COMPILE-FILE itself.  The latest is one where it throws
a "file ... does not exist" error while trying to compress the temporary
files that it has just created into an archive.  I'll paste a demo of
that bug at the end of this message.

If you remove this assignment statement from the source of COMPILE-FILE:

    (setf output-file
          (make-pathname :defaults
                         (if output-file
                             (merge-pathnames output-file
                                              *default-pathname-defaults*)
                             (compile-file-pathname input-file))
                         :version nil))

, and replace it with this one:

    (setf output-file
          (compile-file-pathname input-file :output-file output-file))

, then the pathname-related bugs that I've been noticing go away.

I see that the existing code is going out of its way to force the
pathname version number to NIL.  I don't know if there is a good
reason for it to be doing that.  If there is a good reason for it,
it should be done in COMPILE-FILE-PATHNAME, not in COMPILE-FILE.

Here is a COMPILE-FILE-PATHNAME that forces the version number;
use this if forcing the version number is actually desirable.

(defun compile-file-pathname (input-file &key output-file &allow-other-keys)
  (let ((defaults (make-pathname :type *compile-file-type*
                                 :defaults (merge-pathnames input-file))))
    (make-pathname :version nil
                   :defaults (cond ((null output-file) defaults)
                                   (t (merge-pathnames output-file
                                                       defaults))))))

The 2nd and 3rd of the three code snippets above are my own original
work, and I release them into the public domain, no rights reserved.

Here's the report of the "file ... does not exist" error:

The code below works in CCL, CLISP and SBCL, but not in ABCL.
It _does_ work in ABCL if you replace the first code snippet shown
above with the second, the one that's only two lines long.

$ echo '(format t "~&Hello, world!~%")' > bar.lisp
$ java -jar abcl-231e00ef.jar
Armed Bear Common Lisp 1.8.1-dev
Java 1.8.0_272 Oracle Corporation
OpenJDK 64-Bit Server VM
Low-level initialization completed in 0.363 seconds.
Startup completed in 1.35 seconds.
Type ":help" for a list of available commands.
CL-USER(1): (compile-file (make-pathname :name "bar" :type "lisp")
             :output-file (make-pathname :name "bar-baz"))
; Compiling /tmp/foo/bar.lisp ...
; (FORMAT T ...)
#<THREAD "interpreter" {430133BA}>: Debugger invoked on condition of type FILE-ERROR
  The file /tmp/foo/bar-baz does not exist.
Restarts:
  0: TOP-LEVEL Return to top level.
[1] CL-USER(2):



More information about the armedbear-devel mailing list