[Support] Fix 'keeping' temporary files on Windows 7
As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0 and here: https://github.com/rust-lang/rust/issues/81051 since 79657e23, some programs such as llvm-ar don't work properly on Windows 7. The issue is shown in the snippet by Oleksandr Prodan: https://pastebin.com/v51m3uBU In essence, once the 'DeleteFile' flag has been set on FILE_DISPOSITION_INFO, the file path can't be queried anymore with GetFinalPathNameByHandleW. This however works on Windows 10, GetFinalPathNameByHandleW would return sucessfully. To workaround the issue, we simply reset the 'DeleteFile' flag before even checking if we're dealing with a network file. Tested with `llvm-ar r empty.a a.obj` ran on a network mount. At the moment, we cannot specifically add a test coverage for this, since it requres mounting a network drive.
parent
7d91d81c
Please register or sign in to comment