Skip to content
Tcl Source Code History Of Ticket c574e50a3b30e76f
Login

History Of Ticket c574e50a3b30e76f

Artifacts Associated With Ticket c574e50a3b30e76f

  1. Ticket change [ccf02b0407] (rid 182028) by dgp on 2020-04-17 21:12:10:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      utf.test
      ---- utf-2.8 start
      Test file error: child killed: segmentation violation
      
    5. is_private initialized to: "0"
    6. login: "dgp"
    7. priority initialized to: "5 Medium"
    8. resolution initialized to: "None"
    9. severity initialized to: "Important"
    10. status initialized to: "Open"
    11. submitter initialized to: "dgp"
    12. subsystem initialized to: "44. UTF-8 Strings"
    13. title initialized to: "CRASH: utf-2.[89] in 8.5 built with TCL_UTF_MAX=4"
    14. type initialized to: "Bug"
  2. Ticket change [7bcab85b94] (rid 182029) by dgp on 2020-04-18 00:00:54:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [87b135b8bb] (rid 182030) by jan.nijtmans on 2020-04-18 12:31:01:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Indeed. Backported too much from tclUtf.c, parts that were not appropriate fro 8.5.  Will fix
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Accepted"
  4. Ticket change [a5b309ea87] (rid 182042) by dgp on 2020-04-18 14:02:39:

    1. closedate changed to: "2458958.0851787"
    2. closer changed to: "dgp"
    3. 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.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  5. Ticket change [55399bb9cf] (rid 182043) by dgp on 2020-04-18 14:17:52:

    1. closer changed to: "nobody"
    2. 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
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. resolution changed to: "None"
    6. status changed to: "Open"
  6. Ticket change [d9e13784fa] (rid 182044) by dgp on 2020-04-18 14:20:33:

    1. 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
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [02ca150ff1] (rid 182045) by dgp on 2020-04-18 14:54:56:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  8. Ticket change [6f9556e2aa] (rid 182048) by dgp on 2020-04-18 15:26:40:

    1. icomment:
      
      There's still trouble here. Moving the efforts to a bug-fix branch.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  9. Ticket change [5dd34dddf9] (rid 182110) by dgp on 2020-04-20 07:37:53:

    1. 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])
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  10. Ticket change [a9e56e2554] (rid 182114) by jan.nijtmans on 2020-04-20 08:01:17:

    1. 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.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  11. Ticket change [a586e633b5] (rid 182125) by dgp on 2020-04-20 14:18:37:

    1. 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?
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  12. Ticket change [7fd9e14675] (rid 182126) by dgp on 2020-04-20 14:56:10:

    1. 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]
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  13. Ticket change [f4265e3d25] (rid 182127) by dgp on 2020-04-20 15:14:30:

    1. 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]
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  14. Ticket change [e439b88bef] (rid 182128) by jan.nijtmans on 2020-04-20 15:18:00:

    1. icomment:
      Well, about your last 2 remarks: I agree, that's exactly what I'm trying to say.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  15. Ticket change [43bbb4d4f0] (rid 182129) by dgp on 2020-04-20 15:18:36:

    1. 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?)
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  16. Ticket change [4271cdabe1] (rid 182136) by dgp on 2020-04-20 15:41:46:

    1. 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
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  17. Ticket change [6f972059f1] (rid 182137) by dgp on 2020-04-20 19:59:26:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  18. Ticket change [2bdacbdff7] (rid 182138) by dgp on 2020-04-20 20:37:16:

    1. 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].
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  19. Ticket change [df02fef08e] (rid 182143) by dgp on 2020-04-20 21:01:16:

    1. 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]
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  20. Ticket change [3e7993b262] (rid 182155) by jan.nijtmans on 2020-04-20 22:29:29:

    1. 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].
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  21. Ticket change [24853c7934] (rid 182184) by dgp on 2020-04-21 14:00:28:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  22. Ticket change [6bc05abc33] (rid 182185) by jan.nijtmans on 2020-04-21 14:18:21:

    1. 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 ;-)
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  23. Ticket change [0d9f07879b] (rid 182186) by jan.nijtmans on 2020-04-21 14:24:17:

    1. 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.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  24. Ticket change [9f7f8ba5bc] (rid 182187) by dgp on 2020-04-21 14:32:55:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  25. Ticket change [36de82a8a1] (rid 182188) by dgp on 2020-04-21 14:36:23:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  26. Ticket change [ffbea21c14] (rid 182190) by dgp on 2020-04-21 14:52:56:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  27. Ticket change [547f5d343b] (rid 182191) by jan.nijtmans on 2020-04-21 14:59:37:

    1. 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
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  28. Ticket change [e0d2ea8e21] (rid 182203) by dgp on 2020-04-21 16:03:27:

    1. icomment:
      
      The bug that opened this ticket is now fixed. Leaving the ticket open for the value of other comments for now.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
  29. Ticket change [81b2272692] (rid 182240) by dgp on 2020-04-22 14:43:31:

    1. 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.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  30. Ticket change [e9ddda3d51] (rid 182246) by jan.nijtmans on 2020-04-22 15:14:41:

    1. 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 ...;-)
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  31. Ticket change [b14d033c6a] (rid 182255) by jan.nijtmans on 2020-04-22 16:04:04:

    1. icomment:
      Another possible solution: [b85215dae6e78c1b].  Let's see - tomorrow - what Travis thinks of it.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  32. Ticket change [2554e5afb7] (rid 192625) by jan.nijtmans on 2021-03-18 13:37:03:

    1. closedate changed to: "2459292.06740297"
    2. closer changed to: "jan.nijtmans"
    3. foundin changed to: "8.5"
    4. icomment: " Merged to core-8-5-branch in [ed551cd16c]"
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. status changed to: "Closed"