Artifacts Associated With Ticket 803489ffffffffff
Ticket change [2d4fa4ea3e] (rid 119043) by davygrvy on 2003-09-09 23:10:12:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tcl_FindNamespace now has a new entry in the public table for 8.5. The old one still exists in the private table, too, but isn't visible due to . The public tclDecls.h is included first. All fine so far, but any extension that links with the new Stubs table blows chucks when loaded into an older core. Why? tclStubsPtr->tcl_FindNamespace is NULL. I'd rather have it still be tclIntStubsPtr- >tcl_FindNamespace, still. Solution? Not sure.. tclDecls.h: #ifndef Tcl_FindNamespace #define Tcl_FindNamespace \ (tclStubsPtr->tcl_FindNamespace) /* 514 */ #endif tclIntDecls.h: #ifndef Tcl_FindNamespace #define Tcl_FindNamespace \ (tclIntStubsPtr->tcl_FindNamespace) /* 117 */ #endif
- foundin initialized to: "obsolete: 8.5a0"
- priority initialized to: "9 Immediate"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "davygrvy"
- subsystem initialized to: "50. Embedding Support"
- title initialized to: "Tcl_FindNamespace problem in the Stubs table"
- type initialized to: "Bug"
Ticket change [d20a7f9a89] (rid 113458) by dgp on 2003-09-10 06:12:45:
- icomment:
Logged In: YES user_id=80530 Have you re-run 'make genstubs' since your last update?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [8aa9754aeb] (rid 127429) by dgp on 2003-09-10 06:15:37:
- icomment:
Logged In: YES user_id=80530 Ah. Never mind. I get the trouble now.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [cbb3852087] (rid 95566) by dgp on 2003-09-10 06:18:40:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=80530 Donal, your genstubs trickery handled forward compatibility fine, but as davygrvy points out, it leaves out support for backward compatibility. (Compile an extension against 8.5 headers, but [load] it into an 8.4 interp). I know the wrapper solution is tedious, but it appears to be the way to go.
- login: "dgp"
- mimetype: "text/plain"
- subsystem changed to: "21. [namespace]"
- username: "dgp"
Ticket change [825bcbbf8f] (rid 117226) by davygrvy on 2003-09-10 06:20:41:
- subsystem changed to: "50. Embedding Support"
Ticket change [cb7a8b6f00] (rid 95526) by davygrvy on 2003-09-10 06:20:43:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=7549 How about a new command added to genStubs.tcl: forward generic Int { Tcl_Namespace *Tcl_FindNamespace(Tcl_Interp *interp, CONST char *name, Tcl_Namespace *contextNsPtr, int flags) } and doesn't write write a new slot to the table, and defines the name to be: #ifndef Tcl_FindNamespace #define Tcl_FindNamespace \ (tclIntStubsPtr->tcl_FindNamespace) /* 514 */ #endif even in the public tclStubs.h. Would that be cart before the horse? - login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
Ticket change [f9fad85273] (rid 91792) by davygrvy on 2003-09-10 06:28:45:
- assignee changed to: "dkf"
- subsystem changed to: "21. [namespace]"
Ticket change [5135d16d52] (rid 126098) by davygrvy on 2003-09-10 11:12:11:
- icomment:
Logged In: YES user_id=7549 until this gets fixed, I'm dropping back to 8.4 for extension builds. It's blowing up everything I've got in progress.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [bc50f779dc] (rid 101728) by davygrvy on 2003-09-10 11:40:46:
- icomment:
Logged In: YES user_id=7549 Just before I reverted, I found a quick fix: #include "tclInt.h" #ifdef Tcl_FindNamespace #undef Tcl_FindNamespace #define Tcl_FindNamespace \ (tclIntStubsPtr->tcl_FindNamespace) #endif . . . That'll work for me for now..
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [c59e4e5850] (rid 112029) by dkf on 2003-09-10 19:03:21:
- icomment:
Logged In: YES user_id=79902 Could someone explain why people might have an expectation that an extension compiled with 8.x might work with 8.y when x>y? I thought that was a compatability case which we were explicitly not supporting...
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "dkf"
- icomment:
Ticket change [fc3a9cd22b] (rid 108198) by davygrvy on 2003-09-10 19:30:59:
- icomment:
Logged In: YES user_id=7549 Stubs are supposed to gain, never lose slots. You moved my slot. I know this code works in 8.1, therefore, I state it: #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.1", 0) == 0L) { return TCL_ERROR; } #endif This change breaks my stuff. Please don't make a needed private->public move break existing code. I'm all for the API shift to the public, but could you leave the old slot position the same? - login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [eb571c7fb1] (rid 103533) by dkf on 2003-09-10 19:57:01:
- icomment:
Logged In: YES user_id=79902 The function is still in the old slot and there has never been a guarantee that internal stubs will be perfectly maintained. In 8.4 and before, Tcl_FindNamespace is an internal function; anyone #including tclInt.h does not have as strong a guarantee of compatability. Note that since there have been structure size alterations (e.g. in channel types), it is not really generally safe to load a stubbed library into an earlier version of Tcl, no matter how you call Tcl_InitStubs. IMHO, this is pilot error, *not* a bug.
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- username: "dkf"
- icomment:
Ticket change [fbcce6a109] (rid 108121) by davygrvy on 2003-09-11 09:56:10:
- icomment:
Logged In: YES user_id=7549 Sorry, this is a big bug. So I now have to source tclIntDecls.h prior to to tcl.h to solve this? My app doesn't touch channel types. The signature of Tcl_FindNamespace hasn't changed, so please don't change the slot. Congrats, you have succesfully broken something that remains identical. True, the old is still there, but hidden from me now due to the order of the include files. Yet more stupid macros will be needed to support the backward compatibility.. Oh the joy.. If you refuse to fix it, I'll do it then.
- login: "davygrvy"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "davygrvy"
- icomment:
Ticket change [f7ee850a83] (rid 91452) by davygrvy on 2003-09-11 10:16:43:
- assignee changed to: "davygrvy"
Ticket change [690196c58e] (rid 103168) by dkf on 2003-09-11 15:09:57:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=79902 I refuse to fix it because I believe you are trying to do something that is not supported. If you build against 8.x (x=[1..4]) then you can load into 8.5 and that will work. But building against one version and loading into a previous version? That's peverse. It won't work in general. This is just yet another reason why not. (And if you use any of the other namespace APIs that I didn't expose, if I get around to exposing those they may well be completely different anyway.) dgp: Why on *earth* would we want to support that form of compatability? Give me a good enough reason and I'll find a way around this, but right now I think it is a feature we do *not* want. (davygrvy: this is a policy decision so please do not change anything until we have had some more clarification, and even then I volunteer to do it since I've grokked the stubs generator fairly recently.)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [2f002363c0] (rid 92978) by dgp on 2003-09-12 00:05:44:
- icomment:
Logged In: YES user_id=80530 Well, I understand why it's desirable for an extension author to have both things: 1) Use of the latest Tcl for himself; 2) Support for the earliest Tcl possible used by the users of his compiled, stub-enabled extensions. It's a bit less clear to me, given your talk of changing struct sizes whether support is 100% feasible. Even less so if we're talking about extensions that intrude into the Tcl internals. (for example, http://mini.net/tcl/3708 ) Another thing that's clear to me is that we are suffering from bad decisions made long ago, by none of us, so we could benefit from a lot of mutual patience looking into this. There's an extra complexity here that, technically, until TIP 139, Tcl_FindNamespace has been a private interface, and we've been fairly ruthless about dropping compatibility of private interfaces at minor releases. So the current HEAD is justifiable. From that perspecitve, extensions that call the newly public Tcl_FindNamespace should just be sure to Tcl_InitStubs(interp, "8.5", 0); because Tcl_FindNamespace first appears in Tcl 8.5. That said, Tcl_FindNamespace and friends are used by many good and faithful Tcl'ers, and Tcl extensions, and it's worthwhile to find a better way to accomodate them if we can. Technically, this seems similar to the issues in TIP 27 (CONSTification). A symbol is defined in two consecutive releases of Tcl to mean different things, and we have compatibility problems with people who did not expect it to change. Seems we could adopt a compatibility support simlar to the TIP 27 compatibility support. with a USE_PRIVATE_NAMESPACE_API macro, that when #define 'd, would suppress the definition of the newly exposed and not re-named routines by tcl.h, so that they'd be available for definition by tclInt.h for those naughy extensions that are #include-ing it. The default would be to not #define USE_PRIVATE_NAMESPACE_API, and the new Namespace routines would have their new, and future definitions, of pointing into the public stub table. Default operation ought to be the recommend usage going forward, not looking back.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "dgp"
- icomment:
Ticket change [2f28494afd] (rid 93013) by davygrvy on 2003-09-14 04:49:22:
- icomment:
Logged In: YES user_id=7549 The technical difficulty can be described in an analogy. The door remains identical (same sig), but the locks have been changed (new slot in public). The old key still works in the new locks, but the new key won't work in the old locks (new slot is NULL, old slot hidden from view). If tclStubLib.c could fill in the new slot when NULL, both keys will work in both locks. As the memory for where the Stubs table is located is in static memory owned by the core, a new table of the type the extension understands will need to be made that it copies into and fills from the old into the new and forwarding the new public ones from the the private table when required. Ex: memcpy(newTclStubsPtr, tclStubsPtr, sizeof(TclStubs)); if (newTclStubsPtr->tcl_FindNamespace == NULL) { newTclStubsPtr->tcl_FindNamespace = tclIntStubsPtr- >tcl_FindNamespace; } The difficulty I see is not knowing the size of the table. A tclStubsPtr->size does not exist and is assumed larger than it is. Now if magic got replaced to a sizeof(TclStubs) by tclStubInit.c that would help, but.. Complicated, but probably not impossible to work around. - login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [8a314d7353] (rid 127354) by dkf on 2003-09-14 05:12:26:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Eh? We're not backporting the TIP (or, for that matter, changes to the stub architecture) into 8.4 since that would just make sure that people linking against a release would have problems (as opposed to people playing around with pre-alpha stuff!) and we want new code to use the new stub positions. While I am contemplating adding a #define that will allow the API user to force the use of the old API, that's not done yet. You were using a private API, now you are going to be using a public API (which has coincidentally the same names due to a cock up in the private API naming.) There is no reasonable reason to assume that anything compiled against the new public version will work against the old private one. I might make it work in the future, but IMHO that's an unsupported bonus. Won't fix tonight though. Too tired ;)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [9a60debba2] (rid 110934) by dgp on 2003-11-18 06:36:08:
- assignee changed to: "dgp"
Ticket change [4a2e6844cc] (rid 126495) by dgp on 2003-12-12 20:47:01:
- priority changed to: "7 High"
Ticket change [966d25a414] (rid 106323) by davygrvy on 2003-12-23 03:30:37:
- icomment:
Logged In: YES user_id=7549 Here's a recent [Incr Tk] patch: diff -c -r1.12 -r1.13 *** itk_cmds.c22 Jun 2001 04:38:54 -00001.12 --- itk_cmds.c22 Dec 2003 20:21:43 -00001.13 *************** *** 113,122 **** ClientData parserInfo; extern ItkStubs itkStubs; ! if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; }; ! if (Tk_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; }; if (Itcl_InitStubs(interp, ITCL_VERSION, 1) == NULL) { --- 113,122 ---- ClientData parserInfo; extern ItkStubs itkStubs; ! if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) { return TCL_ERROR; }; ! if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { return TCL_ERROR; }; if (Itcl_InitStubs(interp, ITCL_VERSION, 1) == NULL) { building against 8.4 we could run in any core 8.1+, now we can't. Now we can only run in at or greater than what we build against. Do you understand my problem with this change? - login: "davygrvy"
- mimetype: "text/plain"
- resolution changed to: "None"
- username: "davygrvy"
- icomment:
Ticket change [5f95c6fd81] (rid 115840) by dkf on 2003-12-23 04:10:53:
- icomment:
Logged In: YES user_id=79902 On one level, yes. On another, no. You were relying on the fact that, for certain APIs within Tcl, you could link against a version 8.x (where x is the latest) and load into a version 8.y (which is older) and have things work. Which is a nice trick, but doesn't always work. And in fact, had you been using other APIs you would have had a major problem in the switch from 8.3 to 8.4. The real problem is that a private API subset in 8.0 received public names. (I don't know who's fault that was.) When a previously private API becomes public, there is no reasonable expectation that things built against the public API will be able to work with the private API. What you are trying to do (I'm not sure what the term for it is; backward co-compatability?) exceeds the design parameters of the Stubs system. The problem I have with doing something to work around this (which isn't actually hard to do) is relating to policy: * Is this behaviour which we wish to support? * Do we want a specific or a general solution? * Is there any way to limit the time period for which such support will be offered? Once I know the policy of the fix, implementing the policy is trivial. A possible workaround would be to copy the #defs which fix things (without their guard #ifndefs) from tclIntDecls.h into your code. That's not a supported, but neither is #include of tclInt.h by non-core code in the first place... ;^)
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "dkf"
- icomment:
Ticket change [2c7576eff3] (rid 118907) by davygrvy on 2003-12-23 04:18:13:
- icomment:
Logged In: YES user_id=7549 I'll try experimenting with this in the interim: /* * Fix Tcl bug #803489 the right way. We need to use the old Stub slot * positions, not the new broken ones. */ #if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) # undef Tcl_CreateNamespace # define Tcl_CreateNamespace (tclIntStubsPtr- >tcl_CreateNamespace) # undef Tcl_DeleteNamespace # define Tcl_DeleteNamespace (tclIntStubsPtr- >tcl_DeleteNamespace) # undef Tcl_AppendExportList # define Tcl_AppendExportList (tclIntStubsPtr- >tcl_AppendExportList) # undef Tcl_Export # define Tcl_Export (tclIntStubsPtr->tcl_Export) # undef Tcl_Import # define Tcl_Import (tclIntStubsPtr->tcl_Import) # undef Tcl_ForgetImport # define Tcl_ForgetImport (tclIntStubsPtr- >tcl_ForgetImport) # undef Tcl_GetCurrentNamespace # define Tcl_GetCurrentNamespace (tclIntStubsPtr- >tcl_GetCurrentNamespace) # undef Tcl_GetGlobalNamespace # define Tcl_GetGlobalNamespace (tclIntStubsPtr- >tcl_GetGlobalNamespace) # undef Tcl_FindNamespace # define Tcl_FindNamespace (tclIntStubsPtr- >tcl_FindNamespace) # undef Tcl_FindCommand # define Tcl_FindCommand (tclIntStubsPtr- >tcl_FindCommand) # undef Tcl_GetCommandFromObj # define Tcl_GetCommandFromObj (tclIntStubsPtr- >tcl_GetCommandFromObj) # undef Tcl_GetCommandFullName # define Tcl_GetCommandFullName (tclIntStubsPtr- >tcl_GetCommandFullName) #endif
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [b24f87fe10] (rid 98312) by dkf on 2003-12-23 04:28:17:
- icomment:
Logged In: YES user_id=79902 That's fine, except for the phrase "new broken ones" in the comment, which should be "new public ones which didn't exist in 8.4 and earlier". :^)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [e188a043cb] (rid 87466) by davygrvy on 2003-12-23 04:36:18:
- icomment:
Logged In: YES user_id=7549 ok, I'll conceed, but not willingly. They where there before, but private. This is a new concept.. moving functions from the private headers to the public, but in doing so, please don't change the slot positions. It's just the slot move that is the problem. How can the slot positions stay the same and just the public scope get changed only? That's the trick to this.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [8569df3909] (rid 131308) by davygrvy on 2003-12-23 05:04:39:
- icomment:
Logged In: YES user_id=7549 I need to retract my concession. The slot change IS the problem, not the scope change. [Incr Tcl] needs to #include <tclInt.h> for still a number of reasons beyond just the Tcl_Namespace struct and those function referencing it. Yes, it's all good that they're moving to public scope now. I agree with the scope move. But I strongly disagree with the Stubs table slot moves (by the result of the #inlude ordering). Adds are great, but NOT subtractions. Please don't change the stots, but do change the scope. Yes, genStubs.tcl doesn't play that tune. How can it? If it could, moves like this will be painless. Now how could, if we can dream ideas, tclstub85.lib work this change when loaded into 8.4? dreamily I say, just make a whole copy of the core's Stubs table and fill it in with the moved functions. Unfortunetly, we don't know the size of the structs (hooks included).
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [048ccc604b] (rid 120015) by davygrvy on 2003-12-23 14:35:32:
- icomment:
Logged In: YES user_id=7549 FWIW: [Incr Tcl] can still compile against 8.0.5. I just did it. So don't bother to bring up the argument about how I should call Tcl_InitStubs with TCL_VERSION instead of hardcoded @ "8.1". I know what I'm doing.. Trust me. With those adaption macros now in itclInt.h things are looking OK as I can fix this without too much pain on the user side. You can close this bug report if you want.
- login: "davygrvy"
- mimetype: "text/plain"
- username: "davygrvy"
- icomment:
Ticket change [9affc2ad4f] (rid 111048) by dkf on 2003-12-26 21:08:49:
- assignee changed to: "dkf"
- closedate changed to: "2003-12-26T14:08:49"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Just a note that the old stubs slots are still filled and will continue to be so during the remainder of the 8.* line. All bets are off for Tcl9 because one thing we will definitely do at an early stage is refactor the stubs table. (Closing as Won't Fix as this is just unsupported behaviour. I'm happy that we've found a way to fix this at the practical level though.)
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Wont Fix"
- status changed to: "Closed"
- username: "dkf"
Ticket change [29eacd9fa3] (rid 118467) by nijtmans on 2010-07-03 03:46:54:
- icomment:
Taking the risk of re-opening this discussion, Tcl 8.6 did it again: The function TclBackgroundException turns out to have exactly the same problem as mentioned in this bug report. If David wants to take the risk to be shot in the foot, let hem ;-). But in this case, Tcl should not be the one pulling the trigger, since there is such an easy solution. Providing a new supported API to extension writers is one thing, forcing it to be used is another. Even though this behaviour is unsupported, everything is better than the current Itcl 3.4 hack........
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [b54b66e404] (rid 125219) by nijtmans on 2010-07-03 03:46:55:
- assignee changed to: "nijtmans"
- foundin changed to: "obsolete: 8.6b1.1"
- resolution changed to: "Accepted"
- status changed to: "Open"
Ticket change [21392c6c59] (rid 130544) by nijtmans on 2010-07-03 03:50:43:
- closedate changed to: "2010-07-02T20:50:43"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Fixed in HEAD and Tcl 8.5 branch.
- login: "nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "nijtmans"