Bug #14322
closed
Inconsitency in command line options between 2.4 and 2.5
Added by graywolf (Gray Wolf) about 7 years ago.
Updated over 6 years ago.
Description
How command-line options are handled was changed between 2.4 and 2.5
[ wolf@ws ] :: ~
Load: 0.33 2.40 3.64 , Memory: 4.48 %, Disk: 77.69 %
$ ruby -rubygems -e 'puts Gem.user_dir'
Traceback (most recent call last):
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- ubygems (LoadError)
[ wolf@ws ] :: ~
Load: 0.28 2.33 3.60 , Memory: 4.48 %, Disk: 77.69 %
:( $ ruby -rrubygems -e 'puts Gem.user_dir'
/home/wolf/.gem/ruby/2.5.0
[ wolf@ws ] :: ~
Load: 0.18 2.14 3.50 , Memory: 4.48 %, Disk: 77.69 %
$ ruby-2.4 -rubygems -e 'puts Gem.user_dir'
/home/wolf/.gem/ruby/2.4.0
[ wolf@ws ] :: ~
Load: 0.40 2.12 3.48 , Memory: 4.49 %, Disk: 77.69 %
$ ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
[ wolf@ws ] :: ~
Load: 0.41 1.57 3.12 , Memory: 4.63 %, Disk: 77.69 %
$ ruby-2.4 --version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
was this intentional?
Files
- Status changed from Open to Rejected
Yes, ubygems.rb was removed intentionally. This is mentioned in the NEWS file for 2.5.0.
Hm, guess I should read not only the web version but also the detailed one. Guess this wasn't "notable" enough. Thx :)
We must not break existing use cases (including commands which
may show up in shell scripts and Makefiles) without deprecation
warnings.
- Status changed from Open to Rejected
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
It's an intentional change. I have no plan to revert it.
out of curiosity, why there was no deprecation phase for this change?
yeeey, +1 for not silently breaking stuff :)
Run this script with a shell to workaround the issue:
#!/bin/sh
# Copyright:: 2018 Daniel Barrows
# License:: zlib/libpng
# https://gist.github.com/daniel-barrows/ca8359b76ad9bb84b37593a9f7b695fc
# Leave warn variable empty to not output the deprecation warning.
warn=true
if ruby -e exit 2>&1 \
| grep 'cannot load such file -- ubygems (LoadError)' >/dev/null; then
which sudo >/dev/null 2>&1 && sudo=sudo
ruby_lib_dir="$( ruby -e 'exit 0' 2>&1 | grep 'cannot load such file' \
| sed 's,/rubygems/core_ext.\+,,' )"
if ! [ -z "$warn" ]; then
warning_msg="warn 'WARNING: -rubygems flag is deprecated. Use -rrubygems.'"
fi
printf "#!/usr/bin/env ruby\n%s\nrequire 'rubygems'\n" "$warning_msg" \
| $sudo tee "$ruby_lib_dir/ubygems.rb" > /dev/null
fi
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0