.
D 2026-05-07T18:11:05.016
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-plain
J comment I\sget\sthe\sfeeling\sthat\sTIP59's\sTcl_RegisterConfig\sdoesn't\ssee\smuch\suse,\sbut\sI\srely\son\sit\sto\sprovide\sstubs-exporting\spackage\sinfo\sto\sstubs-consuming\sjit\scompiled\sc\scode,\sto\smake\savailable\sthe\sinfo\son\sthe\sexporting\spackage's\slibrary,\sheader\sand\sother\sinfo\snot\sreliably\savailable\sotherwise.\s\sI\scould\sinvent\smy\sown\sprotocol\sfor\sthat\sbut\sTcl_RegisterConfig\sseems\slike\sthe\sintended\smechanism\sfor\sthat.\r\n\r\nThe\sissue\sis\sthat\s(in\scontradiction\sto\sthe\sTcl_RegisterConfig\sdocumentation),\sthe\ssupplied\svalues\s*ARE*\scopied\s(which\sis\sok,\sand\sbetter\sfor\smy\suse\scase),\sbut\scalling\sa\ssecond\stime\swipes\sout\sthe\sexisting\sregistration\s(after\sseemingly\strying\sto\smerge\sthe\snew\sinfo\swith\sit):\r\n\r\n\s\s1.\sA\sfresh\sQCCD\s*cdPtr_2\sis\sallocated.\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s2.\sPhase\sI\sretrieves\sthe\sexisting\spkgDict\sfrom\spDB,\smutates\sit\s(or\sits\sduplicate\sif\sshared)\sby\sadding\sthe\scall's\snew\skey/value\r\n\s\spairs,\sand\swrites\sit\sback:\spDB[pkgName]\s=\spkgDict\snow\scontains\sthe\smerged\sold\s+\snew\sentries.\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s3.\sPhase\sII\scalls\sTcl_CreateObjCommand("::demopkg::pkgconfig",\s...,\scdPtr_2,\sQueryConfigDelete).\r\n\s\s4.\sBecause\sthe\scommand\salready\sexists,\sTclCreateObjCommandInNs\s(tclBasic.c:2896)\sdeletes\sthe\sold\sCommand\svia\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\sTcl_DeleteCommandFromToken,\swhich\ssynchronously\sfires\sQueryConfigDelete\sfor\sthe\sold\scdPtr_1.\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s5.\sThat\sdelete\sproc\sruns\s(tclConfig.c:324-338):\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\sTcl_DictObjRemove(NULL,\spDB,\spkgName);\s\s\s//\sremoves\sthe\smerged\sdict\swe\sjust\sput\sin!\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\sTcl_DecrRefCount(pkgName);\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\sTcl_Free(cdPtr->encoding);\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\sTcl_Free(cdPtr);\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s6.\sThe\smerged\ssub-dict's\srefcount\sdrops\sto\szero,\sfreeing\sall\sthe\sbyte-array\svalue\scopies\sand\sstring-key\scopies\sfrom\sboth\sthe\sfirst\s\r\n\s\sand\ssecond\scalls.\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\r\n\s\s7.\sThe\snew\scommand\sis\sthen\screated\sbound\sto\scdPtr_2,\sbut\spDB\shas\sno\sentry\sfor\spkgName\sany\smore.\r\n\r\nCould\sthe\ssequence\sbe\schanged\sso\sthat\sthe\ssecond\sTcl_RegisterConfig\scall\sdoes\sthe\sunsurprising\sthing\sand\smerges\sin\sthe\spassed\sconfig\skeys?\r\n\r\nVerified\sin\s8.6\sand\s9.0
J foundin 8.6-9.0
J is_private 0
J login anonymous
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem 54.\sConfiguration\sReporting
J title Tcl_RegisterConfig\sidempotency\sissue
J type Bug
K 67769bcad3b177aaf9474f8d0a07c2242a18a7f1
U anonymous
Z 4aa72fca7adb4459fcc882200731d818