# RubyTk and segfaults

**URL:** <https://rubytalk.org/t/rubytk-and-segfaults/74098>\
**Category:** ruby-talk\
**Created:** [15 March 2017 10:41 UTC](https://rubytalk.org/t/rubytk-and-segfaults/74098 "2017-03-15T10:41:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leam\_Hall](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/leam_hall/32/1841_2.png) [@Leam\_Hall](https://rubytalk.org/u/Leam_Hall)\
**Post date:** [15 March 2017 10:41 UTC](https://rubytalk.org/t/rubytk-and-segfaults/74098/1 "2017-03-15T10:41:04Z")

</div>

Working with Ruby 2.4.0 and trying to see why it keeps seg faulting. I saw an issue. Tk is 0.1.1, installed via gem install after I updated Ruby.

# ruby -r debug fred.rb  
# Borign stuff snipped.

[fred.tk:12](http://fred.tk:12): pack("side" =\> "right", "padx" =\> "50", "pady" =\> "10")  
(rdb:1) n  
/usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:4987: `unknown option "-to\_ary"' (RuntimeError)  
&nbsp;&nbsp;from /usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:5228:in `pack'  
&nbsp;&nbsp;from [fred.tk:12](http://fred.tk:12):in `block in \<main\>'  
&nbsp;&nbsp;from [fred.tk:9](http://fred.tk:9):in `new'  
&nbsp;&nbsp;from [fred.tk:9](http://fred.tk:9):in `\<main\>'  
/usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:4987: super(id, \*args)

Which seems to relate to the tk.rb:

&nbsp;&nbsp;&nbsp;4983 if self.kind\_of?(TkWindow) && name != "to\_ary" && name != "to \_str"  
&nbsp;&nbsp;&nbsp;&nbsp;4984 fail NameError,  
&nbsp;&nbsp;&nbsp;&nbsp;4985 "unknown option '#{id}' for #{self.inspect} (deleted w idget?)"  
&nbsp;&nbsp;&nbsp;&nbsp;4986 else  
&nbsp;&nbsp;&nbsp;&nbsp;4987 super(id, \*args)  
&nbsp;&nbsp;&nbsp;&nbsp;4988 end  
&nbsp;&nbsp;&nbsp;&nbsp;4989 # fail NameError,  
&nbsp;&nbsp;&nbsp;&nbsp;4990 # "undefined local variable or method `#{name}' for #{sel f.to\_s}",  
&nbsp;&nbsp;&nbsp;&nbsp;4991 # error\_at  
&nbsp;&nbsp;&nbsp;&nbsp;4992 end

However, when I clone the tk repo and try to run "rake test" like it suggests, I get:

[leam@shaphan tk]$ rake test  
rake aborted!  
Don't know how to build task 'test' (see --tasks)

(See full trace by running task with --trace)  
[leam@shaphan tk]$ rake test --trace  
rake aborted!  
Don't know how to build task 'test' (see --tasks)  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task\_manager.rb:58:in `[]'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:151:in `invoke\_task'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top\_level'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top\_level'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run\_with\_threads'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top\_level'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard\_exception\_handling'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'  
/usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/exe/rake:27:in `\<top (required)\>'  
/usr/local/bin/rake:22:in `load'  
/usr/local/bin/rake:22:in `\<main\>'

How can I debug this some more?

---

<div class="post-metadata">

**Author:** ![Hidetoshi\_NAGAI](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@Hidetoshi\_NAGAI](https://rubytalk.org/u/Hidetoshi_NAGAI)\
**Post date:** [16 March 2017 02:56 UTC](https://rubytalk.org/t/rubytk-and-segfaults/74098/2 "2017-03-16T02:56:11Z")

</div>

Message-ID: \<700eebed-1492-8881-185f-39389ae1708e@gmail.com\>

> Working with Ruby 2.4.0 and trying to see why it keeps seg faulting. I  
> saw an issue. Tk is 0.1.1, installed via gem install after I updated  
> Ruby.
> 
> # ruby -r debug fred.rb  
> # Borign stuff snipped.
> 
> fred.tk:12: pack("side" =\> "right", "padx" =\> "50", "pady" =\> "10")  
> (rdb:1) n  
> /usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:4987: `unknown  
> option "-to\_ary"' (RuntimeError)  
> &nbsp;&nbsp;from /usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:5228:in  
> &nbsp;&nbsp;`pack'  
> &nbsp;&nbsp;from fred.tk:12:in `block in \<main\>'  
> &nbsp;&nbsp;from fred.tk:9:in `new'  
> &nbsp;&nbsp;from fred.tk:9:in `\<main\>'  
> /usr/local/lib/ruby/gems/2.4.0/gems/tk-0.1.1/lib/tk.rb:4987: super(id,  
> \*args)

Please check the context of the error part.  
Probably, you call the module method Tk.pack.  
The usage of Tk.pack is

> **···**
>
> From: Leam Hall \<leamhall@gmail.com\>  
> Subject: RubyTk and segfaults  
> Date: Wed, 15 Mar 2017 06:41:04 -0400  
> ------------------------------------------------------------------  
> &nbsp;&nbsp;Tk.pack(widget [, widget , ...] [, hash\_of\_options])  
> &nbsp;&nbsp;&nbsp;&nbsp;or  
> &nbsp;&nbsp;Tk.pack(array\_of\_widgets [, hash\_of\_options])  
> ------------------------------------------------------------------
> 
> The usage of the instance method TkWindow#pack is  
> ------------------------------------------------------------------  
> &nbsp;&nbsp;widget.pack([hash\_of\_options])  
> ------------------------------------------------------------------
> 
> Please see sample scripts in "sample" directory of the source tree of Ruby/Tk,  
> especially "Ruby/Tk Widget Demos" (in sample/demos-en).  
> To start the widget demos, execute "ruby sample/demos-en/widget".  
> You can see the sub-demo's source code,  
> edit the source code on the editor of the widget demo temporally,  
> and re-run the modified code to learn by trial and error.  
> --  
> Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)  
> Department of Artificial Intelligence, Kyushu Institute of Technology
