[#84867] [Ruby trunk Bug#14357] thread_safe tests suite segfaults — v.ondruch@...
Issue #14357 has been reported by vo.x (Vit Ondruch).
11 messages
2018/01/15
[#85364] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
v.ondruch@tiscali.cz wrote:
[#85368] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
Eric Wong wrote:
[#85442] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/06
Eric Wong <normalperson@yhbt.net> wrote:
[#85451] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Vladimir Makarov <vmakarov@...>
2018/02/06
On 02/06/2018 05:00 AM, Eric Wong wrote:
[#84874] [Ruby trunk Bug#14360] Regression CSV#open method for writing from Ruby 2.4.3 to 2.5.0 — shevegen@...
Issue #14360 has been updated by shevegen (Robert A. Heiler).
3 messages
2018/01/15
[#84980] [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — hsbt@...
Issue #13618 has been updated by hsbt (Hiroshi SHIBATA).
10 messages
2018/01/23
[#85012] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/23
hsbt@ruby-lang.org wrote:
[#85081] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
Eric Wong <normalperson@yhbt.net> wrote:
[#85082] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
> Thinking about this even more; I don't think it's possible to
[#85088] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — danieldasilvaferreira@...
Issue #13618 has been updated by dsferreira (Daniel Ferreira).
3 messages
2018/01/25
[#85107] [Ruby trunk Misc#14222] Mutex.lock is not safe inside signal handler: what is? — eregontp@...
Issue #14222 has been updated by Eregon (Benoit Daloze).
3 messages
2018/01/25
[#85136] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — Eric Wong <normalperson@...>
samuel@oriontransfer.org wrote:
3 messages
2018/01/26
[ruby-core:84693] [Ruby trunk Bug#14260] test failure related with proc arity on 32-bit environment (e.g. Solaris 10 with 32-bit compile)
From:
naruse@...
Date:
2018-01-07 22:25:36 UTC
List:
ruby-core #84693
Issue #14260 has been updated by naruse (Yui NARUSE).
Backport changed from 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE
ruby_2_5 r61660 merged revision(s) 61518.
----------------------------------------
Bug #14260: test failure related with proc arity on 32-bit environment (e.g. Solaris 10 with 32-bit compile)
https://bugs.ruby-lang.org/issues/14260#change-69407
* Author: ngoto (Naohisa Goto)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE
----------------------------------------
おそらく r59358 以降、sparc の Solaris 10 上の Oracle Developer Studio (Oracle Solaris Studio) 12.x にて 32ビットでコンパイルした際、
make test-all にて以下のような failure が出るようになりました。
(以下は r61515 での結果)
~~~
1) Failure:
TestLazyEnumerator#test_each_cons_limit [/XXXXX/test/ruby/test_lazy_enumerator.rb:548]:
<[[1, 2], [2, 3]]> expected but was
<[[2, 3], [2, 3]]>.
2) Failure:
TestProc#test_bound_parameters [/XXXXX/test/ruby/test_proc.rb:1184]:
<[[:rest]]> expected but was
<[]>.
3) Failure:
TestEnumerator#test_cons [/XXXXX/test/ruby/test_enumerator.rb:118]:
<[[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9],
[8, 9, 10]]> expected but was
<[[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10],
[8, 9, 10]]>.
4) Failure:
TestEnumerator#test_slice [/XXXXX/test/ruby/test_enumerator.rb:113]:
<[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]> expected but was
<[[10], [10], [10], [10]]>.
(中略)
6) Failure:
TestProc#test_arity2 [/XXXXX/test/ruby/test_proc.rb:439]:
<-1> expected but was
<0>.
7) Failure:
TestLazyEnumerator#test_each_slice_limit [/XXXXX/test/ruby/test_lazy_enumerator.rb:554]:
<[[1, 2], [3, 4]]> expected but was
<[[3, 4], [3, 4]]>.
(後略)
~~~
結論から言うと以下のパッチで治りました。
ビットフィールドのデフォルトは unsigned int というのがCの規格にて定められていますが、
max に -1 (マクロ UNLIMITED_ARGUMENTS の値)が代入される場合があり、
これが unsigned int : 16 では 65535 が代入されたのと同じビット列になり、
それを再度 signed int に戻す際に、そのまま 65535 が戻され、つまり意図しない値に化けてしまい、
(ここらへんの処理は、Cの規格ではおそらく処理系依存とされていると思います)
arityを UNLIMITED_ARGUMENTS や 0 と比較する判定結果が異常になり、
上記のFailureが発生したようです。
なお、64ビットでコンパイルすると `#else` 以下の `int min, max;` が使われ、ビットフィールドではなくなるため、このFailreは発生しません。
また、gcc では 16 ビットのまま符号ありの -1 にしてから戻してくれる(場合もある?)ようで、(大部分の?)Failureは発生しないようです(が一部おかしい部分があったっぽい?)。
~~~
--- internal.h (revision 61515)
+++ internal.h (working copy)
@@ -912,12 +912,12 @@
/* IFUNC (Internal FUNCtion) */
struct vm_ifunc_argc {
#if SIZEOF_INT * 2 > SIZEOF_VALUE
- int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
- int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
+ signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
+ signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
#else
int min, max;
#endif
};
~~~
今回、Failureが発生したのは Solaris だけですが、全ての32ビット環境にて潜在的に問題が発生する可能性があるコードだったと言えます。
そして、ビットフィールドでメモリを節約している箇所は他にも複数あると思いますが、unsigned int 扱いで確かに正しいか、負の値を意図せず代入していないか、念のため総点検する必要があるかもしれないと思いました。
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>