Forum OpenACS Development: ns_ictl update error with tcllib tree library

I am looking into upgrading a site to openacs 5.7 and the new 5.7 code running on the same server as the older 5.2 site with the same aolserver etc is giving me the following error every time a connection thread is created.

[10/May/2012:14:17:37][22722.3040861040][-sched:idle0-] Notice: starting
[10/May/2012:14:17:37][22722.3040861040][-sched:11-] Error: Tcl exception:
can't rename to "::struct::tree": command already exists
while executing
"rename ::struct::tree_tcl ::struct::tree"
(in namespace eval "::struct" script line 18)
invoked from within
"namespace eval ::struct {namespace import -force ::struct::tree::tree_tcl
rename tree_tcl tree
namespace import -force ::struct::set::set_tcl
rename s..."
invoked from within
"ns_ictl update"

Tcl 8.4 is installed under the aolserver install, there is no other tcl install on this machine.

How can I track this down?

Collapse
Posted by Dave Bauer on
In tcllib 1.14 there are

tree.tcl
tree1.tcl
tree_tcl.tcl

and these seems to all recreate the same basic procs so I am not sure why they are all getting sourced causing the redefinition error.

Collapse
Posted by Jeff Rogers on
This is a problem with aolserver's init.tcl that rebuilds all the commands from startup in each new interpreter. It happens when a package imports procs from another namespace and then renames them.

I don't recall exactly which versions are affected, but I think this is fixed in the CVS HEAD of aolserver (nsd/init.tcl)

Collapse
Posted by Dave Bauer on
I see.

Yes this is happening in tcllib struct module. I am not sure why one openacs seems to have this problem but not the other. Neither one appears to use the struct or tree module from tcllib.

I grabbed the latest init.tcl and put it under bin in my aolserver install but I am still seeing the same error.

THis happens on the startup of the initial interpreter as well as when conection threads are created.

Collapse
Posted by Dave Bauer on
Upon further inspection the version I have is the same except for whitespace, probably from pasting it into emacs.

Maybe it's a specific case that the fix doesn't catch that only occurs in the struct tree module, I don't know. I don't even understand why that package is called since its not required in any of my code.

Collapse
Posted by Jeff Rogers on
Does your installation use project manager? That's the only package I see that requires 'struct' (which I think pulls in tree, set, and so forth).

Are you already running aolserver cvs head or something close to that? The changes to init.tcl were only made recently to my knowledge (Dec '11).

I'll see if I can get the problem to reproduce with project manager. In the meantime, you could try commenting out the errant code - init.tcl:594 which is

::append _import [::list rename [::namespace current]::[::namespace tail $_orig] $_cmnd] \n

Collapse
Posted by Gustaf Neumann on
Can it be that you have upgraded not only openacs, but as well aolserver to the very latest version (4.5.2). There is a rather new commit introducing the renamings:

https://groups.google.com/forum/?fromgroups#!msg/aolserver-commits/XfhVZhUnYwo/HhB2hrCxqAgJ

The problem might already come from acs-tcl/tcl/util-diff-procs.tcl, which does a "package req struct::list"

I would recommend to give aolserver 4.5.1 a try

-gustaf

Collapse
Posted by Jeff Rogers on
I've checked in a fix for this. It was a rather dumb oversight.

With this fix, packages like struct::list can be required in init scripts and used at runtime. Without it, the package would need to be required within the body of the proc in which they are used, which appears to be the case in util-diff-procs.tcl which predates this change.

Collapse
Posted by Gustaf Neumann on
Thanks a lot!

If i see correctly, the fix is to remove the previously added rename attempt from the block handling the namespace imported commands. This mean probably that the renaming of namespace imported commands is not covered now. Would not a check for existence of the target of the name followed by a deletion of the command in case it exists help to cover this case?

Collapse
Posted by Dave Bauer on
Ok so I did have package-manager, which I disabled, and I do not see the struct::list in acs-tcl/tcl/util-diff-procs.tcl or util-diff-procs.tcl at all so I'll need to see if I have the correct acs-tcl.

I do have aolserver 4.5.2 or latest from CVS according ot the changelog.

It appears that project-manager was updated and now calls the struct module from tcllib and disabling that resolves the issue for now, and explains why the older install did not experience the same problem.

Thanks for all the help.

Definitely it appears there is a problem with AOLserver 4.5.2 and tcllib struct::list but I have at least worked around it in my case since I don't think I need project-manager.