Ruby tk: ruby 1.8.2 bug in TclTkIp with "exit 0" ...?

Hidetoshi NAGAI wrote:

From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: Re: tk_optionMenu bug in 1.8.2
Date: Thu, 28 Apr 2005 11:34:24 +0900
Message-ID: <20050428.113404.71101381.nagai@ai.kyutech.ac.jp>

I couldn't too. And couldn't reproduce the another error. My environment is "ruby 1.8.2 (2005-04-25) [i686-linux]" with "ActiveTcl8.4.9.0".

Sorry. My tcltklib.so was replaced with 2005-04-26 version. I installed Tcl/Tk8.3.2 and used "1.8.2 (2005-04-27) [i686-linux]". But unfortunately, I couldn't reproduce your trouble...

Well, we compiled a much more recent version of tcl, compiled ruby against it, and now we get a more useful backtrace with our problem.

This is with your patch applied against 1.8.2, and tcl version 8.4.9
on hpux11.00/pa2.0 (linux/i686 still gets the less useful error posted before):

With the same pgui.rb file I attached earlier, I push the add button on the left and get:

------------ CONSTRUCTING TKOPTIONMENU
---< backtrace of Ruby side >-----
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1948:in `__invoke'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1948:in `_invoke'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1498:in `_ip_invoke_core'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1532:in `_tk_call_core'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1556:in `tk_call'
/opt/ictools/ruby/lib/ruby/1.8/tk/menu.rb:463:in `initialize'
pgui.rb:160:in `new'
pgui.rb:160:in `make_add_button'
pgui.rb:94:in `call'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1089:in `eval_cmd'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1089:in `cb_eval'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1040:in `call'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1178:in `callback'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1383:in `mainloop'
pgui.rb:367:in `initialize'
pgui.rb:662:in `new'
pgui.rb:662
---< backtrace of Tk side >-------
     invoked from within
"rb_out c00010"
     invoked from within
".w00002.w00029.w00031.w00037 invoke"
     ("uplevel" body line 1)
     invoked from within
"uplevel #0 [list $w invoke]"
     (procedure "tk::ButtonUp" line 22)
     invoked from within
"tk::ButtonUp .w00002.w00029.w00031.w00037"
     (command bound to event)

Hidetoshi NAGAI wrote:

From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: Re: tk_optionMenu bug in 1.8.2
Date: Thu, 28 Apr 2005 11:34:24 +0900
Message-ID: <20050428.113404.71101381.nagai@ai.kyutech.ac.jp>

I couldn't too. And couldn't reproduce the another error. My environment is "ruby 1.8.2 (2005-04-25) [i686-linux]" with "ActiveTcl8.4.9.0".

Sorry. My tcltklib.so was replaced with 2005-04-26 version. I installed Tcl/Tk8.3.2 and used "1.8.2 (2005-04-27) [i686-linux]". But unfortunately, I couldn't reproduce your trouble...

Ok, after some work we can recreate this with the following:

···

#########################################
require 'tk'

root = TkRoot.new() do
   title 'Some title'
end

bad = TkButton.new(root) do
   text 'bad'
   command do
     puts 'bad'
     win = TkToplevel.new(root) do
       title "Bad window"
     end

     names = ['a', 'b']
     operator_var = TkVariable.new()
     operator = TkOptionMenubutton.new(win, operator_var, *names)
     operator.pack
   end
end
bad.pack

Tk.mainloop()
##########################################

This will pop up a frame with a single button called bad. You can click the bad button and the bgerror problem occurs for us.

The stack trace with this smaller test case is:

ncc1701d:homes/brettw> ruby err.rb
bad
---< backtrace of Ruby side >-----
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1948:in `__invoke'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1948:in `_invoke'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1498:in `_ip_invoke_core'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1532:in `_tk_call_core'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1556:in `tk_call'
/opt/ictools/ruby/lib/ruby/1.8/tk/menu.rb:463:in `initialize'
err.rb:17:in `new'
err.rb:17
err.rb:9:in `call'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1089:in `eval_cmd'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1089:in `cb_eval'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1040:in `call'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1178:in `callback'
/opt/ictools/ruby/lib/ruby/1.8/tk.rb:1383:in `mainloop'
err.rb:23
---< backtrace of Tk side >-------
     invoked from within
"rb_out c00001"
     invoked from within
".w00000 invoke"
     ("uplevel" body line 1)
     invoked from within
"uplevel #0 [list $w invoke]"
     (procedure "tk::ButtonUp" line 22)
     invoked from within
"tk::ButtonUp .w00000"
     (command bound to event)

Message-ID: <1115238268.852868@cswreg.cos.agilent.com>

Ok, after some work we can recreate this with the following:

I can't. (;_:wink:
Could you tell me your configure options of Tcl/Tk and Ruby,
and value of TclTkLib::COMPILE_INFO ?

···

From: Brett Williams <brett_williams@agilent.com>
Subject: Re: tk_optionMenu bug in 1.8.2
Date: Thu, 5 May 2005 05:29:49 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hidetoshi NAGAI wrote:

From: Brett Williams <brett_williams@agilent.com>
Subject: Re: tk_optionMenu bug in 1.8.2
Date: Thu, 5 May 2005 05:29:49 +0900
Message-ID: <1115238268.852868@cswreg.cos.agilent.com>

Ok, after some work we can recreate this with the following:

I can't. (;_:wink:
Could you tell me your configure options of Tcl/Tk and Ruby, and value of TclTkLib::COMPILE_INFO ?

The version with the previous patch applied:
ncc1701d:homes/brettw> ruby -rtk -e 'puts TclTkLib::COMPILE_INFO'
tcltklib 2005-04-26 :: Ruby1.8.2 (2004-12-25) without pthread :: Tcl8.4.9(without stub)/Tk8.4.9(without stub) with tcl_threads

Original version we saw this problem with:
darkshore:homes/brettw> ruby -rtk -e 'puts TclTkLib::COMPILE_INFO'
tcltklib 2004-12-23 :: Ruby1.8.2 (2004-12-25) without pthread :: Tcl8.3.2(without stub)/Tk8.3.2(without stub) with tcl_threads

tcl config opts
../configure --prefix=/opt/ictools/tcl-tk \
             --exec_prefix=/opt/ictools/tcl-tk \
             --disable-shared

tk config opts
../configure --prefix=/opt/ictools/tcl-tk \
             --exec_prefix=/opt/ictools/tcl-tk \
             --disable-shared

ruby config opts
on HP-UX
../configure --build=hppa2.0-hp-hpux11.00 \
             --prefix=/opt/ictools/ruby \
             --with-tcl-dir=/opt/ictools/tcl-tk \
             --with-tk-dir=/opt/ictools/tcl-tk \
             --with-ncurses-dir=/opt/ictools/ncurses \
             --with-xml2-dir=/opt/TWWfsw/libxml25 \
             --with-z-dir=/opt/TWWfsw/zlib11 \
             --with-pgsql-dir=/opt/TWWfsw/pgsql734 \
             --with-dbm-dir=/opt/ictools/db \
             --with-readline-dir=/opt/ictools/readline \
             --disable-shared

on Linux
../configure --build=i386-redhat-linux \
             --prefix=/opt/ictools/ruby \
             --with-tcl-dir=/opt/ictools/tcl-tk \
             --with-tk-dir=/opt/ictools/tcl-tk \
             --with-ncurses-dir=/opt/ictools/ncurses \
             --with-pgsql-include-dir=/usr/include/pgsql \
             --with-dbm-dir=/opt/ictools/db \
             --with-readline-dir=/opt/ictools/readline \
             --disable-shared

Message-ID: <1115305755.504228@cswreg.cos.agilent.com>

The version with the previous patch applied:
ncc1701d:homes/brettw> ruby -rtk -e 'puts TclTkLib::COMPILE_INFO'
tcltklib 2005-04-26 :: Ruby1.8.2 (2004-12-25) without pthread ::
Tcl8.4.9(without stub)/Tk8.4.9(without stub) with tcl_threads

Thank you for your report.
I got same error on Tk::RELEASE_DATE == '2004-12-24'.
But, couldn't get on Tk::RELEASE_DATE == '2005-04-09'.
Could you try latest CVS version of Ruby/Tk?

···

From: Brett Williams <brett_williams@agilent.com>
Subject: Re: tk_optionMenu bug in 1.8.2
Date: Fri, 6 May 2005 00:14:39 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)