#4596 command pollution in interps w/o package require

Don Porter

The pkgIndex.tcl file for the Thread and Ttrace
packages creates the commands [::thread_load]
and [::thread_source] inside every interp that
happens to run [::tclPkgUnknown], whether or
not that interp ever actually does a [package require]
on Thread or Ttrace. This is unwelcome pollution.
Bad by any measure. Doubly bad in the global namespace.

This is very easy to fix with the use of the
[::apply] command, so long as a dependence on
Tcl 8.5 is permissible.

If there is movement to better separate the two
packages (see message on TCLCORE), then
the index script may change enough as a result
of that to make the issue go away.


  • I would separate the two and this would make the package loading
    trivial. No problem with that.

  • Don Porter
    Don Porter

    A partial remedy has been committed
    (thanks aku!) using [::apply] when it
    is available to avoid the pollution.

    Still would like to see the Thread and Ttrace
    packages disentangled, but getting Thread
    bundled with Tcl is more important than that.

  • Somebody already added this in the pkgIndex.tcl.in in HEAD (wasn't me).
    Was it yourself?
    Can I close this one?

  • That was I.

  • Aha! Well then I will close this one as all is already taken care of.

    • status: open --> closed-fixed