All,

On Fedora 19, Vim's configure script no longer correctly detects
the version of Ruby.  Vim's current algorithm involves the Ruby
expression ``RbConfig::CONFIG['ruby_version']``, which returns a
string such as "1.9.1" on Fedora 17.  On Fedora 19, the above
Ruby expression returns an empty string.

It appears to me that this is due to a change in Fedora.  In the
ticket linked below, the maintainer asserts that querying
``ruby_version`` is incorrect, as that variable can have
arbitrary contents:
https://bugzilla.redhat.com/show_bug.cgi?id=923703#c1

Empirically, I can verify that the behavior has changed.  On
Fedora 17, the query works:

  $ ruby -r rbconfig -e "puts RbConfig::CONFIG['ruby_version']"
  1.9.1

On Fedora 19, this same query prints the empty string.

The following patch changes the Ruby version detection algorithm
to check the ``VERSION`` and ``RUBY_VERSION`` variables as used
earlier in Vim's configure script.  Essentially, the query
becomes::

  $ ruby -e "puts ((VERSION rescue RUBY_VERSION))"
  1.9.3

This works on Fedora 19 as well::

  $ ruby -e "puts ((VERSION rescue RUBY_VERSION))"
  2.0.0

Given that Vim's configure script relies on this same check
to ensure the version is at least "1.6.0", it seems reasonable
to me to use this algorithm (though I'm no Ruby expert).


Here is the patch against Vim 7.4.14:

$ diff -Naur vim-7.4/src/auto/configure{.orig,}
--- vim-7.4/src/auto/configure.orig     2013-08-03 20:00:13.595912341 -0400
+++ vim-7.4/src/auto/configure  2013-08-03 20:02:11.269574272 -0400
@@ -6740,7 +6740,7 @@
         if test -d "$rubyhdrdir/$rubyarch"; then
           RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
         fi
-        rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print
$ruby_rbconfig::CONFIG['ruby_version'].gsub(/\./, '')[0,2]"`
+        rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue
RUBY_VERSION)).gsub(/\./, '')[0,2]"`
         RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
        rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print
$ruby_rbconfig::CONFIG['LIBS']"`
        if test "X$rubylibs" != "X"; then


Thanks,
Michael Henry

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui