Ticket #61 (closed defect: wontfix)

Opened 4 years ago

Last modified 4 years ago

Threads with eggdrop

Reported by: Ofloo Owned by:
Priority: major Milestone: 1.6.20
Component: Core Version: 1.6.20
Keywords: Cc:

Description

tcl version 8.5 threads

[14:21:15] #Ofloo# set errorInfo
Currently: couldn't save command result in variable
Currently: while executing
Currently: "catch {package require Thread} version"
Currently: (in namespace eval "::ttrace" script line 9)
Currently: invoked from within
Currently: "namespace eval ttrace {
Currently:
Currently: # Setup some compatibility wrappers
Currently: if {[info commands nsv_set] != ""} {
Currently: variable tvers 0
Currently: variable mu..."
Currently: (file "/usr/local/lib/thread2.6.5/ttrace.tcl" line 47)
Currently: invoked from within
Currently: "source [file join $dir ttrace.tcl]"
Currently: (procedure "thread_source" line 8)
Currently: invoked from within
Currently: "thread_source /usr/local/lib/thread2.6.5"
Currently: ("package ifneeded Ttrace 2.6.5" script)
Currently: invoked from within
Currently: "package require Ttrace"
.tcl catch {package require Thread} version
Tcl error: couldn't save command result in variable
.tcl catch
Tcl error: wrong # args: should be "catch script ?resultVarName? ?optionVarName?"
.tcl catch {package require Thread} vers
Tcl: 0
.set version
[14:25:16] #Ofloo# set version
Currently: 1.6.20+RC2 1062003 PRE-RELEASE 1279200246 RC2

the problem is that when you package require Ttrace which is part of threads it tries to overwrite the version variable, .. if this is loaded from a script the bot will crash and core

the exact problem is the variable name, both Ttrace and eggdrop are makeing use of this variable.

Change History

comment:1 Changed 4 years ago by Ofloo

file tcl.c

static tcl_strings def_tcl_strings[] = {

{"botnet-nick", botnetnick, HANDLEN, 0},
{"userfile", userfile, 120, STR_PROTECT},
{"motd", motdfile, 120, STR_PROTECT},
{"admin", admin, 120, 0},
{"help-path", helpdir, 120, STR_DIR | STR_PROTECT},
{"temp-path", tempdir, 120, STR_DIR | STR_PROTECT},
{"text-path", textdir, 120, STR_DIR | STR_PROTECT},

#ifndef STATIC

{"mod-path", moddir, 120, STR_DIR | STR_PROTECT},

#endif

{"notify-newusers", notify_new, 120, 0},
{"owner", owner, 120, STR_PROTECT},
{"my-ip", myip, 120, 0},
{"my-hostname", hostname, 120, 0},
{"network", network, 40, 0},
{"whois-fields", whois_fields, 1024, 0},
{"nat-ip", natip, 120, 0},
{"username", botuser, 10, 0},
{"version", egg_version, 0, 0},
{"firewall", firewall, 120, 0},
{"config", configfile, 0, 0},
{"telnet-banner", bannerfile, 120, STR_PROTECT},
{"logfile-suffix", logfile_suffix, 20, 0},
{"timestamp-format",log_ts, 32, 0},
{"pidfile", pid_file, 120, STR_PROTECT},
{NULL, NULL, 0, 0}

};

changed

{"version", egg_version, 0, 0},

into

{"versions", egg_version, 0, 0},

and it works, however then the variable version doesn't exist anymore, but it is changed into versions instead.

weird that it works in the same namespace/scope

comment:2 Changed 4 years ago by thommey

  • Status changed from new to closed
  • Resolution set to wontfix

This is indeed caused by Tcl's Thread package (lib/ttrace.tcl) using the global variable $version as a temporary variable. That's surely a bug on their side, because they do not need a variable that is this likely to be used just as a temporary one. I filed a bug at Tcl's sourceforge bugtracker with that:  here.
We cannot change our version variable to be writable or rename it because existing Tcl scripts rely on it and it makes perfect sense to accompany a global $version variable (other applications do that too - aMSN for example).

So the only fix is for you to modify lib/ttrace.tcl to use another variable name there.

comment:3 Changed 4 years ago by Ofloo

ok add "variable version" right after "namespace eval ttrace {" that should take care of it, without having to change any of the code.

comment:4 Changed 4 years ago by Ofloo

sorry don't know how to reply at sf.net

comment:5 Changed 4 years ago by Ofloo

here's a patch if you could be so kind to post it to ttrace on sf

Code:
--- ttrace.tcl  2010-07-25 01:46:47.000000000 +0200
+++ ttrace.tcl  2010-07-25 01:43:53.000000000 +0200
@@ -46,6 +46,7 @@
 
 namespace eval ttrace {
 
+    variable version
     # Setup some compatibility wrappers
     if {[info commands nsv_set] != ""} {
         variable tvers 0 

comment:6 Changed 4 years ago by pseudo

Fixed in ttrace.tcl

Note: See TracTickets for help on using tickets.