sb-posix should use _wstat instead of _stat on Windows

Bug #1267540 reported by Timofei Shatrov on 2014-01-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

If Unicode support is enabled, sb-posix:stat fails with Unicode filenames on Windows. After some digging in SBCL source code/ MSFT documentations, I have found that calling foreign function _wstat instead of _stat does the trick.


Reference for _stat, _wstat:

I used the following code to define sb-posix::wstat which I had to use in my code instead of sb-posix:stat.

(sb-posix::define-stat-call "_wstat"
                  sb-posix::pathname sb-posix::filename
                  (function sb-posix::int (sb-posix::c-string :external-format :ucs-2)
                            (* sb-posix::alien-stat)))

Which is a rather hacky workaround, so it would be nice if SBCL supported this out of the box.

To reproduce run (sb-posix:stat "some filename containing unicode characters")

I was using Windows threaded build "", but the same problem clearly exists in the latest source code as linked above.

description: updated
Paul F. Dietz (paul-f-dietz) wrote :

Poster Grue on u/lisp on Reddit requests this bug be fixed.

"May I suggest this one? It seems easy to fix, but would be a huge win."

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

Other bug subscribers