2025-08-23
| ||
00:55 | • Ticket [87b69745be] interp creation resets encoding directory search path status still Closed with 5 other changes artifact: 9a899b1494 user: apnadkarni | |
2025-08-22
| ||
18:19 | • Ticket [87b69745be]: 5 changes artifact: 32be6af7ca user: dgp | |
2025-08-18
| ||
11:50 | • Ticket [87b69745be]: 5 changes artifact: 461601b4df user: jan.nijtmans | |
11:49 | Fixed inconsistent indenting, introduced [0433b67adc|here]. See also [87b69745be] check-in: ee22d2717f user: jan.nijtmans tags: core-9-0-branch | |
2025-08-14
| ||
13:47 | • Closed ticket [87b69745be]: interp creation resets encoding directory search path plus 6 other changes artifact: 0ec3ebc0c1 user: apnadkarni | |
13:44 | Merge 9.0 - Fix [87b69745be] - move zipfs encoding initialization outside of interp creation. Avoid ... check-in: dc30526e24 user: apnadkarni tags: trunk, main | |
13:32 | Fix [87b69745be] - move zipfs encoding initialization outside of interp creation. Avoid unnecessary ... check-in: 0433b67adc user: apnadkarni tags: core-9-0-branch | |
13:29 | • Ticket [87b69745be] interp creation resets encoding directory search path status still Open with 3 other changes artifact: 153218dfc5 user: apnadkarni | |
11:47 | • Ticket [87b69745be]: 3 changes artifact: 3f2c8da63a user: sebres | |
11:32 | • Ticket [87b69745be]: 3 changes artifact: f639f702d5 user: apnadkarni | |
2025-08-13
| ||
18:26 | • Ticket [87b69745be]: 3 changes artifact: 08d87ed52b user: sebres | |
17:28 | • Ticket [87b69745be]: 3 changes artifact: 5c15e9e054 user: apnadkarni | |
16:11 | • Ticket [87b69745be]: 3 changes artifact: 1aa7e19a58 user: sebres | |
2025-08-06
| ||
13:53 | • Ticket [87b69745be]: 3 changes artifact: 4e601f7307 user: apnadkarni | |
13:40 | • Ticket [87b69745be]: 3 changes artifact: cc17ddef57 user: apnadkarni | |
2025-08-03
| ||
15:22 | Proposed fix for [87b69745be]. Move search of zipfs to process initialization, not interp initializa... check-in: 52fd62e7af user: apnadkarni tags: bug-87b69745be | |
2025-07-31
| ||
13:57 | Add test for [87b69745be]. check-in: 22b16f96a8 user: apnadkarni tags: bug-87b69745be | |
05:16 | • Ticket [87b69745be] interp creation resets encoding directory search path status still Open with 3 other changes artifact: 29ca2d9a94 user: apnadkarni | |
05:00 | • New ticket [87b69745be]. artifact: 45d33afd66 user: apnadkarni | |
Ticket UUID: | 87b69745be15c2816574ec415dfe2c3c407cc5d6 | |||
Title: | interp creation resets encoding directory search path | |||
Type: | Bug | Version: | 9.0 | |
Submitter: | apnadkarni | Created on: | 2025-07-31 05:00:27 | |
Subsystem: | - New Builtin Commands | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2025-08-23 00:55:54 | |
Resolution: | Fixed | Closed By: | apnadkarni | |
Closed on: | 2025-08-23 00:55:54 | |||
Description: |
| |||
User Comments: |
apnadkarni added on 2025-08-23 00:55:54:
What is the test configuration in which you are seeing errors? Neither my tests not Github CI showed any failures on any platform before I committed. On the current core-9-0-branch, Github CI still shows no failures and now I re-tested the following combinations on Ubuntu: ``` configure make test make test TESTFLAGS="-singleproc 1" configure --disable-shared make test make test TESTFLAGS="-singleproc 1" configure --disable-zipfs make test make test TESTFLAGS="-singleproc 1" ``` as well as the equivalents on Windows ``` nmake /f makefile.vc test nmake /f makefile.vc test TESTFLAGS="-singleproc 1" nmake /f makefile.vc OPTS=static test nmake /f makefile.vc OPTS=static test TESTFLAGS="-singleproc 1" nmake /f makefile.vc OPTS=noembed test nmake /f makefile.vc OPTS=noembed test TESTFLAGS="-singleproc 1" ``` None show any failures. Failing on ASCII input 0x7f is very strange indeed and if it seems to happen only on your system stranger still. Something uninitialized in specific circumstance...? What platform are you on and what were the specific configure and test options? dgp added on 2025-08-22 18:19:08: On core-9-0-branch, starting with checkin [0433b67adc], I see 114 failing tests in cmdAH.test and encoding.test. The first of them is ==== cmdAH-4.3.13.7F.solo.ascii.strict.a encoding convertfrom -profile strict ascii FAILED ==== Contents of test case: encoding convertfrom -profile strict ascii ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: unexpected byte sequence starting at index 0: '\x7F' while executing "encoding convertfrom -profile strict ascii " ("uplevel" body line 1) invoked from within "uplevel 1 $script" ---- errorCode: TCL ENCODING ILLEGALSEQUENCE 0 ==== cmdAH-4.3.13.7F.solo.ascii.strict.a FAILED How can I help unbreak the branch?? jan.nijtmans added on 2025-08-18 11:50:40: Review remark: indenting in tclEncoding.c is not consistent. All other files in this commit are fine. Fixed [ee22d2717fc9d6c3|here]. Sorry, Ashok. apnadkarni added on 2025-08-14 13:47:18: Fixed in [0433b67adc]. Broader thread safety issues with systemEncoding to be addressed separately. apnadkarni added on 2025-08-14 13:29:56: Yes of course. But tracking that as a separate bug that you have already logged (and I duplicated yesterday) as the required solution is much broader (as you also stated). The possibility of race conditions in encoding routines is much greater and has to be fixed. sebres added on 2025-08-14 11:47:28: No problem. > to convince oneself there are no race conditions or other effects But there is a race condition issue. The possibility to overwrite a system encoding from every thread (also protected by mutex) will cause that previously set system-encoding, which can be still used by other threads with other functions (see ticket [f2ff05fc84]) may get released (by last reference). And your extra mutex doesn't protect against it at all. Sure, it makes that not more worse as it was, but the lock protection is definitely overestimated... apnadkarni added on 2025-08-14 11:32:48: @sebres, I'm merging my original code. What you said about not requiring a lock may well be true but except in performance critical paths (this is not one), I prefer to stick with the lock for shared data in the general belief that ensuring access is safe without locks needs careful thought and is prone to errors (possibly even in future when code is modified). Not worth the time spent, imo, to convince oneself there are no race conditions or other effects. sebres added on 2025-08-13 18:26:22:
Yes, as already confirmed in the core mailing list, you are right and this is indeed reentrant now (changed in 8.7+ after TIP#509).
And if it is compared by locked mutex what would it change? The only solution would be something like I provided in [f2ff05fc84], or system encoding stored per thread (TSV).
No. In this particular comparison it doesn't change something, since it is only protection against increase of FS epoch and function simply returns if it is equal now. Few nanoseconds later or earlier it may be different (no matter with or without lock). With already mentioned consequences. Feel free to revert it (mark may change as mistake branch and reset tags to previous commit), if you don't like it. But I guess in case of possible race condition, you overestimate the lock protection here and underestimate the consequences of conceptual bug (the issue by "wrong" design - thread-safety of the system encoding). apnadkarni added on 2025-08-13 17:28:33: @sebres, I am not in agreement with your mods. First, as I mentioned in the core mailing list, Tcl mutexes are recursive as far as I can tell. Second, I do not like the comparison of systemEncoding outside of holding the mutex. Globals shared between threads should be accessed under a lock even when reading. While I could probably create a case where that comparison of defaultEncoding and systemEncoding is a race condition, as a matter of principle the safer route is always accessing under a lock instead of proving it is safe. In fact, looking at the management of systemEncoding without locks led me to create this (unrelated) ticket about whether more fixes related to systemEncoding synchronization are needed. Of course, things are different if Tcl mutexes are not recursive and I misunderstood the manpage. sebres added on 2025-08-13 16:11:19:
After a quick review, I don't entirely agree with the changes in Additionally note that this mutex only protect the hash table of encodings and encoding' refCount, it doesn't really protect static systemEncoding (nor the defaultEncoding) directly. Let alone it'd be still affected by [f2ff05fc84] and co. Commit [bf62ce24c60c7b8a] shall fix it now. apnadkarni added on 2025-08-06 13:53:41: Reminder to self - need to investigate if wish / Tk have a similar issue. apnadkarni added on 2025-08-06 13:40:50: Branch bug-87b69745be contains a proposed solution to this and other zipfs related encoding bugs that previously contained point fixes.
Review requested. apnadkarni added on 2025-07-31 05:16:21: Looks like the bug was introduced with commit [450d12dac5]. |