sh_binary rule for windows is incorrectly trying to resolve symlinks during remote execution
- Dominant language
- Rust
- Stars
- 4.4k
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
On windows the sh_binary rule is incorrectly trying to resolve symlinks directly, causing paths to not be correct on the re environment that we have setup:
https://github.com/facebook/buck2/blob/2214ec241cefe357faf499e30b26629ce6728c8c/prelude/sh_binary.bzl#L92
As you can see, this ends up traversing to the parent on the cache, which doesn't translate to it being the parent directory of the other files:
```
Action failed: toolchains//:test_re (test)
Remote command returned non-zero exit code 1
stdout:
C:\worker\work\3\0\exec>setlocal EnableDelayedExpansion
C:\worker\work\3\0\exec>set __RESOURCES_ROOT=.\resources
C:\worker\work\3\0\exec>set __SRC=C:\worker\work\3\0\exec\buck-out\v2\gen\prelude\749e8add6e5f1364\python_bootstrap\tools\__win_python_wrapper__\win_python_wrapper.bat
C:\worker\work\3\0\exec>for /F "tokens=2 delims=[]" %a in ('dir C:\worker\work\3\0\exec\buck-out\v2\gen\prelude\749e8add6e5f1364\python_bootstrap\tools\__win_python_wrapper__\win_python_wrapper.bat |C:\Windows\System32\find.exe ""') do set "__SRC=%a"
C:\worker\work\3\0\exec>set "__SRC=\\?\C:\worker\cas\77\7786b38fdc6164bc83a39fa48e33d783a9560d386c7a765d5e09f777ff3d9c71"
C:\worker\work\3\0\exec>for %a in ("\\?\C:\worker\cas\77\7786b38fdc6164bc83a39fa48e33d783a9560d386c7a765d5e09f777ff3d9c71") do set "__SCRIPT_DIR=%~dpa"
**C:\worker\work\3\0\exec>set "__SCRIPT_DIR=\\?\C:\worker\cas\77\"**
C:\worker\work\3\0\exec>set BUCK_SH_BINARY_VERSION_UNSTABLE=2
C:\worker\work\3\0\exec>set BUCK_PROJECT_ROOT=\\?\C:\worker\cas\77\\.\resources
C:\worker\work\3\0\exec>set BUCK_DEFAULT_RUNTIME_RESOURCES=\\?\C:\worker\cas\77\\.\resources
C:\worker\work\3\0\exec>\\?\C:\worker\cas\77\\.\resources\win_python_wrapper.bat buck-out\v2\gen\prelude\749e8add6e5f1364\cxx\tools\__dep_file_processor__\__dep_file_processor__ buck-out\v2\gen-anon\toolchains\749e8add6e5f1364443bc5d1e95a38d6\__x-python__\out\x-python\python.exe buck-out\v2\gen\prelude\749e8add6e5f1364\cxx\tools\__dep_file_processor__\dep_file_processor.py
stderr:
**The system cannot find the path specified.**
```
This specific step should be removed, or made configurable via an attribute on the rule. Happy to submit a fix for this
Contributor guide
Assessment
This issue has not been assessed yet.