This is an archive of the discontinued LLVM Phabricator instance.

Support: Work around missing SetFileInformationByHandle on Wine
ClosedPublic

Authored by hans on Oct 11 2017, 1:09 PM.

Details

Summary

In r315079, fs::rename was reimplemented in terms of CreateFile and SetFileInformationByHandle. Unfortunately, the latter isn't supported by Wine. This adds a fallback to MoveFileEx for that case.

Diff Detail

Repository
rL LLVM

Event Timeline

hans created this revision.Oct 11 2017, 1:09 PM
pcc added inline comments.Oct 11 2017, 2:05 PM
lib/Support/Windows/Path.inc
436 ↗(On Diff #118674)

Wine returns ERROR_CALL_NOT_IMPLEMENTED if it does not support the call to SetFileInformationByHandle. Would it be simpler to detect that here and try the MoveFileEx if it fails in that way?

hans added inline comments.Oct 11 2017, 2:25 PM
lib/Support/Windows/Path.inc
436 ↗(On Diff #118674)

Yes, that seems much nicer. Thanks!

hans updated this revision to Diff 118695.Oct 11 2017, 2:26 PM
hans edited the summary of this revision. (Show Details)

Check for ERROR_CALL_NOT_IMPLEMENTED instead.

pcc accepted this revision.Oct 11 2017, 2:33 PM

LGTM

lib/Support/Windows/Path.inc
417 ↗(On Diff #118695)

Perhaps more precise to compare EC against std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category()) here.

This revision is now accepted and ready to land.Oct 11 2017, 2:33 PM
hans added inline comments.Oct 11 2017, 2:37 PM
lib/Support/Windows/Path.inc
417 ↗(On Diff #118695)

Will do.

Hmm actually, this means Wine will print to stderr complaining about the unimplementedness of the function. But maybe that's ok..

This revision was automatically updated to reflect the committed changes.