Artifacts Associated With Ticket 33b248619922b878
Ticket change [7de532c225] (rid 219493) by dgp on 2023-10-16 21:46:06:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Using Tcl's tip of core-8-branch and Thread's tip of thread-2-8-branch: $ make test-tcl TESTFLAGS='-singleproc 1 -file "chanio.test clock.test" -match "chan-io-70.1 clock-58.1" -verbose bpste' ... chanio.test ---- chan-io-70.1 start ++++ chan-io-70.1 PASSED clock.test ---- clock-58.1 start ==== clock-58.1 clock l10n - Japanese localisation FAILED ==== Contents of test case: set trouble {} foreach {date jdate} { 1872-12-31 西暦1872年12月31日 1873-01-01 明治06年01月01日 1912-07-29 明治45年07月29日 1912-07-30 大正01年07月30日 1926-12-24 大正15年12月24日 1926-12-25 昭和01年12月25日 1989-01-07 昭和64年01月07日 1989-01-08 平成01年01月08日 2019-04-30 平成31年04月30日 2019-05-01 令和01年05月01日 } { set status [catch { set secs [clock scan $date -timezone +0900 -locale ja_JP -format %Y-%m-%d] set jda [clock format $secs -timezone +0900 -locale ja_JP -format %Ex] } result] if {$status != 0} { append trouble \n $date " gives error " $result } elseif {$jda ne $jdate} { append trouble \n $date " converts to " [backslashify $jda] " and should be " [backslashify $jdate] } # There is no code for scanning dates on the locale's # alternative calendar. continue set status [catch { set secs [clock scan $jdate -timezone +0900 -locale ja_JP -format %Ex] set da [clock format $secs -timezone +0900 -locale ja_JP -format %Y-%m-%d] } result] if {$status != 0} { append trouble \n [backslashify $jdate] " gives error " $result } elseif {$da ne $date} { append trouble \n [backslashify $jdate] " converts to " $da " and should be " $date } } set trouble ---- Result was: \x0A1872-12-31 converts to 12/31/1872 and should be \u897f\u66a61872\u5e7412\u670831\u65e5\x0A1873-01-01 converts to 01/01/1873 and should be \u660e\u6cbb06\u5e7401\u670801\u65e5\x0A1912-07-29 converts to 07/29/1912 and should be \u660e\u6cbb45\u5e7407\u670829\u65e5\x0A1912-07-30 converts to 07/30/1912 and should be \u5927\u6b6301\u5e7407\u670830\u65e5\x0A1926-12-24 converts to 12/24/1926 and should be \u5927\u6b6315\u5e7412\u670824\u65e5\x0A1926-12-25 converts to 12/25/1926 and should be \u662d\u548c01\u5e7412\u670825\u65e5\x0A1989-01-07 converts to 01/07/1989 and should be \u662d\u548c64\u5e7401\u670807\u65e5\x0A1989-01-08 converts to 01/08/1989 and should be \u5e73\u621001\u5e7401\u670808\u65e5\x0A2019-04-30 converts to 04/30/2019 and should be \u5e73\u621031\u5e7404\u670830\u65e5\x0A2019-05-01 converts to 05/01/2019 and should be \u4ee4\u548c01\u5e7405\u670801\u65e5 ---- Result should have been (exact matching): ==== clock-58.1 FAILED - foundin initialized to: "core-8-branch"
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "25. Channel System"
- title initialized to:
clock-58.1 fails when Thread and chan-io-70.1 interfere
- type initialized to: "Bug"
Ticket change [23d5887d27] (rid 219494) by dgp on 2023-10-16 21:48:35:
- icomment:
Taking a very lightly educated guess, this might be the kind of trouble that shows up when [clock] can't find its message catalogs? So how could exercising some thread-enabled channel actions cause some inability to find and load message catalogs from the zipfs archive? Hope others can reproduce. I see it on two systems.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [1c6b4c360b] (rid 219599) by dgp on 2023-10-18 16:08:33:
- icomment:
Looks like something broken in Thread. $ make shell ... % package require Thread 2.8.9 % file system //zipfs:/app/ zipfs zip % thread::release [thread::create] 0 % file system //zipfs:/app/ native
- login: "dgp"
- mimetype: "text/plain"
- subsystem changed to: "None"
- title changed to: "[thread::release] unmounts the zipfs archive"
- icomment:
Ticket change [666dc29715] (rid 219600) by apnadkarni on 2023-10-19 16:30:15:
- icomment:
I hope to look into this over the weekend. As also the pending question of why your builds were pulling in corrupted encoding files into the constructed zip attachment and not the ones from the source directory.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [0aa5e060f7] (rid 219645) by dgp on 2023-10-20 14:35:39:
- icomment:
The outdated *.enc files were never going into the zipfs. They were brought into the interpreter because the installation directory where they were was first on the [encoding dirs] search path.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [03f245de39] (rid 219646) by dgp on 2023-10-20 16:15:08:
- icomment:
It appears that every thread finalization leads to a call to TclZipfsFinalize() within the thread getting finalized. That routine, though, doesn't seem to take any notice of which thread it is operating in, and unconditionally performs what looks like a global cleanup. This means the first finalization of any thread, disables and shuts down the zipfs subsystem, or so it appears. Unless I'm missing something. I'm really surprised such a fundamental flaw could go unnoticed for so long.
- login: "dgp"
- mimetype: "text/plain"
- severity changed to: "Severe"
- subsystem changed to: "57. zlib"
- title changed to:
zipfs becomes non-functional after first thread finalization
- icomment:
Ticket change [662ae3c384] (rid 219652) by apnadkarni on 2023-10-20 17:35:50:
- icomment:
Potential (simple) fix in branch bug-33b2486199. I'd prefer someone more knowledgeable in Tcl's IO/file system finalization to review. The fundamental problem is that there is currently no bookkeeping that I can see of which thread mounted the archive and which are still using it. Normally there would be a mount/unmount pair but since this Tcl library zip mount is implicit, it needs to be present till process exit (presumably). So I've simply added a check there for TclInExit. Not sure that is the right or complete solution but if no one has anything better to offer, I'll merge it in at some point.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [8a90cb41aa] (rid 219654) by apnadkarni on 2023-10-20 17:52:04:
- icomment:
Thinking about it a bit more, I think finalization only on TclInExit() (without explicit bookkeeping of threads) is the right solution in any case. Even after the last current Tcl thread exits, a C application could still create a new thread which would need access to the library mount so it needs to stay in place until process exit. Then again, as I said, I don't understand Tcl's initialization sequence and the above may not be true. Perhaps the right approach is to add a "Cleanup" method to the file system implementation dispatch table that gets invoked by Tcl at the "right" time. If zipfs was implemented as an extension the finalization call as currently directly invoked from TclFinalizeIOSubsystem would not be possible.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [59ece3a8b5] (rid 219659) by apnadkarni on 2023-10-21 04:45:37:
- icomment:
I've moved the ZipFSFinalize call to TclFinalizeFilesystems which I think is the correct place as it is called from Tcl_Finalize on process exit. The loop in TclFinalizeFilesystems that frees each file system in turn would be the right place to add a call to a Tcl_Filesystem.finalize method except such Tcl_Filesystem (surprisingly) does not have such a method slot defined for file systems to do their cleanup. I'm not inclined to write a TIP so hardcoded for now.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [1808dc7500] (rid 219679) by apnadkarni on 2023-10-21 15:07:26:
- icomment: "Please retest. Should be fixed."
- login: "apnadkarni"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Pending"
Ticket change [0ccc307f1e] (rid 219752) by dgp on 2023-10-23 13:12:32:
- icomment:
The core-8-branch is now testing successfully for me. Thanks!
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [acf462729c] (rid 219753) by dgp on 2023-10-23 13:12:52:
- assignee changed to: "apnadkarni"
- closedate changed to: "2460241.05060981"
- closer changed to: "dgp"
- login: "dgp"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [3a3e42f2fd] (rid 219904) by dgp on 2023-11-03 13:49:45:
- closer changed to: "nobody"
- icomment:
Seems this was only a partial fix. $ ./tcltest ../tests/zipfs.test zipfs.test: Total 508 Passed 473 Skipped 35 Failed 0 Number of tests skipped for each constraint: 23 !zipfslib 1 bug-4ae42446ab 11 win That is indeed a successful test. But.... $ ./tclsh ../tests/zipfs.test ==== bug-33b2486199 zipfs unmounted on thread exit FAILED ==== Contents of test case: set before [lsort [zipfs mount]] thread::release [thread::create] after 100; # Needed to allow the spawned thread to exit to trigger bug string equal $before [lsort [zipfs mount]] ---- Result was: 0 ---- Result should have been (exact matching): 1 ==== bug-33b2486199 FAILED zipfs.test: Total 508 Passed 472 Skipped 35 Failed 1 Number of tests skipped for each constraint: 23 !zipfslib 1 bug-4ae42446ab 11 win Some probing of the failing test shows that all zipfs mounts disappear. It's very tricky tracing through all the configure/build combinatorics in the zipfs tangle. - login: "dgp"
- mimetype: "text/plain"
- status changed to: "Open"
Ticket change [406b8f53d8] (rid 219905) by dgp on 2023-11-03 15:11:09:
- icomment:
Sorry, I think that's a false alarm.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [e829150e78] (rid 219906) by dgp on 2023-11-03 15:21:39:
- icomment:
So this is a very old problem that continues to snag me from time to time. If I do a default build on unix -- that is a --enable-shared build -- and I have previously installed an earlier build, then any tests I run will load the installed Tcl library and not the just-built one and I get test results from the old library, often a version before some important bug fix like in this case. This is why my normal development practice is to always perform --disable-shared builds so every `make test` actually tests what I am working on. And that's fine for a lot of development work, but when the two configurations potentially do not behave the same, it really gets in the way. Sometimes `make shell` is supposed to be a tool to avoid the problem, but that is not working.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [a2a55ca3b0] (rid 219907) by dgp on 2023-11-03 16:16:38:
- closedate changed to: "2460252.17822226"
- closer changed to: "dgp"
- login: "dgp"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [f207ae716b] (rid 219908) by griffin on 2023-11-03 16:51:58:
- closedate changed to: "2460252.2027616"
- closer changed to: "griffin"
- icomment:
I don't know if this would solve the problem or not: I was just thinking this morning that the "stand-alone" static tclsh should have a different name, and be part of any install. The current state of having to use --disable-shared to get the stand-alone variant, and not being able to (obviously) identify an installation as such has tripped me up several times. This means "tclsh" and "tclkitsh" (for example) would reside together in bin, being built together regardless of shard-ness option selection. I have not thought deeply about the ramifications of such a change.
- login: "griffin"
- mimetype: "text/plain"