为什么 (probe-file #P"/") return nil?
Why does (probe-file #P"/") return nil?
这似乎是 ECL 实现中的错误——或者由于标准中的一些细节:
> (probe-file #P"/usr")
#P"/usr/"
> (probe-file #P"/usr/")
#P"/usr/"
> (probe-file #P"/")
NIL
> (probe-file #P"//")
NIL
还有一个案例:
> (probe-file #P"/.")
#P"/"
更新,FWIW,SBCL 符合我的预期:
* (probe-file #P"/")
#P"/"
这是我正在测试的修复程序的提交消息(希望这能回答问题——这确实是一个错误):
unixfsys: remove coerce_to_posix_filename
This was a workaround around bugs in cygwin and mingw (which are
already fixed), when the directory name ended with '/'. This fix
introduced extra bug with probe-file called on the root directory (it
returned nil on all platforms).
Original comment:
This converts a pathname designator into a namestring, with the
particularity that directories do not end with a slash '/', because
this is not supported on all POSIX platforms (most notably Windows).
Bug reference:
https://sourceforge.net/p/mingw-w64/patches/34/
Fixes #351.
这似乎是 ECL 实现中的错误——或者由于标准中的一些细节:
> (probe-file #P"/usr")
#P"/usr/"
> (probe-file #P"/usr/")
#P"/usr/"
> (probe-file #P"/")
NIL
> (probe-file #P"//")
NIL
还有一个案例:
> (probe-file #P"/.")
#P"/"
更新,FWIW,SBCL 符合我的预期:
* (probe-file #P"/")
#P"/"
这是我正在测试的修复程序的提交消息(希望这能回答问题——这确实是一个错误):
unixfsys: remove coerce_to_posix_filename
This was a workaround around bugs in cygwin and mingw (which are already fixed), when the directory name ended with '/'. This fix introduced extra bug with probe-file called on the root directory (it returned nil on all platforms).
Original comment:
This converts a pathname designator into a namestring, with the particularity that directories do not end with a slash '/', because this is not supported on all POSIX platforms (most notably Windows).
Bug reference:
https://sourceforge.net/p/mingw-w64/patches/34/
Fixes #351.