Tcl Source Code

View Ticket
Login
Ticket UUID: 6ce3c0de9d6123f0c17a134e0723946bc85d00db
Title: Temporary folder with file "tcl9registry13.dll" remains after "exit"
Type: Bug Version: 9.0b4.1
Submitter: anonymous Created on: 2024-09-12 13:35:30
Subsystem: 32. registry Package Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2024-09-13 07:54:25
Resolution: None Closed By: nobody
    Closed on:
Description:
Command "package require registry" allocates a temporary subfolder of user's %TEMP% folder containing 1 single file "tcl9registry13.dll". Temporary folder and file remain after "exit".
Test case:
- Open new tcl 9.0 shell
- execute commands:
  package require registry
  exit
- Open user's folder %TEMP% in explorer
- Each run of test case allocates 1 additional subfolder "TCL*" with random suffix containing file "tcl9registry13.dll"
User Comments: jan.nijtmans added on 2024-09-13 07:54:25:
> It would be great to find a smart solution here

Let's go for the smart solution: use the CRC of the dll (which is already calculated, it's in the zip-file) in the directoryname, in stead of the "random suffix".

I added this bug to the "Known bugs" section of 9.0

jan.nijtmans added on 2024-09-13 07:40:18:

Independent from the question whether the registry dll should be statically linked or not, users should be able to include their own dll's in the executable without recompiling the executable.

Idea: why not use the CRC of the dll in the temporary folder name in stead of some random number? Then, if the dll has the same content (what it should have) it will be unpacked in the same directory, and if unpacking fails (which will happen if the dll is already loaded and locked) it means the file is already there. Two dll's with the same name and the same CRC but which really are different is extremely unlikely.


oehhar added on 2024-09-13 06:15:40:

There is also no reason that those are DLL's. They may just be in the core.

+1 to always link them static.

Harald


apnadkarni added on 2024-09-13 03:03:34:

Any reason not to always link tclregistry and tcldde statically into the tcl dll? I have never quite understood why they were separate dll's to begin with.


sebres added on 2024-09-12 19:49:54:

No, the proper solution is not to put registry dll to the (zipped) library at all, but link it statically (in case of --enable-zipfs) and then load it by package require with `load {} registry`.


oehhar added on 2024-09-12 17:46:26:
I suppose, this is the same issue, as in starkits.
TCL can not clean-up the file, as the dll is loaded by the executable and thus locked until exit.
My personal solution (for starkits) is to search the temp folder for any TCL* and delete them. You can not remove the one of the current running program, as it is locked.
It would be great to find a smart solution here.
One not so smart solution is to not put any dll's into the included zip folder, but locate them beside the executable.

Sorry,
Harald