Artifacts Associated With Ticket c574e50a3b30e76f
Ticket change [ccf02b0407] (rid 182028) by dgp on 2020-04-17 21:12:10:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
utf.test ---- utf-2.8 start Test file error: child killed: segmentation violation
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "44. UTF-8 Strings"
- title initialized to: "CRASH: utf-2.[89] in 8.5 built with TCL_UTF_MAX=4"
- type initialized to: "Bug"
Ticket change [7bcab85b94] (rid 182029) by dgp on 2020-04-18 00:00:54:
- icomment:
This trouble with a TCL_UTF_MAX=4 build arrived in https://core.tcl-lang.org/tcl/info/ee9f293421a3ce09 Didn't have the test then to expose it.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [87b135b8bb] (rid 182030) by jan.nijtmans on 2020-04-18 12:31:01:
- assignee changed to: "jan.nijtmans"
- icomment:
Indeed. Backported too much from tclUtf.c, parts that were not appropriate fro 8.5. Will fix
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Accepted"
Ticket change [a5b309ea87] (rid 182042) by dgp on 2020-04-18 14:02:39:
- closedate changed to: "2458958.0851787"
- closer changed to: "dgp"
- icomment:
Thanks. The other fix is dangling out there on a closed branch, but I like this answer better. Issue was the same initialization woes the other branches have been through.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [55399bb9cf] (rid 182043) by dgp on 2020-04-18 14:17:52:
- closer changed to: "nobody"
- icomment:
Declared victory too soon. Now for any build with TCL_UTF_MAX > 3 the tip of core-8-5-branch blocks in the tests chan-io-6.45 and io-6.45 and the test encoding-16.1 fails: ==== encoding-16.1 UnicodeToUtfProc FAILED ==== Contents of test case: set val [encoding convertfrom unicode NN] list $val [format %x [scan $val %c]] ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: expected integer but got "" while executing "format %x [scan $val %c]" ("uplevel" body line 3) invoked from within "uplevel 1 $script" ---- errorCode: TCL VALUE NUMBER ==== encoding-16.1 FAILED - login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Open"
Ticket change [d9e13784fa] (rid 182044) by dgp on 2020-04-18 14:20:33:
- icomment:
Also ==== source-7.2 source -encoding test FAILED ==== Contents of test case: set x unset source -encoding unicode $sourcefile set x ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: invalid command name "��������������������" while executing "��������������������" (file "/Users/dgp/fossil/tcl8.5/tum4/source.file" line 1) invoked from within "source -encoding unicode $sourcefile" ("uplevel" body line 3) invoked from within "uplevel 1 $script" ---- errorCode: NONE ==== source-7.2 FAILED - login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [02ca150ff1] (rid 182045) by dgp on 2020-04-18 14:54:56:
- icomment:
Problem appears to be an issue over whether sizeof(Tcl_UniChar) is 2 or 4. I think the answer is that in the 8.5 branch it should never be anything other than 2.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [6f9556e2aa] (rid 182048) by dgp on 2020-04-18 15:26:40:
- icomment:
There's still trouble here. Moving the efforts to a bug-fix branch.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [5dd34dddf9] (rid 182110) by dgp on 2020-04-20 07:37:53:
- icomment:
Found and backported the fixes for a TCL_UTF_MAX=6 build where we use UCS-4 internally. Still need to resolve what TCL_UTF_MAX=4 is going to mean on this branch. If Tcl_UniChar is UCS-2 and no surrogates, we have no place to store codepoints beyond U+FFFF, so do we convert all 4-byte sequences to the replacement character? Do we actively prevent generation of 4-byte sequences? (as in [format %c 0x10000])
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [a9e56e2554] (rid 182114) by jan.nijtmans on 2020-04-20 08:01:17:
- icomment:
> Still need to resolve what TCL_UTF_MAX=4 is going to mean on this branch Yeah, I'm thinking on that too. Originally, it meant: Use "unsigned int" for Tcl_UniChar, and support code ponts >0xFFFF. But with commit [98f64c277b5e6b2f], I tried to backport some of TIP 386 to the 8.5 branch. I regret that commit now. So if we can just undo [98f64c277b5e6b2f], and threat all values of TCL_UTF_MAX>3 to mean the same? That would make our work a lot simpler. Since TCL_UTF_MAX > 3 is - and always have been - UNSUPPORTED, it's up to use what we do with it. No one uses it, as far as I know, and a lot of test-case fail.
- login: "jan.nijtmans"
- mimetype: "text/plain"
- icomment:
Ticket change [a586e633b5] (rid 182125) by dgp on 2020-04-20 14:18:37:
- icomment:
Here are the available configurations that make sense (IMO): [A] Only 3-byte sequences supported. Internal store as UCS-2. [B] All sequences supported. Internal store as UCS-4. [C] All sequences supported. Internal store as UTF-16. [D] All sequences supported, Internal store as UCS-2. Convert all sequences representing U+10000 and higher to U+FFFD (replacement character). Is there anything else worth thinking about?
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [7fd9e14675] (rid 182126) by dgp on 2020-04-20 14:56:10:
- icomment:
With that vocabulary, we've had a history of the 8.5 releases through 8.5.19: UTF_MAX=3: [A] UTF_MAX=4: unusable FSS-UTF remnants UTF_MAX=6: unusable FSS-UTF remnants In the long time since 8.5.19, the unsupported configurations have been improved, and I think we should aim for: UTF_MAX=3: [A] UTF_MAX=4: [B] UTF_MAX=6: [B]
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [f4265e3d25] (rid 182127) by dgp on 2020-04-20 15:14:30:
- icomment:
As I read TIP 542, we expect 8.7 to offer: UTF_MAX=3: [C] (default) UTF_MAX=4: [B] UTF_MAX=6: [B]
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [e439b88bef] (rid 182128) by jan.nijtmans on 2020-04-20 15:18:00:
- icomment:
Well, about your last 2 remarks: I agree, that's exactly what I'm trying to say.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [43bbb4d4f0] (rid 182129) by dgp on 2020-04-20 15:18:36:
- icomment:
I don't think we've fully voted and spec'd the 9.0 plan yet, but it looks like we're aiming for: UTF_MAX=3: ???? (will this even be offered?) UTF_MAX=4: [B] UTF_MAX=6: [B] (again will this option be retained?)
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [4271cdabe1] (rid 182136) by dgp on 2020-04-20 15:41:46:
- icomment:
The 8.6 history and plan is messier. Start with releases 8.6.0 - 8.6.4: UTF_MAX=3: [A] UTF_MAX=4: unusable FSS-UTF remnants UTF_MAX=6: unusable FSS-UTF remnants
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [6f972059f1] (rid 182137) by dgp on 2020-04-20 19:59:26:
- icomment:
Checkin https://core.tcl-lang.org/tcl/info/e2278643dc first tried to do something better, including a first stab at some use of surrogates, but it kept in place decoding of 5- and 6-byte sequences (for TCL_UTF_MAX == 6) and it got decoding of 4-byte sequences (when TCL_UTF_MAX == 4) completely wrong, discarding the high bits. % package present Tcl 8.6.5 % format %X [scan [encoding convertfrom identity \xF0\x9F\x92\xA9] %c] F4A9 (Should be 1F4A9) There are hints that the 8.6.5 release was starting to aim for UTF_MAX=3: [A] UTF_MAX=4: [C] UTF_MAX=6: [B] but it's best to still think of the unsupported configurations as unusable.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [2bdacbdff7] (rid 182138) by dgp on 2020-04-20 20:37:16:
- icomment:
Release Tcl 8.6.6 is the same. Notably a failure of utf-2.12 in a (TCL_UTF_MAX = 6) build demonstrates it is still respecting 5-byte sequences. Mostly just as broken as 8.6.5 was. The default build (TCL_UTF_MAX = 3) continues to implement mode [A].
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [df02fef08e] (rid 182143) by dgp on 2020-04-20 21:01:16:
- icomment:
In release 8.6.7 the bug of accepting overlong sequences was fixed, and as a side effect, the (TCL_UTF_MAX = 4) build broke in a new way. % package present Tcl 8.6.7 % format %X [scan [encoding convertfrom identity \xF0\x9F\x92\xA9] %c] F0 By now though, it is reasonable to label the other two builds. UTF_MAX=3: [A] ... UTF_MAX=6: [B]
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [3e7993b262] (rid 182155) by jan.nijtmans on 2020-04-20 22:29:29:
- icomment:
> Is there anything else worth thinking about? One more: [E] Only 3-byte sequences supported. Internal store as UTF-16. This is almost the same as [A], the difference is in the translation to the internal store. [A] lets every invalid 4-byte UTF-8 sequence occupy 4 locations in the store, one for every byte (not really sensible ...). [E] stores invalid 4-byte UTF-8 sequence in 2 locations, namely the two surrogates. The translation from internal store back to UTF-8 is identical to [A]. For valid 1-, 2- or 3-byte UTF-8 sequences [E] behaves exactly the same as [A].
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [24853c7934] (rid 182184) by dgp on 2020-04-21 14:00:28:
- icomment:
Just to clarify my understanding. [A] is 4-bytes in, 8 bytes out. Either loses/corrupts unsupported characters, or demands special (also unsupported) interventions to dig them back out. [E] is 4-bytes in, 6 bytes out. Violates standards, but allows for recovery of the unsupported characters. [E] also has the indexing incompatibility issues that come along with UTF-16 getting exposed to interfaces.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [6bc05abc33] (rid 182185) by jan.nijtmans on 2020-04-21 14:18:21:
- icomment:
> [E] also has the indexing incompatibility issues that come along with UTF-16 > getting exposed to interfaces. Not if the surrogate pairs are counted a 2 characters. So the 4-byte (illegal sequences) must also be counted as 2 characters. And Tcl_UtfNext()/Tcl_UtfPrev() should be needed twice to jump over it. I did it ;-)
- login: "jan.nijtmans"
- mimetype: "text/plain"
- icomment:
Ticket change [0d9f07879b] (rid 182186) by jan.nijtmans on 2020-04-21 14:24:17:
- icomment:
The difference between [A] and [E] is impossible to detect at script level, you need things like the "identiy" encoding or "testbytestring" to detect the difference.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [9f7f8ba5bc] (rid 182187) by dgp on 2020-04-21 14:32:55:
- icomment:
One more I'll add to the menu. [F] All valid sequences accepted. ALL INVALID SEQUENCES REJECTED (error or REPLACEMENT). Internal store UCS-4. Something I think we should at least consider for Tcl 9.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [36de82a8a1] (rid 182188) by dgp on 2020-04-21 14:36:23:
- icomment:
"impossible to detect at script level" I get what you mean. Supported/recommended script commands that generate strings will not generate anything that reveals the difference. The handling of data received from channels would reveal the difference.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [ffbea21c14] (rid 182190) by dgp on 2020-04-21 14:52:56:
- icomment:
The blocking and failing tests are illustrations of existing tickets [1004065] and [1122671], recording that the encoding machinery hardcodes assumptions in multiple places that sizeof(Tcl_UniChar) == 2. Closing the segfault bug fix should not be hostage to fixing those old bugs.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [547f5d343b] (rid 182191) by jan.nijtmans on 2020-04-21 14:59:37:
- icomment:
Example: <pre> $ tclsh8.6 % puts stdout \uD800\uDC00 𐀀 % puts stdout [encoding convertfrom utf-8 \xF0\x90\x80\x80] 𐀀 % string length [encoding convertfrom utf-8 \xF0\x90\x80\x80] 2 </pre> Even though in Tcl 8.6, 4-byte sequences are illegal, the Utf2Utf encoder translates those to 2 surrogates, and everything behaves as expected. That's a better fallback than splitting it into 4 characters
- login: "jan.nijtmans"
- mimetype: "text/plain"
- icomment:
Ticket change [e0d2ea8e21] (rid 182203) by dgp on 2020-04-21 16:03:27:
- icomment:
The bug that opened this ticket is now fixed. Leaving the ticket open for the value of other comments for now.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- icomment:
Ticket change [81b2272692] (rid 182240) by dgp on 2020-04-22 14:43:31:
- icomment:
The constraint "ucs2" is distinct from "compat85" and needs to be restored. "ucs2" might be a bad name for it. We can change that, but I need a way to directly determine whether (sizeof(Tcl_UniChar) == 2) and nothing else. The "compat85" constraint tests whether Tcl has no way to internally store codepoints > U+FFFF. That is not the same thing. In a default build of Tcl 8.7, the "compat85" constraint should be false, but the "ucs2" constraint should be true.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [e9ddda3d51] (rid 182246) by jan.nijtmans on 2020-04-22 15:14:41:
- icomment:
> The "compat85" constraint tests whether Tcl has no way to internally > store codepoints > U+FFFF. That is not the same thing. Since the UCS2 encoding cannot store codepoints > U+FFFF, I liked that name very much for this purpose. It's different from sizeof(Tcl_UniChar) == 2, since UTF16 has sizeof(Tcl_UniChar) == 2 too. Would you agree with using another constraint-name for the sizeof(Tcl_UniChar) check? Sorry for kidnapping your "ucs2" name ...;-)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [b14d033c6a] (rid 182255) by jan.nijtmans on 2020-04-22 16:04:04:
- icomment:
Another possible solution: [b85215dae6e78c1b]. Let's see - tomorrow - what Travis thinks of it.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [2554e5afb7] (rid 192625) by jan.nijtmans on 2021-03-18 13:37:03:
- closedate changed to: "2459292.06740297"
- closer changed to: "jan.nijtmans"
- foundin changed to: "8.5"
- icomment: " Merged to core-8-5-branch in [ed551cd16c]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"