Artifacts Associated With Ticket 670042ffffffffffffffffffffffffffffffffff
Ticket change [c38707a0e8] (rid 111677) by dgp on 2003-01-17 22:58:32:
- assignee initialized to: "kennykb"
- cmimetype initialized to: "text/plain"
- comment initialized to:
dgpIs line 481 of tclLoad.c a bug? kennykbyes, dgp? dgpRather than a return, shouldn't that be a goto down to where the package is registered as loaded in a non-NULL interp? kennykbOK, let me walk through this slowly. dgpAs is, Tcl_StaticPackage(one,...); Tcl_StaticPackage(two,...); kennykbWe've discovered that there's a package with the same name and procedures statically loaded in SOME interp. dgpwill cause [info loaded {}] in interp one, to include foo, but [info loaded {}] in interp two will not. kennykbBut it doesn't have to be the current one. dgp"statically loaded" is a per-process question. kennykbHmm, but then the code down below actually has to check that the package ISN'T already loaded in the current interp? dgpfirstPkgPtr is a process-wide resource. Out of a cloud of smoke, miguel appears! dgpAs I understand it, it's up to the caller to get this right. kennykbexcuse me. we've discovered that a static package is provided in the process... but we don't know that it's in [info loaded] in the current interp. dgpSo if the caller calls Foo_Init(two) directly, it's up to that caller to also call Tcl_StaticPackage(two,...) to keep the [info loaded] results correct. kennykbSo, you want to replace the Tcl_MutexUnlock and return with a break, then condition the next paragraph upon pkgPtr == null, yes? kennykbHmm, I was more concerned with two Tcl_StaticPackage calls for the same package in the same interp. kennykbIs that illegal, or should it simply do nothing? dgpthat's cleaner than the goto, yes. dgpIt would seem that s per-interp search for already registered packages would be need then, yes. kennykb... probably up at the top, so we can do it without acquiring the lock. kennykbHmm, then we need two more test cases, one to make sure that Tcl_StaticPackage gets [imfo loaded] right in the second interp, and one to make sure that you can Tcl_StaticPackage the same package twice. .... dgpWhat got me started was trying to grok the intent of Tcl_StaticPackage's modes of operation. kennykbOK, well, you did indeed find a bug. kennykbAnd you're right that the 'package' there is a misnomer, I quite forgot the conversation where I argued you into that position. dgpapparently, the interp==NULL mode is just for saying "hey, there are two routines available, Foo_Init and Foo_SafeInit, and the [load] command in the future should associate them with the "Foo" value in its "package" argument. dgp...in all interps. dgpThe (interp!=NULL) mode, though, seems intended to make a stronger claim. dgpHey, that association should be made, *and*, btw, I've called one of those routines on this interp already. dgpIf that understanding is correct, I'd note that I derived that from looking at the code, not at the docs for Tcl_StaticPackage, which could be clearer. kennykb... and we ought to update the docs to reflect that understanding. - foundin initialized to: "obsolete: 8.4.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "40. Dynamic Loading"
- title initialized to: "Tcl_StaticPackage fails interp registration."
- type initialized to: "Bug"
Ticket change [4ce88128c7] (rid 126971) by kennykb on 2003-02-02 06:43:36:
- closedate changed to: "2003-02-01T23:43:36"
- closer changed to: "kennykb"
- resolution changed to: "Fixed"
- status changed to: "Closed"