From: nobu@... Date: 2014-12-22T22:45:46+00:00 Subject: [ruby-dev:48766] [ruby-trunk - Bug #466] test_str_crypt(TestM17NComb) failed Issue #466 has been updated by Nobuyoshi Nakada. Description updated ruby -v set to 1.9.0 ---------------------------------------- Bug #466: test_str_crypt(TestM17NComb) failed https://bugs.ruby-lang.org/issues/466#change-50566 * Author: Kazuhiro NISHIYAMA * Status: Closed * Priority: Normal * Assignee: Kazuhiro NISHIYAMA * Category: core * Target version: * ruby -v: 1.9.0 * Backport: ---------------------------------------- ~~~ $ ruby-trunk -v ruby 1.9.0 (2008-08-21 revision 18753) [powerpc-darwin9.4.0] ~~~ の環境でtest_str_crypt(TestM17NComb)がFailureになります。 ~~~ $ ruby-trunk test/ruby/test_m17n_comb.rb -v -n /crypt/ Loaded suite test/ruby/test_m17n_comb Started test_str_crypt(TestM17NComb): F Finished in 0.03673 seconds. 1) Failure: test_str_crypt(TestM17NComb) [test/ruby/test_m17n_comb.rb:800:in `block in test_str_crypt' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:83:in `block in each' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:75:in `block in each_index' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:46:in `block in make_large_block' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:26:in `block (2 levels) in make_basic_block' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:21:in `times' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:21:in `block in make_basic_block' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:20:in `times' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:20:in `make_basic_block' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:45:in `make_large_block' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:71:in `each_index' /Users/nishiyamakazuhiro/wc/ruby-lang/trunk/test/ruby/allpairs.rb:82:in `each' test/ruby/test_m17n_comb.rb:118:in `combination' test/ruby/test_m17n_comb.rb:794:in `test_str_crypt']: "".force_encoding("ASCII-8BIT").crypt("\xE0\xA0\xA1".force_encoding("UTF-8")). <"\xE0\xA0fT7zdRv9Y7A"> expected but was <"\xE0\xA0swiH3o6yAu2">. 1 tests, 55 assertions, 1 failures, 0 errors $ ~~~ ~~~ $ ruby-trunk -ve '3.times{p "".crypt("\xE0\xA0")}' ruby 1.9.0 (2008-08-21 revision 18753) [powerpc-darwin9.4.0] "\xE0\xA0X8NBuQ4l6uQ" "\xE0\xA0fT7zdRv9Y7A" "\xE0\xA0fT7zdRv9Y7A" $ ~~~ のように2回目以降で結果が違うのが原因のようです。 直接crypt(2)を同じ引数で呼んでも同じ結果になります。 ~~~ $ cat a.c ~~~ ~~~c #include #include int main() { printf("%s\n", crypt("", "\xE0\xA0")); printf("%s\n", crypt("", "\xE0\xA0")); printf("%s\n", crypt("", "\xE0\xA0")); return 0; } ~~~ ~~~ $ gcc a.c $ ./a.out |LANG=C cat -v M-`M- X8NBuQ4l6uQ M-`M- fT7zdRv9Y7A M-`M- fT7zdRv9Y7A ~~~ -- https://bugs.ruby-lang.org/