postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.9k stars 252 forks source link

macOS JRuby fails on cp with src dir #423

Open esotericpig opened 2 years ago

esotericpig commented 2 years ago

(Sorry on mobile, so accidentally sent original bug without description.)

Description

On macOS if install JRuby like this:

$ mkdir temp
$ ruby-install -s temp jruby

Fails on copy_into function:

cp: temp/jruby-9.3.4.0/*: No such file or directory

I added a pwd to copy_into in util.sh, and I see that it actually CDed into that directory:

pwd
/Users/.../temp/jruby-9.3.4.0

So workaround is to use full, absolute path (instead of relative). Interestingly though, just using temp works for installing ruby.

Don't know if this is by design or not.

Environment

postmodern commented 1 year ago

This is because bin/ruby-install cds into $src_dir/$ruby_dir_name. So if the src_dir is relative, it won't be able to find the $src_dir/$ruby_dir_name while within $src_dir/$ruby_dir_name. We could change the copy_into call to copy the current directory, or replace install_ruby of jruby with better logic that is specifically for installing binary or pre-compiled rubies.