Overview
| Artifact ID: | e970d187ff3f90b52e2b967592d3c8005d6006508fe91f672fc5f5d143d6ac91 |
|---|---|
| Ticket: | 8cd2fe747463756f4a4a31f726c2c0163ecde2ff
"unload" command Bug (when handling multiple libs) |
| User & Date: | BERC on 2019-11-12 09:57:52 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
In tclLoad.c (i.e. https://core.tcl-lang.org/tcl/artifact/76192e755eed7560) there is a bug which occurs when a library is unloaded. In the part "Remove this library from the interpreter's library cache.", the next pointers of the linked list are not properly updated. ipFirstPtr = Tcl_GetAssocData(target, "tclLoad", NULL); ipPtr = ipFirstPtr; if (ipPtr->pkgPtr == defaultPtr) { ipFirstPtr = ipFirstPtr->nextPtr; } else { InterpPackage *ipPrevPtr; for (ipPrevPtr = ipPtr; ipPtr != NULL; ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) { if (ipPtr->pkgPtr == pkgPtr) { ipPrevPtr->nextPtr = ipPtr->nextPtr; break; } } } should be ipFirstPtr = Tcl_GetAssocData(target, "tclLoad", NULL); ipPtr = ipFirstPtr; if (ipPtr->pkgPtr == defaultPtr) { ipFirstPtr = ipFirstPtr->nextPtr; } else { InterpPackage *ipPrevPtr; for (ipPrevPtr = ipPtr; ipPtr != NULL; ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) { if (ipPtr->pkgPtr == defaultPtr) { ipPrevPtr->nextPtr = ipPtr->nextPtr; break; } } } So the check "(ipPtr->pkgPtr == pkgPtr)" should really be "(ipPtr->pkgPtr == defaultPtr)" With this bug, one can get error messages when first unloading a lib (works properly) and then unloading another one (will return error "has never been loaded in this interpreter" because it cannot be find in the list, because the linked list has been corrupted. - foundin changed to: "Tcl 9.0a0 and older"
- is_private changed to: "0"
- login: "BERC"
- priority changed to: "5 Medium"
- private_contact changed to: "efbd17cefb5d0a14113ad516213d53b903e99650"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "BERC"
- subsystem changed to: "38. Init - Library - Autoload"
- title changed to: ""unload" command Bug (when handling multiple libs)"
- type changed to: "Bug"