https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112013-03-04T14:49:07ZRuby Issue Tracking SystemRuby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=372812013-03-04T14:49:07Zjonforums (Jon Forums)
<ul></ul><p>Did you build tcltk, or install binaries via pacman? This seems wacky if you used pacman, but does <code>file</code> prove /usr/lib/libtcl8.6.so and /usr/lib/libtk8.6.so are 64bit?</p>
<p>Since it crashes so easily, fire up gdb via something like</p>
<p>gdb --args ruby -e "require 'tk'"</p>
<p>run it, and attach the backtrace.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373152013-03-06T04:25:44Zponimas (Alexander Ponimaskin)ponimaskin@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/3577">bt.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3577/bt.txt">bt.txt</a> added</li></ul><p>All packages are installed via packman</p>
<p>/usr/lib/libtcl8.6.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x31a66c5d6eacb77f2a9a220bff2e78a88821167e, not stripped</p>
<p>/usr/lib/libtk8.6.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xdfa2df7ef1e30e3fbe510a294f8fe781415ee964, not stripped</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373682013-03-08T07:45:04Zjonforums (Jon Forums)
<ul></ul><p>One of the committers please assign this to Hidetoshi NAGAI.</p>
<p>Too bad tcltklib.so is stripped and the bt is weak. I bet no one on ruby-core has an Arch x64 system to try to repro/debug the issue, so we need to get better debug info. (Or reproduce it on a Ubuntu x64 system)</p>
<p>Are you able to build ruby? If you did a pacman install of Arch's ruby 1.9.3_p392 package, you should be able to build from source, and tweak <code>configure</code>'s <code>optflags</code> and <code>debugflags</code> to build tcltklib.so with debug info. The default install is to <code>/usr/local</code> so your Arch pkg won't get clobbered if you don't use <code>--prefix</code>.</p>
<p>My Arch x64 system is cmd line only. When I tried to cheat a repro/debug by installing tcl/tk add it's 15 friends, <code>ruby -e "require 'tk'"</code> rightfully failed due to no display. I don't know whether it failed before or after your segv. When I get time, I'll standup a new ArchBang install and try again. It looks as if tcltklib.so could be passing a bad value into the tcl library. Hard to tell from the bt.</p>
<p>Before you try building from source have you pinged the Arch Forum? I'd skimmed posts on Newbie Corner and Installation and didn't see mention of this issue. Have you contacted Arch's ruby packager (Thomas Dziedzic) to confirm whether he's seeing the issue? Given it fails so quickly, I was surprised not to find it in the forums.</p>
<p>Then again, Nagai-san may soon see this issue and swoop in with the solution ;)</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373782013-03-08T14:08:21Znagai (Hidetoshi Nagai)nagai@ai.kyutech.ac.jp
<ul></ul><p>First of all, current Ruby/Tk cannot support Tcl/Tk8.6. Please see [ruby-talk:395829].<br>
But, I don't know whether this trouble belongs to the "tailcall" problem or not.<br>
Does the same trouble occur with Tcl/Tk8.5 ? If so, tcltklib may not follow the changes on Ruby's core.</p>
<p>Of course, I must fix this bug and should support Tcl/Tk8.6.<br>
However, I don't have enough time to work on it,<br>
and unfortunately I have no idea to avoid the "tailcall" problem now.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373812013-03-08T16:25:13Zedmccard (Ed McCardell)edmccard@hotmail.com
<ul></ul><p>Jon: I've just posted to Newbie Corner on the Arch forums. The only other place on the internet that I've seen this is in the forums for the Coursera Programming languages class I'm taking, where several other users have reported it. I'll build ruby/tcl/tk from source tonight with debug info and get a better trace.</p>
<p>Nagai-san: Using the latest version of Arch linux ruby that was built against Tcl/Tk 8.5 works fine (that's ruby 1.9.3 p127). I don't know about the tailcall problem, but on 32-bit Arch linux with Tcl/Tk 8.6, the ruby/tk scripts I run are working without segfault.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373862013-03-08T17:55:29Zedmccard (Ed McCardell)edmccard@hotmail.com
<ul><li><strong>File</strong> <a href="/attachments/3585">bt-debug.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3585/bt-debug.txt">bt-debug.txt</a> added</li></ul><p>Now that I've tried a few more ruby/tk scripts, I see that only a limited subset of tk works on 32-bit under Tk8.6. But in case it's still useful, I've attached a backtrace from gdb using ruby1.9.3p392/tcl8.6/tk8.6 with debug info on 64-bit.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=373952013-03-08T23:24:19Zjonforums (Jon Forums)
<ul></ul><blockquote>
<p>First of all, current Ruby/Tk cannot support Tcl/Tk8.6. Please see [ruby-talk:395829].<br>
But, I don't know whether this trouble belongs to the "tailcall" problem or not.</p>
</blockquote>
<p>Nagai-san: thanks for the info. FYI, while it's not really relevant to Ed's Arch issue, I'm running Tcl/Tk8.6 on Win7 32bit on <code>ruby 1.9.3p393</code> and <code>ruby 2.0.0p19</code> built with mingw-w64 4.7.2 and I've not yet seen any problems with test scripts like <a href="http://pastie.org/6420781" class="external">http://pastie.org/6420781</a></p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=377102013-03-19T10:53:17Znagai (Hidetoshi Nagai)nagai@ai.kyutech.ac.jp
<ul></ul><a name="Could-you-test-the-following-script"></a>
<h2 >Could you test the following script?<a href="#Could-you-test-the-following-script" class="wiki-anchor">¶</a></h2>
<h2>module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end<br>
require 'tk'<br>
Tk.mainloop</h2>
<p>If it works, a bug may exist on handling a Thread.</p>
<p>From: "edmccard (Ed McCardell)" <a href="mailto:edmccard@hotmail.com" class="email">edmccard@hotmail.com</a><br>
Subject: <a href="/issues/8000">[ruby-core:53226]</a> [ruby-trunk - Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: "require 'tk'" segfaults on 64-bit linux with Tk 8.6 (Closed)" href="https://redmine.ruby-lang.org/issues/8000">#8000</a>] "require 'tk'" segfaults on 64-bit linux with Tk 8.6<br>
Date: Fri, 8 Mar 2013 17:55:30 +0900<br>
Message-ID: <a href="mailto:redmine.journal-37386.20130308175529@ruby-lang.org" class="email">redmine.journal-37386.20130308175529@ruby-lang.org</a></p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: "require 'tk'" segfaults on 64-bit linux with Tk 8.6 (Closed)" href="https://redmine.ruby-lang.org/issues/8000">#8000</a> has been updated by edmccard (Ed McCardell).</p>
<p>File bt-debug.txt added</p>
<a name="Now-that-Ive-tried-a-few-more-rubytk-scripts-I-see-that-only-a-limited-subset-of-tk-works-on-32-bit-under-Tk86-But-in-case-its-still-useful-Ive-attached-a-backtrace-from-gdb-using-ruby193p392tcl86tk86-with-debug-info-on-64-bit"></a>
<h2 >Now that I've tried a few more ruby/tk scripts, I see that only a limited subset of tk works on 32-bit under Tk8.6. But in case it's still useful, I've attached a backtrace from gdb using ruby1.9.3p392/tcl8.6/tk8.6 with debug info on 64-bit.<a href="#Now-that-Ive-tried-a-few-more-rubytk-scripts-I-see-that-only-a-limited-subset-of-tk-works-on-32-bit-under-Tk86-But-in-case-its-still-useful-Ive-attached-a-backtrace-from-gdb-using-ruby193p392tcl86tk86-with-debug-info-on-64-bit" class="wiki-anchor">¶</a></h2>
<p>Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: "require 'tk'" segfaults on 64-bit linux with Tk 8.6 (Closed)" href="https://redmine.ruby-lang.org/issues/8000">#8000</a>: "require 'tk'" segfaults on 64-bit linux with Tk 8.6<br>
<a href="https://bugs.ruby-lang.org/issues/8000#change-37386" class="external">https://bugs.ruby-lang.org/issues/8000#change-37386</a></p>
<p>Author: edmccard (Ed McCardell)<br>
Status: Open<br>
Priority: Normal<br>
Assignee:<br>
Category:<br>
Target version:<br>
ruby -v: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]</p>
<p>Using ruby 1.9.3p392 and Tk 8.6.0 on 64-bit Arch Linux, attempting to "require 'tk'" causes a segfault.</p>
<p>To reproduce:<br>
ruby -e "require 'tk'"</p>
<p>The crash log is in the attached file.</p>
<p>Notes:</p>
<ul>
<li>I've heard from a Gentoo user who is having the same problem.</li>
<li>On 32-bit Arch Linux, there is no problem.</li>
</ul>
<p>--<br>
<a href="http://bugs.ruby-lang.org/" class="external">http://bugs.ruby-lang.org/</a></p>
</blockquote> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=377112013-03-19T11:09:03Zedmccard (Ed McCardell)edmccard@hotmail.com
<ul></ul><a name="That-script"></a>
<h2 >That script,<a href="#That-script" class="wiki-anchor">¶</a></h2>
<h2>module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end<br>
require 'tk'<br>
Tk.mainloop</h2>
<p>gives the result:</p>
<p>called Tcl_FindHashEntry on deleted table<br>
Aborted (core dumped)</p>
<p>The same thing happens if the final line is commented out.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=377122013-03-19T11:21:49Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Assignee</strong> set to <i>nagai (Hidetoshi Nagai)</i></li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=377202013-03-19T15:04:51Zedmccard (Ed McCardell)edmccard@hotmail.com
<ul><li><strong>File</strong> <a href="/attachments/3610">crash-2.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/3610/crash-2.txt">crash-2.txt</a> added</li></ul><p>Attached is the gdb backtrace from running nagai's test script.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=399882013-06-17T14:20:04Znagai (Hidetoshi Nagai)nagai@ai.kyutech.ac.jp
<ul></ul><p>Currently, Ruby/Tk cannot support Tcl/Tk8.6. Please use Tcl/Tk8.5.<br>
I want to add Tcl/Tk8.6 to supported version. But it is a future work.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=468252014-05-21T13:05:59Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul></ul><p>Fedora has accepted Tcl/Tk 8.6 for F21 [1]. Is there any chance this will get resolved? Is there any repository with adjustments for 8.6 compatibility? Is there something I can help (having just limited knowledge)?</p>
<p>[1] <a href="https://fedoraproject.org/wiki/Changes/f21tcl86" class="external">https://fedoraproject.org/wiki/Changes/f21tcl86</a></p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=482302014-08-07T08:16:21Zh.shirosaki (Hiroshi Shirosaki)h.shirosaki@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/4612">0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4612/0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch">0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch</a> added</li></ul><p>I see the crash with ruby trunk and Tk 8.6.1 on Ubuntu Linux x86_64.<br>
It seems calling <code>__orig_namespace_command__</code> causes access violation. <code>objClientData</code> memory looks freed.<br>
Instead using <code>rename</code> command to create <code>__orig_namespace_command__</code> works without crash.<br>
I tested it with some files in ext/tk/sample.<br>
I attached a patch.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=484632014-08-24T14:00:05Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=493202014-10-09T14:37:30Zcodebykevin (Kevin Walzer)kw@codebykevin.com
<ul></ul><p>If this patch fixes the crash on Ubuntu, can it be generalized to support Ti 8.6 across platforms? Tk 8.5 is going to be EOL'ed at some point soon and it is very important that Ruby work with 8.6.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=493212014-10-09T14:50:31Zcodebykevin (Kevin Walzer)kw@codebykevin.com
<ul></ul><p>To generalize further, is it even necessary to do platform tests? Could the simple change:</p>
<ul>
<li>
<p>Tcl_Eval(interp, "rename namespace <strong>orig_namespace_command</strong>");</p>
<p>Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,<br>
(ClientData) 0, (Tcl_CmdDeleteProc *)NULL);</p>
</li>
</ul>
<p>be applied to implement 8.6 support across the board?</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495272014-10-19T12:55:48Znagai (Hidetoshi Nagai)nagai@ai.kyutech.ac.jp
<ul><li><strong>File</strong> <a href="/attachments/4789">tk-diff-ruby-2.0.0-p576</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4789/tk-diff-ruby-2.0.0-p576">tk-diff-ruby-2.0.0-p576</a> added</li><li><strong>File</strong> <a href="/attachments/4790">tk-diff-ruby-2.1.3-p242</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4790/tk-diff-ruby-2.1.3-p242">tk-diff-ruby-2.1.3-p242</a> added</li><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>File</strong> <a href="/attachments/4788">tk-diff-ruby-1.9.3-p547</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/4788/tk-diff-ruby-1.9.3-p547">tk-diff-ruby-1.9.3-p547</a> added</li></ul><p>Please apply the attached patch.</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495282014-10-19T13:17:07Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>Hidetoshi Nagai wrote:</p>
<blockquote>
<p>Please apply the attached patch.</p>
</blockquote>
<p>I guess that these patches are corresponding to r48018 in trunk.<br>
However, they contain not only the fix of the SEGV but also many new features, aren't they?</p>
<p>Unless there is a very compelling reason, it is not possible to add new features to the branch in the maintenance phase.<br>
Could you make the patches contain only the fix of the SEGV?</p>
<p>(It should be noted that the ordinal maintenance phase of <code>ruby_1_9_3</code> branch has been already ended, then ordinal bug fixes will not be backported, only security issues will be.)</p> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495322014-10-19T13:43:09Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Related to</strong> <i><a class="issue tracker-4 status-6 priority-4 priority-default closed" href="/issues/10400">Backport #10400</a>: Ruby/Tk patch for Tcl/Tk8.6</i> added</li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495342014-10-19T13:43:23Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Related to</strong> <i><a class="issue tracker-4 status-6 priority-4 priority-default closed" href="/issues/10399">Backport #10399</a>: Ruby/Tk patch for Tcl/Tk8.6</i> added</li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495362014-10-19T13:43:39Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Related to</strong> <i><a class="issue tracker-4 status-5 priority-4 priority-default closed" href="/issues/10401">Backport #10401</a>: Ruby/Tk patch for Tcl/Tk8.6</i> added</li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=495372014-10-19T13:44:02Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> set to <i>2.0.0: REQUIRED, 2.1: REQUIRED</i></li></ul> Ruby master - Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6https://redmine.ruby-lang.org/issues/8000?journal_id=524342015-05-13T21:13:52Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<ul><li><strong>Backport</strong> changed from <i>2.0.0: REQUIRED, 2.1: REQUIRED</i> to <i>2.0.0: REQUIRED, 2.1: DONE</i></li></ul>