Open eregon opened 1 year ago
@MSP-Greg Could you show what bin/bundle
looks like on mswin
, head
or 3.1
after gem install bundler
? I guess it starts with #!/usr/bin/env ruby
like the file on mingw
/ucrt
?
Actually it must be a CRuby bug, at least for the header if bin/bundle: https://bugs.ruby-lang.org/issues/18970
Does RubyInstaller2 do anything special about bin/bundle
etc?
Actually it must be a CRuby bug
Yes, it hard codes the path in the bash binstub. Maybe the fix should be something packagers (Lars & myself) handle?
I did look at this, and the question is how should bash binstubs behave if one has multiple Ruby installs. IOW, Ruby A is in PATH, but one runs the binstub in Ruby B?
Or, should we just make all bash binstubs start with the following?
#!/usr/bin/env ruby
I did look at this, and the question is how should bash binstubs behave if one has multiple Ruby installs. IOW, Ruby A is in PATH, but one runs the binstub in Ruby B?
IMHO this never works properly (one need the given Ruby first in PATH, and using an absolute path to a binstub feels wrong anyway), and specifically it does not work for new executables installed by gems, which will just start with #!/usr/bin/env ruby
.
Maybe for bin/gem
it's reasonable to look at the sibling bin/ruby
, but for any gem binstub I think it should be exactly the same as if RubyGems installed it, so there is no difference between gems shipped-with-Ruby-and-not-reinstalled-yet and all other gems.
Or, should we just make all bash binstubs start with the following?
I think so, yes.
More findings on https://bugs.ruby-lang.org/issues/18970, notably 3.0.4 does not have bin/bundle
and bin/bundle.bat
, only bin/bundle.cmd
.
What problems are you experiencing?
This is from https://github.com/ruby/setup-ruby/issues/371.
bundle
does not work in a Bash shell on Windows -- without an extragem install bundler
--, and the reason is some RubyInstaller2 releases either do not ship with abin/bundle
, it has the wrong permissions and the wrong start.Steps to reproduce
I downloaded all latest releases from https://github.com/ruby/setup-ruby/blob/master/windows-versions.json and extracted them (I'm on Linux FWIW).
Of course only Ruby 2.7+ ships with Bundler, so for <=2.6 it's expected to be missing.
So only 3.1 and head have bin/bundle. But those 2 bin/bundle do not have the executable bit set. They also start like this which sounds invalid for Bash:
On https://github.com/eregon/setup-ruby/runs/7843304711?check_suite_focus=true we can see 3.0, 3.1 and head fail for
echo ~ && which -a bundle
in bash. 2.7 avoids the issue in that CI run because the Bundler version is considered too old by setup-ruby and sogem install bundler
is done there.This may be a CRuby issue, I am not sure (EDIT: most likely, I filed https://bugs.ruby-lang.org/issues/18970).
Maybe related to https://github.com/oneclick/rubyinstaller2/issues/180
mswin
also fails but that's a build from @MSP-Greg.bin/bundle
exists and is executable, but the contents looks not valid for Bash:mingw
anducrt
builds by @MSP-Greg do work, and theirbin/bundle
starts like: