Open galdor opened 1 year ago
Btw I just realized that SIMPLE-FILE-ERROR
was not exported. Would it be ok to export it with SIMPLE-FILE-ERROR-ERRNO
, and if yes where should the export be?
https://github.com/Clozure/ccl/issues/364 may also be in this area
Indeed, it seems useful. But there is not much I can do about it, I do not have write access ;)
I hate to discourage this, but it feels to me that this (expose errno in simple-file-error) is not the right way to go.
You said that you really wanted a file-does-not-exist
error, and I'd rather see us pursue that. I see that there is a lot of hair around %err-disp
and friends, and I don't blame you for wanting to look the other way.
That would be better indeed; but in that case, I would simply ignore %ERR-DISP
and signal the right condition directly at the source. I suspect %ERR-DISP
, which seems to be only used to dispatch to the "right" condition type, could be removed altogether.
CCL signals SIMPLE-FILE-ERROR conditions for all file-related errors, but they do not contain any information to programmatically distinguish what the error actually is.
The most basic use case is the ability to detect that opening a file failed because it did not exist. Without this patch, it is impossible to make the difference between a file-not-found error and, for example, an IO error.
I originally wanted to introduced a new
FILE-DOES-NOT-EXIST
condition inheriting fromSIMPLE-FILE-ERROR
as SBCL does withSB-EXT:FILE-DOES-NOT-EXIST
, but this would require seriously reworking the whole%ERR-DISP-COMMON
thing, and I honestly have no idea where to start. Storing errno into the file error makes sense. Even if it is very low level, it provides the necessary information so that a caller can decide how to handle it, without changing any existing API.