Bug #11002


Don't abuse ruby_version

Added by vo.x (Vit Ondruch) about 9 years ago. Updated about 9 years ago.

Target version:


This is what configure help says about ruby_version:

$ ./configure --help

... snip ...

  --with-ruby-version=STR ruby version string for version specific directories
                          [[full]] (full|minor|STR)

So according to this, it might be anything (the STR option).

If you look into history [1], why this configuration variable was introduced, it was IMO introduced to allow installation of several rubies of the same version side by side and it indeed could be anything.

Interesting, as time goes, this variable propagated into RbConfig and various people started to believe that they can trust to this variable and they can do some configuration or whatever based on this value. And recently, even ruby-core people forgot what was once purpose and semantics of the variable and starts to use the variable in various places freely and impose some assumptions [2, 3].

Could you please clean up this mess? The best would be if you can return the original meaning without any restrictions to the configuration option and the variable, although I agree that since the beginning, this was wrongly chosen name.

And just to illustrate, currently you can do:

./configure --with-ruby-version=2.3.333333333
./configure --with-ruby-version=2.3.

while you can't do:

./configure --with-ruby-version=1.8.7
./configure --with-ruby-version=my-special-configuration

since it fails during compilation:

./miniruby -I./lib -I. -I.ext/common  ./enc/make_encmake.rb --builtin-encs="enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o" --builtin-transes="enc/trans/newline.o" --module 
/builddir/build/BUILD/ruby-2.3.0-r50089/rbconfig.rb:6:in `<module:RbConfig>': ruby lib version (1.8.7) doesn't match executable version (2.3.0) (RuntimeError)
	from /builddir/build/BUILD/ruby-2.3.0-r50089/rbconfig.rb:4:in `<top (required)>'
	from /builddir/build/BUILD/ruby-2.3.0-r50089/lib/mkmf.rb:5:in `require'
	from /builddir/build/BUILD/ruby-2.3.0-r50089/lib/mkmf.rb:5:in `<top (required)>'
	from ./enc/make_encmake.rb:8:in `load'
	from ./enc/make_encmake.rb:8:in `<main>' recipe for target '' failed
make: *** [] Error 1


Actions #2

Updated by vo.x (Vit Ondruch) about 9 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

I submitted PR [1] which tries to fix this situation. Basically

  • The "ruby_version" can't be modified by configuration options anymore and it should be always equal to ruby -e 'puts RUBY_VERSION'.
  • The version will always have three digits X.Y.Z. The RUBY_LIB_VERSION_STYLE is explicitly set to 3 now, but it might be good idea to drop the RUBY_LIB_VERSION_STYLE entirely (I can prepare patch if you like).

Could you please consider accepting this PR?


Actions #3

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r50152.

rbconfig.rb: use program version

  •, tool/mkconfig.rb: check the running ruby version in
    rbconfig.rb with the program version, as RUBY_VERSION has never
    been affected by --with-ruby-version option.
    [ruby-core:68639] [Bug #11002]
  • (LIBRUBY_DLDFLAGS): compatibility_version must be
    valid version numbers, not an arbitrary string.
Actions #4

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED
Actions #5

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Backport changed from 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED

Also available in: Atom PDF