summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-20 09:38:11 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-20 09:38:11 +0000
commitd92d9a2661d62faf4a95a400109fd0c9f0ece256 (patch)
tree0328c5ffbd0a3d2ad0c530f0f5547bf15858ee4d /test
parente85d6f8bf96adf655627d82888527e572e030f11 (diff)
merge revision(s) 37572,37622,37766,37773: [Backport #7527]
* string.c (rb_str_crypt): crypt(3) may return NULL. Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312] * test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get libc's directory. Patched by Vit Ondruch [ruby-core:49763] [Bug #7312] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n_comb.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 79016afc07..6eec6a6bea 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -777,7 +777,17 @@ class TestM17NComb < Test::Unit::TestCase
end
def test_str_crypt
+ begin
+ # glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
+ glibcver = `#{RbConfig::CONFIG["libdir"]}/libc.so.6`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)
+ strict_crypt = (glibcver <=> [2, 16]) > -1
+ rescue
+ end
+
combination(STRINGS, STRINGS) {|str, salt|
+ if strict_crypt
+ next unless salt.ascii_only? && /\A[0-9a-zA-Z.\/]+\z/ =~ salt
+ end
if a(salt).length < 2
assert_raise(ArgumentError) { str.crypt(salt) }
next