ruby / setup-ruby

An action to download a prebuilt Ruby and add it to the PATH in 5 seconds
https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
MIT License
798 stars 257 forks source link

mswin builds are missing bundle executable in Bash #658

Open eregon opened 3 days ago

eregon commented 3 days ago

https://github.com/ruby/setup-ruby/actions/runs/11391394046/job/31695188901?pr=657

Run which -a ruby bundle
which: no bundle in (/d/ruby-mswin/bin:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/VCPackages:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TestWindow:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/bin/Roslyn:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools/x64:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Team Tools/Performance Tools:/c/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019/x64:/c/Program Files (x86)/Microsoft Visual Studio/Shared/Common/VSPerfCollectionTools/vs2019:/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools/x64:/c/Program Files (x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/FSharp/Tools:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/devinit:/c/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64:/c/Program Files (x86)/Windows Kits/10/bin/x64:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin:/c/Windows/Microsoft.NET/Framework64/v4.0.30319:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja:/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/VC/Linux/bin/ConnectionManagerExe:/ucrt64/bin:/usr/bin:/c/Program Files/MongoDB/Server/5.0/bin:/c/aliyun-cli:/c/vcpkg:/c/cf-cli:/c/Program Files (x86)/NSIS:/c/tools/zstd:/c/Program Files/Mercurial:/c/hostedtoolcache/windows/stack/3.1.1/x64:/c/cabal/bin:/c/ghcup/bin:/c/mingw64/bin:/c/Program Files/dotnet:/c/Program Files/MySQL/MySQL Server 5.7/bin:/c/Program Files/R/R-4.4.1/bin/x64:/c/SeleniumWebDrivers/GeckoDriver:/c/SeleniumWebDrivers/EdgeDriver:/c/SeleniumWebDrivers/ChromeDriver:/c/Program Files (x86)/sbt/bin:/c/Program Files (x86)/GitHub CLI:/c/Program Files/Git/bin:/c/Program Files (x86)/pipx_bin:/c/npm/prefix:/c/hostedtoolcache/windows/go/1.21.13/x64/bin:/c/hostedtoolcache/windows/Python/3.7.9/x64/Scripts:/c/hostedtoolcache/windows/Python/3.7.9/x64:/c/Program Files/OpenSSL/bin:/c/tools/kotlinc/bin:/c/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.422-5/x64/bin:/c/Program Files/ImageMagick-7.1.1-Q16-HDRI:/c/Program Files/Microsoft SDKs/Azure/CLI2/wbin:/c/ProgramData/kind:/c/Program Files/Eclipse Foundation/jdk-8.0.302.8-hotspot/bin:/c/ProgramData/Chocolatey/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/PowerShell/7:/c/Program Files/Microsoft/Web Platform Installer:/c/Program Files/TortoiseSVN/bin:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn:/c/Program Files (x86)/WiX Toolset v3.14/bin:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files (x86)/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/160/DTS/Binn:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/ProgramData/chocolatey/lib/pulumi/tools/Pulumi/bin:/c/Program Files/CMake/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.8.7/bin:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/c/Program Files/nodejs:/c/Program Files/Git/cmd:/c/Program Files/Git/mingw64/bin:/c/Program Files/Git/usr/bin:/c/Program Files/GitHub CLI:/c/tools/php:/c/Program Files (x86)/sbt/bin:/c/Program Files/Amazon/AWSCLIV2:/c/Program Files/Amazon/SessionManagerPlugin/bin:/c/Program Files/Amazon/AWSSAMCLI/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files (x86)/Microsoft BizTalk Server:/c/Program Files/LLVM/bin:/c/Users/runneradmin/.dotnet/tools:/c/Users/runneradmin/.cargo/bin:/c/Users/runneradmin/AppData/Local/Microsoft/WindowsApps)
/d/ruby-mswin/bin/ruby

cc @MSP-Greg

MSP-Greg commented 3 days ago

@eregon

For a long time, ruby-loco had code to modify the binstubs in all windows builds. On 10-Oct, I removed it, as RubyGems/Bundler updated their code. I'm looking at it. Also, I'm adding which -a ruby bundle gem to the ruby-loco CI.

MSP-Greg commented 3 days ago

@eregon

This is kind of strange, and I could repro it locally. Now that I check the title, it's not correct. The issue is that which cannot find the bundle executable. My ruby-loco has checked several of the bash binstubs for a long time.

What's being called a 'prolog' was added to the Windows binstubs, and allows the following (done with a PWD that might as well be HOME). Used the MSYS2 bash shell):

This shows the Ruby in PATH (ucrt):

$ ruby -v
ruby 3.4.0dev (2024-10-17T15:21:34Z master a7317f53e0) +PRISM [x64-mingw-ucrt]

This also uses the Ruby in PATH, and shows ucrt folders & Ruby.

$ bundle env
## Environment

Bundler       2.6.0.dev
  Platforms   ruby, x64-mingw-ucrt
Ruby          3.4.0p-1 (2024-10-18 revision a7317f53e03059c946835d086d8def3f39649a8e) [x64-mingw-ucrt]
  Full Path   C:/ruby-ucrt/bin/ruby.exe
  Config Dir  C:/ProgramData
RubyGems      3.6.0.dev
  Gem Home    C:/ruby-ucrt/lib/ruby/gems/3.4.0+0

This exec's bundle in another Ruby install (hard path), and the prolog switches the Ruby to the Ruby exec in the same folder as the bundle exec, which is the mswin folder:

$ /c/ruby-mswin/bin/bundle env
## Environment

Bundler       2.6.0.dev
  Platforms   ruby, x64-mswin64-140
Ruby          3.4.0p-1 (2024-10-18 revision a7317f53e03059c946835d086d8def3f39649a8e) [x64-mswin64-140]
  Full Path   C:/ruby-mswin/bin/ruby.exe
  Config Dir  C:/ProgramData
RubyGems      3.6.0.dev
  Gem Home    C:/ruby-mswin/lib/ruby/gems/3.4.0+0
eregon commented 2 days ago

Ah so this prolog causes which in Windows Bash to think it's not a proper executable? (maybe it no longer starts with a shebang?) I think that's something worth reporting to https://bugs.ruby-lang.org/ , could you do that?