Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-06-28
01:13 • Closed ticket [1101670fff]: auto_reset disagrees with documentation plus 7 o... artifact: a70e46b641 user: dgp
00:37 • Ticket [1101670fff]: 4 changes artifact: f9b78f25dd user: vincentdarley
00:30 • Ticket [1101670fff]: 5 changes artifact: ec480efb44 user: dgp
00:30 • Open ticket [1101670fff]. artifact: 1a17cdc654 user: dgp
2005-06-25
06:26 • Ticket [1101670fff]: 4 changes artifact: b027e607dc user: dgp
06:26 • Closed ticket [1101670fff]. artifact: 62f0530084 user: dgp
06:03 • Ticket [1101670fff]: 4 changes artifact: 1052142071 user: dgp
05:56 • Open ticket [1101670fff]. artifact: c60db3c217 user: dgp
2005-06-24
22:03 • Closed ticket [1101670fff]. artifact: 2df5792fe0 user: dgp
21:46 • Ticket [1101670fff]: 4 changes artifact: b442ab1059 user: skherndon
20:37 • Ticket [1101670fff]: 4 changes artifact: daeede8da9 user: dgp
20:37 • Ticket [1101670fff]: 4 changes artifact: 896736faa1 user: dgp
08:37 • Open ticket [1101670fff]. artifact: 7fbfb9000c user: dgp
04:18 • Ticket [1101670fff]: 4 changes artifact: 646717a798 user: skherndon
2005-01-26
00:58 • Closed ticket [1101670fff]. artifact: 585d2056d9 user: dgp
00:05 • Ticket [1101670fff]: 4 changes artifact: d11d23a636 user: dgp
2005-01-25
18:01 • Ticket [1101670fff]: 4 changes artifact: ff7a0f3451 user: vincentdarley
03:58 • Add attachment 1101670.patch to ticket [1101670fff] artifact: 77baf21052 user: dgp
03:58 • Ticket [1101670fff] auto_reset disagrees with documentation status still Ope... artifact: 86c7d21b06 user: dgp
03:58 • Ticket [1101670fff]: 4 changes artifact: d81cb1da0d user: dgp
02:04 • Ticket [1101670fff]: 4 changes artifact: b170ec4970 user: vincentdarley
01:51 • Ticket [1101670fff]: 4 changes artifact: 8a17a5921f user: dgp
2005-01-17
19:51 • Ticket [1101670fff]: 4 changes artifact: 49a7d70146 user: vincentdarley
2005-01-15
03:21 • Ticket [1101670fff]: 4 changes artifact: e99afd3451 user: dgp
2005-01-14
18:27 • Ticket [1101670fff]: 4 changes artifact: f79afd9395 user: vincentdarley
2005-01-13
22:42 • Ticket [1101670fff]: 4 changes artifact: 149c820994 user: dgp
14:36 • New ticket [1101670fff]. artifact: a09d2ea28e user: vincentdarley

auto_reset disagrees with documentation

Closed / Fixed1101670fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2005-01-13 14:36:58
The core proc auto_reset is documented as follows:

# auto_reset --
#
# Destroy all cached information for auto-loading and
auto-execution,
# so that the information gets recomputed the next time
it's needed.
# Also delete any procedures that are listed in the
auto-load index
# except those defined in this file.
#
# Arguments: 
# None.

But it doesn't do that:

proc auto_reset {} {
    variable ::tcl::auto_oldpath
    global auto_execs auto_index 
    foreach p [info procs] {
if {[info exists auto_index($p)]} {
    rename $p {}
}
    }
    catch {unset auto_execs}
    catch {unset auto_index}
    catch {unset auto_oldpath}
}

'info procs' only returns procedures in the global
namespace. Presumably auto_reset should also delete
procs in _all_ namespaces, if it is to agree with its
documentation.
dgpplain2005-01-13 22:42:52
Logged In: YES 
user_id=80530

thanks for the report.  Sure looks
like [auto_reset] never got an
update to deal with the arrival
of [namespace].

While I consider a fix for this,
what do you think about
expanding to [info commands]
instead of [info procs] ?  Just
because a command is
auto-loaded doesn't mean it's
a [proc].  The auto-load script
could call [load].
vincentdarleyplain2005-01-14 18:27:53
Logged In: YES 
user_id=32170

At first sight I would say, yes, that 'info commands' would
be better, but then the problem is this would result in a
piece of code being loaded twice, wouldn't it?

mycmd ; # causes 'auto_load mycmd' which causes 'load foo.dll'
auto_reset
mycmd ; # causes 'auto_load mycmd' which causes 'load foo.dll'

Won't that cause trouble?
dgpplain2005-01-15 03:21:39
Logged In: YES 
user_id=80530

no trouble.  [load] remembers
what files it has dlopen()'d  (*)
and will not do so twice.  A
second [load] on the same file
will only lead to another
Foo_Init() call.

(*) [info loaded] will even tell you
what they are.
vincentdarleyplain2005-01-17 19:51:47
Logged In: YES 
user_id=32170

Well then [info commands] seems the way to go.

Vince.

p.s. another buglet is the clause "...except those defined
in this file." above, which is untrue. 'auto_reset' does in
fact delete itself, for example.
dgpplain2005-01-25 01:51:12
Logged In: YES 
user_id=80530

Is there a goof in this submission?

The bug is reported on Tcl 8.4.9,
but the code cited comes from
the Tcl HEAD of development.

Is the submitter looking for fixes
just on the HEAD, or for 8.4.10 as well?
vincentdarleyplain2005-01-25 02:04:43
Logged In: YES 
user_id=32170

The basic bug is in both 8.4 and 8.5, so I would assume a
fix would apply to both (I'm not sure of the purpose of the
differences between 8.4 and 8.5, but they definitely
disagree with the comments in auto.tcl in 8.5).  

However, I'm most interested in seeing fixes in 8.5.
dgpplain2005-01-25 03:58:29
Logged In: YES 
user_id=80530

please review this patch
for Tcl 8.5.
dgpplain2005-01-25 03:58:31
File Added - 116992: 1101670.patch
vincentdarleyplain2005-01-25 18:01:57
Logged In: YES 
user_id=32170

Ah, yes, that's a very nice way of doing things. It does
appear to work for me.

I suppose the [info library] bit is to ensure that the
auto_* procs can be reloaded in the future?
dgpplain2005-01-26 00:05:54
Logged In: YES 
user_id=80530

revised patch with added safety
committed to HEAD.
dgpplain2005-01-26 00:58:19
Logged In: YES 
user_id=80530

commited slightly different
fix for 8.4.10 that treads a
bit lighter on compatibility.
skherndonplain2005-06-24 04:18:13
Logged In: YES 
user_id=281759

I've run into a problem after picking up this change related
to Itcl.

Once auto_reset is called, auto_mkindex no longer indexes
itcl::class and other itcl procedures.

To illustrate, I placed a puts statement in itcl.tcl and in
auto_mkindex_parser::command.

(bin) 49 % package require Itcl
itcl.tcl sourced
auto_mkindex_parser::command proc
auto_mkindex_parser::command namespace
auto_mkindex_parser::command itcl::class
auto_mkindex_parser::command itcl::body
auto_mkindex_parser::command itcl::configbody
auto_mkindex_parser::command itcl::ensemble
auto_mkindex_parser::command public
auto_mkindex_parser::command protected
auto_mkindex_parser::command private
3.3
(bin) 49 % auto_reset
(bin) 50 % package require Itcl
3.3
(bin) 51 % 

at this point, if I run auto_mkindex on a directory with
itcl classes in it, they will not be added to the tclIndex.
There is no mechanism in place to force Itcl to handle
auto_reset.
dgpplain2005-06-24 08:37:38
Logged In: YES 
user_id=80530


It's looking like [auto_mkindex] is
dependent on this bug.

I'll try to develop a proper fix for this,
but if that doesn't come together, I'll
at least add [auto_mkindex] (and
support) to the list of special case
commands in [auto_reset].
dgpplain2005-06-24 20:37:06
Logged In: YES 
user_id=80530


Please test whether the attached auto.test
solves the issue.
dgpplain2005-06-24 20:37:07
File Added - 139645: auto.patch
skherndonplain2005-06-24 21:46:21
Logged In: YES 
user_id=281759

The patch worked.
dgpplain2005-06-24 22:03:38
Logged In: YES 
user_id=80530

fix committed for 8.4.11 and HEAD
dgpplain2005-06-25 05:56:20
Logged In: YES 
user_id=80530

um, no.

that patch appears to totally break
[auto_mkIndex].  Don't understand
why skherndon thought it worked.

re-opened.
dgpplain2005-06-25 06:03:57
Logged In: YES 
user_id=80530

ok, patch just misplaced a check,
and perhaps tbcload was needed
to tweak the brokennness.
dgpplain2005-06-25 06:26:50
Logged In: YES 
user_id=80530

bogus patch deleted;

corrected patch committed for
8.4.11 and HEAD.
dgpplain2005-06-25 06:26:51
File Deleted - 139645:
dgp Open ticket [1101670fff]. [History diff]2005-06-28 00:30:35
dgpplain2005-06-28 00:30:36
Logged In: YES 
user_id=80530


re-opening after more reports of trouble.

The issue is that this bug fix for the first
time causes [auto_reset] to force the
re-loading of commands in non-global
namespaces.  This means for the first
time, auto-loading is causing some files
to be [source]d twice that for many years
have only been [source]d once.

There are an unknown number of
(arguably buggy) files out there that
do not tolerate being [source]d more
than once.  It appears some of 
these files are part of Tk's script library. (!)

Given that, it's looking more and more
like this change -- though it is a bug fix --
is sufficiently disruptive that it ought only
happen in 8.5 development, and not
in a stable patch release.

Any contrary comments, Vince?
vincentdarleyplain2005-06-28 00:37:09
Logged In: YES 
user_id=32170

No comments to the contrary - we certainly want Tcl 8.4.10+
to be stable and not introduce new subtle problems.
dgpplain2005-06-28 01:13:03
Logged In: YES 
user_id=80530

done.
Log in (anonymous is fine) to add a comment.

Attachments: