https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-09-23T21:35:14ZRuby Issue Tracking SystemRuby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=135062010-09-23T21:35:14Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>tenderlovemaking (Aaron Patterson)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=138222010-10-19T04:57:12Ztenderlovemaking (Aaron Patterson)tenderlove@ruby-lang.org
<ul></ul><p>=begin<br>
I can't reproduce this on my PPC machine.</p>
<p>Can you provide the output of 'make test-all TESTS=fiddle' and 'make test-all TESTS=dl' on the sparc64 machine?</p>
<p>DL is known to have problems on 64bit machines without Fiddle. I suspect that fiddle was not built on this machine.</p>
<p>Thanks!<br>
=end</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=148702010-12-26T14:53:17Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Feedback</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>3</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201582011-08-08T21:16:49Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Rejected</i></li></ul><p>I close this as Rejected since no feedback provided.<br>
Please reopen this if it still happens on the latest version of ruby.</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201592011-08-08T22:30:28Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>File</strong> <i>fiddle-sparcv9.patch</i> added</li><li><strong>Status</strong> changed from <i>Rejected</i> to <i>Open</i></li><li><strong>Priority</strong> changed from <i>3</i> to <i>Normal</i></li><li><strong>ruby -v</strong> changed from <i>ruby 1.9.2p0 (2010-08-18 revision 29036) [sparc64-openbsd4.8]</i> to <i>ruby 1.9.4dev (2011-08-05 trunk 32863) [sparc64-solaris2.10]</i></li></ul><p>This is also reproduced on sparc64 Solaris10 with latest Ruby.<br>
This is not because of endian, nor libffi bug, but a bug of Fiddle.<br>
Patch is attached.</p>
<p>The manpage of ffi_call(3) (<a href="http://linux.die.net/man/3/ffi_call" class="external">http://linux.die.net/man/3/ffi_call</a> ) says:<br>
"rvalue must point to storage that is sizeof(long) or larger. For smaller return value sizes, the ffi_arg or ffi_sarg integral type must be used to hold the return value."<br>
but Fiddle did not use ffi_arg nor ffi_sarg for getting the "rvalue" after ffi_call and closure callback.</p>
<p>Note that value_to_generic and generic_to_value are asymmetric after the patch.<br>
In addition, to avoid potential bug in big-endian architecture, the patch also modifies value_to_generic() to strictly distinguish char, short and int.</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201602011-08-08T22:37:53Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/1975">fiddle-sparcv9.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/1975/fiddle-sparcv9.patch">fiddle-sparcv9.patch</a> added</li></ul><p>Patch attached again.<br>
The previous patch contains mistakes and garbage.</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201612011-08-08T23:03:53Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>File</strong> deleted (<del><i>fiddle-sparcv9.patch</i></del>)</li></ul> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201632011-08-09T06:23:08Ztenderlovemaking (Aaron Patterson)tenderlove@ruby-lang.org
<ul><li><strong>ruby -v</strong> changed from <i>ruby 1.9.4dev (2011-08-05 trunk 32863) [sparc64-solaris2.10]</i> to <i>-</i></li></ul><p>On Mon, Aug 08, 2011 at 10:37:53PM +0900, Naohisa Goto wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Endian bugs in fiddle/dl on sparc64 (Closed)" href="https://redmine.ruby-lang.org/issues/3861">#3861</a> has been updated by Naohisa Goto.</p>
<p>File fiddle-sparcv9.patch added</p>
<p>Patch attached again.<br>
The previous patch contains mistakes and garbage.</p>
</blockquote>
<p>Please apply these to trunk. I think it should also be applied to the<br>
1.9.3 branch.</p>
<p>Thanks.</p>
<p>--<br>
Aaron Patterson<br>
<a href="http://tenderlovemaking.com/" class="external">http://tenderlovemaking.com/</a></p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201762011-08-09T14:31:48Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r32895.<br>
Jeremy, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>ext/fiddle/conversions.c (generic_to_value): ffi_arg and ffi_sarg<br>
should be used to handle shorter return value. fix [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Endian bugs in fiddle/dl on sparc64 (Closed)" href="https://redmine.ruby-lang.org/issues/3861">#3861</a>]<br>
<a href="/issues/3861">[ruby-core:32504]</a></li>
<li>ext/fiddle/closure.c (callback): ditto</li>
<li>ext/fiddle/conversions.h (fiddle_generic): ditto</li>
<li>ext/fiddle/conversions.c (value_to_generic): char, short and int<br>
are strictly distinguished on big-endian CPU, e.g. sparc64.</li>
</ul> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=201772011-08-09T14:38:11Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li><li><strong>Target version</strong> set to <i>1.9.3</i></li></ul><p>re-open this issue for the reminder whether it is backported to 1.9.3 or not.</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=203402011-08-20T19:11:23Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li></ul><p>Aaron, I think it's ok to backport. But I'd respect your opinion. Please decide it.</p>
<p>Thanks.</p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=203422011-08-21T04:23:07Ztenderlovemaking (Aaron Patterson)tenderlove@ruby-lang.org
<ul></ul><p>On Sat, Aug 20, 2011 at 07:11:23PM +0900, Motohiro KOSAKI wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Endian bugs in fiddle/dl on sparc64 (Closed)" href="https://redmine.ruby-lang.org/issues/3861">#3861</a> has been updated by Motohiro KOSAKI.</p>
<p>Status changed from Open to Assigned</p>
<p>Aaron, I think it's ok to backport. But I'd respect your opinion. Please decide it.</p>
</blockquote>
<p>Yes, I think it's fine. Please commit to the 1.9.3 branch! :-)</p>
<p>--<br>
Aaron Patterson<br>
<a href="http://tenderlovemaking.com/" class="external">http://tenderlovemaking.com/</a></p> Ruby master - Bug #3861: Endian bugs in fiddle/dl on sparc64https://redmine.ruby-lang.org/issues/3861?journal_id=203442011-08-21T11:43:09Zngoto (Naohisa Goto)ngotogenome@gmail.com
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>I've just committed with r33015. close the issue now</p>