Issue #11002 has been reported by Vit Ondruch.

----------------------------------------
Bug #11002: Don't abuse ruby_version
https://bugs.ruby-lang.org/issues/11002

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: trunk
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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.my-ruby
./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:

~~~
generating enc.mk
./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 enc.mk 
/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>'
uncommon.mk:626: recipe for target 'enc.mk' failed
make: *** [enc.mk] Error 1
~~~


[1] https://github.com/ruby/ruby/commit/6bc480e059b0b9a6a24dceaa96e2d0717cceca51
[2] https://github.com/ruby/ruby/commit/7d248667462c240257e0e9ddaf25f372532660d1
[3] https://github.com/ruby/ruby/commit/6268830ba87bf80852f9a30d4cff7ad250c379dd




-- 
https://bugs.ruby-lang.org/