From: "mtasaka (Mamoru Tasaka)" Date: 2012-11-10T19:41:20+09:00 Subject: [ruby-core:49194] [ruby-trunk - Bug #7312] test_str_crypt(TestM17NComb) fails Issue #7312 has been updated by mtasaka (Mamoru Tasaka). Test case: #define _XOPEN_SOURCE #include #include #include #include int main(void){ const char *key = ""; const char *salt = "\xa1\xa1"; char *ret = crypt(key, salt); int errno_save = errno; printf("crypt returned val: %p\n", ret); if (!ret){ printf("Errno: %d %s\n", errno_save, strerror(errno_save)); } while (ret && *ret){ printf("char: %c\n", *ret++); } return 0; } With glibc 2.16-20.fc18.i686 $ gcc -Wall -Wextra -O2 -g -o test-crypt test-crypt.c -lcrypt && ./test-crypt crypt returned val: 0x45b83140 char: ��� char: ��� char: z char: U char: w char: S char: p char: 9 char: H char: 4 char: n char: 3 char: Y With glibc 2.16.90-28.fc19.i686 gcc -Wall -Wextra -O2 -g -o test-crypt test-crypt.c -lcrypt && ./test-crypt crypt returned val: (nil) Errno: 22 Invalid argument Note "Invalid argument". man 3p crypt says: ------------------------------------------------ The salt argument is a string chosen from the set: a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 . / ------------------------------------------------ so "STRINGS" in test/ruby/test_m17n_comb.rb seems what should not passed to salt argument for crypt(3). ---------------------------------------- Bug #7312: test_str_crypt(TestM17NComb) fails https://bugs.ruby-lang.org/issues/7312#change-32744 Author: vo.x (Vit Ondruch) Status: Feedback Priority: Normal Assignee: naruse (Yui NARUSE) Category: Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-09 trunk 37589) [x86_64-linux] =begin test_str_crypt(TestM17NComb): ArgumentError: NULL pointer given /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/test_m17n_comb.rb:728:in `crypt' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/test_m17n_comb.rb:728:in `block in test_str_crypt' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:83:in `block in each' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:75:in `block in each_index' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:46:in `block in make_large_block' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:26:in `block (2 levels) in make_basic_block' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:21:in `times' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:21:in `block in make_basic_block' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:20:in `times' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:20:in `make_basic_block' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:45:in `make_large_block' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:71:in `each_index' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/allpairs.rb:82:in `each' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/test_m17n_comb.rb:60:in `combination' /builddir/build/BUILD/ruby-2.0.0-r37564/test/ruby/test_m17n_comb.rb:723:in `test_str_crypt' =end -- http://bugs.ruby-lang.org/