Open / Save to cloud on Windows 10

Linus Torvalds torvalds at
Mon Feb 20 09:42:35 PST 2017

On Mon, Feb 20, 2017 at 6:49 AM, Jérémie Guichard <djeBrest at> wrote:
> I narrowed it!

Good job.

> As a proof of concept I added an ugly: "extern int p_stat(const char* path,
> struct stat* buf);" on top of git-access.c and used it in get_remote_repo
> and is_git_repository (these are the 2 only places stat function is used in
> the whole project). It fixed my issue (I could Open and Save could
> storage)...

Ugh. Ok. So it appears that whatever Windows posix emulation library
we use is pretty broken.  Looking at the "p_stat()" implementation in
libgit2, it just does a utf8->wchar expansion.

We actually do the same thing in "subsurface_open()", for all the same
reasons. I wonder why the system "stat()" routine can't just get that
right? What the hell is wrong with Windows libraries? Why doesn't the
windows "stat()" routine just DTRT?

> 3. Implement our own portable stat

I think this is the right thing to do, we already end up having all
the pieces, and we already use "fstat()" even on windows, so we could
just do a subsurface_stat() exactly like we do subsurface_open().


More information about the subsurface mailing list