Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does (probe-file #P"/") return nil?

This seems like it could be a bug in ECL's implementation -- or due to some detail in the standard:

    > (probe-file #P"/usr")

    #P"/usr/"
    > (probe-file #P"/usr/")

    #P"/usr/"
    > (probe-file #P"/")

    NIL
    > (probe-file #P"//")

    NIL

One more case:

    > (probe-file #P"/.")

    #P"/"

Update, FWIW, SBCL does what I expect:

    * (probe-file #P"/")

    #P"/"
like image 482
Michael Fox Avatar asked Apr 13 '26 11:04

Michael Fox


1 Answers

Here is a commit message from the fix I'm testing right now (hope this answers the question – it was a bug indeed):

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.

like image 97
Daniel Kochmański Avatar answered Apr 16 '26 12:04

Daniel Kochmański



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!