Forum: Ruby-core [ruby-trunk - Bug #7828][Open] invalid glibcver in test_m17n_comb.rb:test_str_crypt fails 2.17 syste

C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 jonforums (Jon Forums) (Guest)
on 2013-02-11 20:33
(Received via mailing list)
Issue #7828 has been reported by jonforums (Jon Forums).

Bug #7828: invalid glibcver in test_m17n_comb.rb:test_str_crypt fails
2.17 system

Author: jonforums (Jon Forums)
Status: Open
Priority: Normal
Category: test
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-12 trunk 39207) [i686-linux]

On my Arch 3.7.6 32bit system with a 2.17 libc, the following line in
`test_m17n_comb.rb:test_str_crypt` causes the test to fail

  glibcver = `#{RbConfig::CONFIG["libdir"]}/`[/\AGNU C
Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)

because doesn't exist in `RbConfig::CONFIG["libdir"]`. As
such, invalid salt values aren't skipped and `String#crypt` fails due to
an invalid "__" (underscore underscore) salt value.

Details of the failure are shown below (ignore the line numbers as I
instrumented the test), but the following are the libc locations for my
systems of interest:

  Ubuntu Server 12.10 32bit:
    /lib/i386-linux-gnu/ (v2.15)

  Arch 3.7.6 32bit:
    /usr/lib/ (v2.17)

  Ubuntu Server 12.10 64bit:
    /lib/x86_64-linux-gnu/ (v2.15)

Failure details

[jon@archee build]$ uname -a
Linux archee 3.7.6-1-ARCH \#1 SMP PREEMPT Mon Feb 4 10:21:12 CET 2013
i686 GNU/Linux

[jon@archee build]$ /usr/lib/ | head -1
GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath
et al.

[jon@archee build]$ ruby -rrbconfig -v -e 'puts
ruby 2.0.0dev (2013-02-12 trunk 39207) [i686-linux]

[jon@archee build]$ make test-all TESTS="ruby/test_m17n_comb.rb"
        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra
-Wno-unused-parameter -Wno-parentheses -Wno-long-long
-Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith
-Werror=write-strings -Werror=declaration-after-statement
-Werror=implicit-function-declaration -ansi -std=iso9899:199409  -fPIC
        XCFLAGS = -include ruby/config.h -include ruby/missing.h
-D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow
-fvisibility=hidden -DRUBY_EXPORT
        CPPFLAGS =   -I. -I.ext/include/i686-linux -I../include -I..
        DLDFLAGS = -Wl,-soname, -fstack-protector
        SOLIBS = -lpthread -lrt -ldl -lcrypt -lm
./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext
-- --disable-gems "../test/runner.rb" --ruby="./miniruby -I../lib -I.
-I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems"
Run options: "--ruby=./miniruby -I../lib -I. -I.ext/common
../tool/runruby.rb --extout=.ext  -- --disable-gems"

# Running tests:

[27/77] TestM17NComb#test_str_crypt
RbConfig::CONFIG['libdir'] = /usr/local/lib
glibcver = , strict_crypt =
salt_orig = ¡¡, salt_orig.length = 1
salt = ¡¡, salt.length = 2
 = 0.01 s
  1) Error:
Errno::EINVAL: Invalid argument - crypt
    /home/jon/rubydev/ruby-svn/test/ruby/test_m17n_comb.rb:744:in `block
in test_str_crypt'
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:83:in `block in
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:75:in `block in
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:46:in `block in
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:26:in `block (2
levels) in make_basic_block'
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:21:in `times'
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:21:in `block in
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:20:in `times'
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:71:in `each_index'
    /home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:82:in `each'

Finished tests in 7.171895s, 10.7364 tests/s, 29005.8640 assertions/s.
77 tests, 208027 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.0.0dev (2013-02-12 trunk 39207) [i686-linux]

[jon@archee build]$ ripl
>> ''.crypt('__')
Errno::EINVAL: Invalid argument - crypt
    (ripl):2:in `crypt'
    (ripl):2:in `<main>'
This topic is locked and can not be replied to.