Skip to content

kj: tolerate ERROR_INVALID_FUNCTION from GetFileInformationByHandleEx on Wine#2633

Merged
kentonv merged 1 commit intocapnproto:masterfrom
Sjors:kj/wine-error-invalid-function
May 8, 2026
Merged

kj: tolerate ERROR_INVALID_FUNCTION from GetFileInformationByHandleEx on Wine#2633
kentonv merged 1 commit intocapnproto:masterfrom
Sjors:kj/wine-error-invalid-function

Conversation

@Sjors
Copy link
Copy Markdown

@Sjors Sjors commented Apr 23, 2026

I tested this patch as part of cross-compile-then-run-in-wine PR: bitcoin-core/libmultiprocess#272.

However, I didn't check the (LLM generated) reasoning in the commit message.

@Sjors Sjors changed the title kj: tolerate ERROR_INVALID_FUNCTION from GetFileInformationByHandleExon Wine kj: tolerate ERROR_INVALID_FUNCTION from GetFileInformationByHandleEx on Wine Apr 23, 2026
@kentonv
Copy link
Copy Markdown
Member

kentonv commented Apr 27, 2026

The fix seems reasonable but I am slightly offended by the LLM's assumptions about me! (lol)

That arm appears to never have actually fired under Wine; it has just been an unverified guess.

I certainly did actually test this under WINE! But it was over eight years ago. Perhaps WINE has changed since then.

Would you mind adjusting the commit message to say the error seems to have changed?

@Sjors
Copy link
Copy Markdown
Author

Sjors commented Apr 28, 2026

@kentonv sorry about that :-)

It was probably my fault: I asked it figure out which version of Wine introduced a change. It couldn't find the answer and so it blamed you.

I'll adjust the test and look into the CI failure.

@kentonv
Copy link
Copy Markdown
Member

kentonv commented Apr 28, 2026

Don't worry about the CI failure. FreeBSD 15 has a bug (in FreeBSD, not Cap'n Proto) which has made it broken fro some time.

And I think windows-2019 isn't running because they don't have action runners for it anymore.

… on Wine

DiskHandle::stat() calls GetFileInformationByHandleEx with the
FileCompressionInfo class, which Wine does not implement. Wine's
NtQueryInformationFile returns STATUS_NOT_IMPLEMENTED (0xC0000002) for
unsupported FileInfoClass values, and RtlNtStatusToDosError maps that
to ERROR_INVALID_FUNCTION (1) -- not to ERROR_CALL_NOT_IMPLEMENTED
(120), which corresponds to STATUS_NOT_SUPPORTED (0xC00000BB) and is
not what Wine returns here.

The existing fallback (added in 7c32fcc, "Implement filesystem API for
Windows.") only matched ERROR_CALL_NOT_IMPLEMENTED with the comment
"Probably WINE." This is no longer sufficient, but it's unclear
which Wine version introduced the change.

The real Wine behavior surfaces as soon as DiskHandle::stat() runs under
Wine, e.g. when running cross-compiled capnpc-c++.exe (or any consumer
of kj's filesystem API) on a project that uses libmultiprocess's Windows CI.

Treat ERROR_INVALID_FUNCTION the same way: skip the sparse-file
space-usage query and continue.
@Sjors Sjors force-pushed the kj/wine-error-invalid-function branch from 523c4af to f4a31b2 Compare April 28, 2026 15:26
@Sjors
Copy link
Copy Markdown
Author

Sjors commented Apr 28, 2026

Ok in that case: I pushed a modified commit message.

@kentonv kentonv merged commit 8f7105a into capnproto:master May 8, 2026
14 of 16 checks passed
@kentonv
Copy link
Copy Markdown
Member

kentonv commented May 8, 2026

thanks!

@Sjors Sjors deleted the kj/wine-error-invalid-function branch May 8, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants