https://bugs.winehq.org/show_bug.cgi?id=56647
Bug ID: 56647 Summary: ntdll-Junction_Points prevent rustup from correctly installing a toolchain Product: Wine-staging Version: 9.8 Hardware: x86-64 URL: https://rustup.rs/ OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: lorenzofer@live.it CC: leslie_alistair@hotmail.com, z.figura12@gmail.com Distribution: ArchLinux
Created attachment 76423 --> https://bugs.winehq.org/attachment.cgi?id=76423 return STATUS_NOT_A_REPARSE_POINT instead of STATUS_INVALID_PARAMETER
Hi. With the recent rustup 1.27.0 using wine-staging with the ntdll-Junction_Points patches, the toolchain installation doesn't complete properly, failing to write to the settings.toml under the prefix home .rustup directory info.
A bug with the same root cause is also present on rustup 1.26.0 where while the installation was completing properly, it was failing to remove the .rustup/tmp/* directories, causing issues with subsequent installations.
Both bugs express the same behavioral pattern with few differences. I investigated the directory bug firstly, so I will detail this, and confirmed that the problem and the expected solution are the same.
Rustup (or one of it's dependency managing files) get the handle of the temporary directory using CreateFileW and then checking if it's a reparse point using DeviceIoControl with FSCTL_GET_REPARSE_POINT. The directories (and the file) aren't reparse points at all, so the readlink fails returining EINVAL. This EINVAL is then mapped to an NT_STATUS using errno_to_status that map EINVAL to STATUS_INVALID_PARAMETER. However this mapping is incorrect for FSCTL_GET_REPARSE_POINT as in this case applications that handle this case like rustup try to handle this case by epxecting STATUS_NOT_A_REPARSE_POINT.
Returning STATUS_NOT_A_REPARSE_POINT in this case allow rustup to work (both versions )
Attaching a patch to show the change in the file.c code (and restored also the out_buffer check)