[前][次][番号順一覧][スレッド一覧]

ruby-changes:33915

From: akr <ko1@a...>
Date: Sun, 18 May 2014 16:43:50 +0900 (JST)
Subject: [ruby-changes:33915] akr:r45996 (trunk): * test/ruby/test_m17n_comb.rb (test_str_crypt): Use Etc.confstr to

akr	2014-05-18 16:43:45 +0900 (Sun, 18 May 2014)

  New Revision: 45996

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45996

  Log:
    * test/ruby/test_m17n_comb.rb (test_str_crypt): Use Etc.confstr to
      detect the glibc version.
      libc.so is not an executable on Debian GNU/kFreeBSD 7.0 (wheezy).

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_m17n_comb.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45995)
+++ ChangeLog	(revision 45996)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 18 16:42:08 2014  Tanaka Akira  <akr@f...>
+
+	* test/ruby/test_m17n_comb.rb (test_str_crypt): Use Etc.confstr to
+	  detect the glibc version.
+	  libc.so is not an executable on Debian GNU/kFreeBSD 7.0 (wheezy).
+
 Sun May 18 12:15:54 2014  Jonathan Mukai-Heidt  <johnnymukai@g...>
 
 	* io.c (argf_each_line, argf_inplace_mode_set): [DOC] Update ARGF
Index: test/ruby/test_m17n_comb.rb
===================================================================
--- test/ruby/test_m17n_comb.rb	(revision 45995)
+++ test/ruby/test_m17n_comb.rb	(revision 45996)
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n_comb.rb#L1
 require 'test/unit'
+require 'etc'
 require_relative 'allpairs'
 
 class TestM17NComb < Test::Unit::TestCase
@@ -724,12 +725,11 @@ class TestM17NComb < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n_comb.rb#L725
   end
 
   def test_str_crypt
-    begin
-      # glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
-      glibcpath = `ldd #{RbConfig.ruby}`[/\S+\/libc.so\S+/]
-      glibcver = `#{glibcpath}`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)
-      strict_crypt = (glibcver <=> [2, 16]) > -1
-    rescue
+    strict_crypt = nil
+    # glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
+    if defined? Etc::Etc::CS_GNU_LIBC_VERSION
+      glibcver = Etc.confstr(Etc::CS_GNU_LIBC_VERSION).scan(/\d+/).map(&:to_i)
+      strict_crypt = (glibcver <=> [2, 16]) >= 0
     end
 
     combination(STRINGS, STRINGS) {|str, salt|

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]