Clozure / ccl

Clozure Common Lisp
http://ccl.clozure.com
Apache License 2.0
857 stars 103 forks source link

save-applications tries probe-file on a directory pathname! #193

Open informatimago opened 5 years ago

informatimago commented 5 years ago
Error: Directory containing #P"/Users/pjb/src/public/commands/commands" does not exist.

Yes, it does.

The problem is in lib/dumplisp.lisp:82 where probe-file is used to probe a directory path. This cannot work. Instead, use ENSURE-DIRECTORIES-EXIST !

(let ((path (translate-logical-pathname filename)))
    (ensure-directories-exist path))
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/70047174-save-applications-tries-probe-file-on-a-directory-pathname?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github).
informatimago commented 5 years ago

Oh, perhaps of importance, I have:

(setf *default-pathname-defaults* #P"/Users/pjb/src/public/commands/sources/.lisp")

But since :defaults nil is passed to makefile, I don't think it should matter.

On second thought, it looks like PROBE-FILE is required to merge-pathnames with default-pathname-defaults http://www.lispworks.com/documentation/HyperSpec/Body/19_bc.htm so if there was a way to use PROBE-FILE, the bug would be either in not wrapping its use in a clean binding of default-pathname-defaults or in passing :name :unspecific :type :unspecific :version :unspecific to make-pathname!

Since we're talking about a future file, and PROBE-FILE doesn't probe directories, I stand by my first suggestion of using ensure-directories-exist.

$ clall -r '(setf *default-pathname-defaults* #P"/tmp/.lisp")' '(probe-file #P"/Users/pjb/quicklisp")'

Armed Bear Common Lisp   --> #P"/tmp/.lisp"
Armed Bear Common Lisp   --> #P"/Users/pjb/quicklisp/"             Invalid, should not probe a directory.

Clozure Common Lisp      --> #P"/tmp/.lisp"
Clozure Common Lisp      --> #P"/Users/pjb/quicklisp.lisp"         Good.

CLISP                    --> #P"/tmp/.lisp"
CLISP                    PROBE-FILE: "/Users/pjb/quicklisp" 
                         names a directory, not a file             Missing merge-pathnames in probe-file.

ECL                      --> #P"/tmp/.lisp"
ECL                      Filesystem error with pathname 
                         "/Users/pjb/quicklisp/.lisp".  Either
                         1) the file does not exist, or  2) we
                         are not allowed to access the file, or
                         3) the pathname points to a broken
                         symbolic link.                            Missing merge-pathnames in probe-file.

SBCL                     --> #P"/tmp/.lisp"
SBCL                     --> #P"/Users/pjb/quicklisp/"             Invalid, should not probe a directory.