Artifacts Associated With Ticket 4b22d84a
Ticket change [89e2e62adb] (rid 250299) by sheckandar on 2026-01-11 00:18:40:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
System: Red Hat 8.10<br> TCL was compiled from source<br> config switches: ./configure --disable-shared<br> <br> Example:<br> ``` const ::test::test 1 Segmentation fault (core dumped) ``` If a namespace in question already exists, there are no issues.
- foundin initialized to: "9.0.3"
- is_private initialized to: "0"
- login: "sheckandar"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9d347483fb495b3c59ef6391e76ecb89e180afd2"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "sheckandar"
- subsystem initialized to: "07. Variables"
- title initialized to:
Core Dump when setting const with non-existent namespace
- type initialized to: "Bug"
Ticket change [8f5c1a9ca9] (rid 252065) by stu on 2026-03-13 11:35:56:
- icomment:
Index: generic/tclExecute.c --- generic/tclExecute.c.orig +++ generic/tclExecute.c @@ -4214,6 +4214,11 @@ TEBCresume( TRACE("\"%.30s\" \"%.30s\" => ", O2S(part1Ptr), O2S(objPtr)); varPtr = TclObjLookupVarEx(interp, part1Ptr, NULL, 0, NULL, /*createPart1*/1, /*createPart2*/0, &arrayPtr); + if (!varPtr) { + /* Maybe use TCL_LEAVE_ERR_MSG in the lookup call? */ + msgPart = "problem!"; + goto constError; + } doConst: if (TclIsVarConstant(varPtr)) { TRACE_APPEND("already constant\n"); - login: "stu"
- mimetype: "text/plain"
- icomment:
Ticket change [005255e918] (rid 252066) by stu on 2026-03-13 11:36:54:
- icomment: "There should be a test for this as well."
- login: "stu"
- mimetype: "text/plain"
Ticket change [9084d2dd80] (rid 252078) by apnadkarni on 2026-03-13 14:26:51:
- icomment: "Proposed fix in [ba4d418633]."
- login: "apnadkarni"
- mimetype: "text/x-fossil-plain"
Ticket change [eec7e42271] (rid 252083) by stu on 2026-03-13 17:32:53:
- icomment:
Not "goto constError;" or even "goto gotError;" ? That seems to be the normal exit route.
- login: "stu"
- mimetype: "text/plain"
- icomment:
Ticket change [5fc794d186] (rid 252084) by apnadkarni on 2026-03-13 18:03:19:
- icomment:
@stu, which line are you referring to? It does do "goto gotError".
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [8c62b04a2d] (rid 252085) by stu on 2026-03-13 18:28:06:
- icomment:
Ok, so the link in your message isn't or is only part of the fix. These are the changes I thought I'd see [cfc42afaa005ed5d].
- login: "stu"
- mimetype: "text/x-fossil-plain"
- icomment:
Ticket change [29c26fc151] (rid 252086) by stu on 2026-03-13 18:29:36:
- icomment:
Also, looks like the code in that file does: if (!varPtr) not: if (varPtr == NULL)
- login: "stu"
- mimetype: "text/plain"
- icomment:
Ticket change [bf9a90f2ae] (rid 252087) by stu on 2026-03-13 18:37:36:
- icomment:
Also, if TCL_LEAVE_ERR_MSG is being used, isn't there a way to get that result and put it into msgPart, which should probably be set anyway? Also also, "variable not found" isn't the right error. In the testcase, the error returned is "parent namespace doesn't exist" - who knows what other errors could be returned? I think the way to go is to put the interp result err string into msgPart then jump to constError.
- login: "stu"
- mimetype: "text/plain"
- icomment:
Ticket change [9a7d7d6e17] (rid 252088) by apnadkarni on 2026-03-14 02:33:10:
- icomment:
I don't want to jump to constError because it uses other variables whose status I do not know on the jump to doConst (remember varPtr was not set) and I do not want to trace backward to jump points. "variable not found" is only used if the interpreter does not already have an error message. If it does, it is preserved (which again, is not the case with constError). Setting msgPart is not trivial because it expects a static string. Pointing it to content of interp result requires more book keeping. Also note constError is only used in that code block for errors related to arrays. Otherwise gotError is used (see the line 3692 in the last code block before constError. I do not use ! with pointers. Stylistic choice. Shrug.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [ccc86370e4] (rid 252106) by apnadkarni on 2026-03-14 10:32:00:
- closedate changed to: "2461113.9388980903"
- closer changed to: "apnadkarni"
- login: "apnadkarni"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [f08f25a55b] (rid 252125) by stu on 2026-03-14 13:08:28:
- closedate changed to: "2461114.0475499304"
- closer changed to: "stu"
- icomment:
TclExecute.c has 4 "if (varPtr == NULL)" 8 "if (!varPtr)" *not-too-impressed-shrug*
- login: "stu"
- mimetype: "text/plain"