Bug #7828

invalid glibcver in test_m17n_comb.rb:test_str_crypt fails 2.17 system

Added by Jon Forums over 2 years ago. Updated over 2 years ago.

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


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"]}/libc.so.6[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.').map(&:to_i)

because libc.so.6 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/libc.so.6 (v2.15)

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

Ubuntu Server 12.10 64bit:
/lib/x86_64-linux-gnu/libc.so.6 (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/libc.so.6 | 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 RbConfig::CONFIG["libdir"]'
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,libruby.so.2.0 -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" ruby/test_m17n_comb.rb
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 crypt'
block in test_str_crypt'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:83:in block in each'
block in each_index'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:46:in block in make_large_block'
block (2 levels) in make_basic_block'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:21:in times'
block in make_basic_block'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:20:in times'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:45:in make_large_block'
/home/jon/rubydev/ruby-svn/test/ruby/allpairs.rb:82:in each'
/home/jon/rubydev/ruby-svn/test/ruby/test_m17n_comb.rb:730:in `test_str_crypt'

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

Errno::EINVAL: Invalid argument - crypt
(ripl):2:in crypt'

Associated revisions

Revision 39209
Added by Yui NARUSE over 2 years ago

Get libc's path by ldd [Bug #7828]

Revision 39209
Added by Yui NARUSE over 2 years ago

Get libc's path by ldd [Bug #7828]


#1 Updated by Yui NARUSE over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39209.
Jon, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Get libc's path by ldd [Bug #7828]

Also available in: Atom PDF