arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[R] `wslify_path` breaks on windows in `create_package_with_all_dependencies`

Open MichalLauer opened this issue 1 year ago • 1 comments

Describe the bug, including details regarding any error messages, version, and platform.

Hello,

First, thanks for this great function and ecosystem. It saved me a lot of headaches and work! :)

I am trying to get all the dependencies for the R package and I am using the function create_package_with_all_dependencies. However, it throws an error on my system:

arrow::create_package_with_all_dependencies()
#> Downloading Arrow source file
#> Warning in system2("bash", c(download_dependencies_sh, download_dir), stdout =
#> download_script, : Exit code was 127
#> Error in arrow::create_package_with_all_dependencies(): Failed to parse versions.txt; view  C:\Users\lauerm\AppData\Local\Temp\RtmpYdNYVl\filec85a851e9c.R for more information

Created on 2024-10-17 with reprex v2.1.1

Now after some investigation, it is caused by the wslify_path here:

https://github.com/apache/arrow/blob/1a323fc91bbbce2f231262a1619d5f15e9cb7762/r/R/install-arrow.R#L218-L220

If I copy the whole function body, and remove these three lines, all works as expected. I reckon it's an issue on my end and simply 'deleting' these three lines won't fix it.

I would be happy to create a PR that fixes this if you have any idea what might cause this. I have WLS installed, but I don't have any distros.

Thanks!

Component(s)

R

MichalLauer avatar Oct 17 '24 08:10 MichalLauer

Hi @MichalLauer, thanks for the report. I can confirm this fails in the same way for me on a Windows machine. I'm not sure when this stopped working but I do believe it worked at some point.

My best guess is that this broke whenever Microsoft added a stub bash.exe to C:\Windows\System32 which (1) is not bash but really just a launcher for WSL and (2) now tricks our script:

https://github.com/apache/arrow/blob/bcb4653c6387a2b22df52a3bbc91317607abdccc/r/R/install-arrow.R#L184-L190

Previously this stopped if you didn't have bash but now continues if you have this bash stub in your %PATH% but then goes on to try to use the stub to run the download script which doesn't work.

I think we assume the user running create_package_with_all_dependencies has Rtools installed which provides bash so I think the best fix here is to change the routine in the above code snippet to detect when bash is this WSL launcher. @assignUser any thoughts on that approach?

amoeba avatar Oct 22 '24 17:10 amoeba