Invalid error for ENSURE-DIRECTORIES-EXIST

Bug #1892874 reported by Michał "phoe" Herda on 2020-08-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

Debian sid x64, SBCL 2.0.6

* (make-pathname :directory '(:absolute "tmp" "foo" "Bar/baz"))
#P"/tmp/foo/Bar/baz/"
* (ensure-directories-exist *)

debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {10008A8083}>:
  Can't create directory /tmp/foo/Bar/baz/

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY] Retry directory creation.
  1: [ABORT] Exit debugger, returning to top level.

(SB-KERNEL::%FILE-ERROR #P"/tmp/foo/Bar/baz/" "Can't create directory ~A~:[~;,~%a file with ~
                          the same name already exists.~]" "/tmp/foo/Bar/baz/" NIL)

The programmer error here is obviously in the created pathname, since "Bar/baz" is not a valid directory name on Linux.

However, the error message is highly misleading and led to wasted debugging hours, because the namestring in the error report "Can't create directory /tmp/foo/Bar/baz/" is the printed representation of the pathname whose namestring is equivalent to a pathname with :directory '(:absolute "tmp" "foo" "Bar" "baz"), which, in turn, is a valid directory pathname on Linux.

How should this be solved? Should the original pathname be passed to SB-KERNEL::%FILE-ERROR in place of the namestring? Should there be some kind of pathname validation that will detect that "Bar/baz" is not a valid directory name on Unix?

Richard M Kreuter (kreuter) wrote :

This is more or less a consequence of the bug described at https://bugs.launchpad.net/sbcl/+bug/1278207

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers