Skip to content
Tcl Source Code History Of Ticket fc4393e9b0
Login

History Of Ticket fc4393e9b0

Artifacts Associated With Ticket fc4393e9b0

  1. Ticket change [8b436d0a90] (rid 177683) by chw on 2019-12-07 15:44:17:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      Check-in [edce885a5c] changes the data type which tclUtf.c function
      UnicodeToUtfProc() processes from Tcl_UniChar to unsigned short.
      For TCL_UTF_MAX=6 this is Plain Wrong(tm) effectively breaking this mode.
      Now I wonder why this change took place in the active 8.6 branch and
      wasn't first thoroughly tested in a development branch before being
      added to the 8.6 branch.
      
    5. foundin initialized to: "core-8-6-branch"
    6. is_private initialized to: "0"
    7. login: "chw"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0b3aff16612e1e9f3b675963fa64e01bd1d89307"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "chw"
    14. subsystem initialized to: "44. UTF-8 Strings"
    15. title initialized to: "UnicodeToUtfProc bogus in [edce885a5c]"
    16. type initialized to: "Bug"
  2. Ticket change [00c0e4caa8] (rid 177684) by jan.nijtmans on 2019-12-07 17:38:51:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2458825.23531835"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      There are test-cases in encoding.test, which test for the "unicode"  encoding being 16-bit. On the TCL level, we cannot break compatibility, so the "unicode" encoding always needs to be equivalent to utf-16, we cannot change that, never! Agreed, "unicode" is a bad name for an encoding, that's why it's deprecated now.
      
      If you want a UCS-4 encoding, then add one under a separate name and use that, that's the way to go forward. Or (since Androwish in TCL_UTF_MAX=6 mode is already binary incompatible with Tcl) simply don't take over this change in Androwish. But then you'll have to deal with this when makeing the transition to 8.7.
      
      In Tcl 8.7, "unicode" is already equivalent to "utf-16". Check-in [edce885a5c] is basically a backport of part of the TIP #547 implementation, so it -actually - already in use for a long time in the core-8-branch.
      
      Sorry I have no better news :-(
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"
  3. Ticket change [a4013b64df] (rid 177691) by chw on 2019-12-07 18:42:14:

    1. closedate changed to: "2458825.2793313"
    2. closer changed to: "chw"
    3. icomment:
      Sorry, too, for nerving more. I wonder why the opposite of UnicodeToUtfProc()
      (which BTW is in tclEncoding.c not in tclUtf.c) named UtfToUnicodeProc() takes
      appropriate steps to deal with 16 and 32 bit quantities depending on TCL_UTF_MAX
      and even automagically detects the byte order. Why make these functions
      asymmetric?
      
    4. login: "chw"
    5. mimetype: "text/plain"
  4. Ticket change [5aaf8dae8e] (rid 177692) by jan.nijtmans on 2019-12-07 22:03:46:

    1. closedate changed to: "2458825.41928975"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      The main reason for this asymmetry is the function Tcl_UtfToUniChar(), which behaves differently for TCL_UTF_MAX=6: 4-byte UTF-8-sequences will be converted to Unicode in one step, while for TCL_UTF_MAX=3|4 upper/lower surrogates will be delivered. The encoding should result in exactly the same chars, so in case of TCL_UTF_MAX=6 we have to split them into surrogates ourselves.
      
      All corner-cases have test-cases, even high-surrogates not followed by low-surrogates and low-surrogates not preceded by high-surrogates. But if you find a situation that's handled incorrectly, please let me know.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  5. Ticket change [5418945a30] (rid 177693) by chw on 2019-12-08 01:55:41:

    1. closedate changed to: "2458825.58033601"
    2. closer changed to: "chw"
    3. icomment:
      Most likely, I very was mislead in my guesstimations, but then
      added I this (wrong) test case to encoding.test:
      
      test encoding-16.3 {UnicodeToUtfProc} -constraints fullutf -body {
          set val [encoding convertfrom unicode \
              [testbytestring "\xdc\xdc\xd8\xd8\xee\xee"]]
          list [format %x [scan $val %c]]
      } -result [list dcdc]
      
      and got for valgrind'ing TCL_UTF_MAX=4 and TCL_UTF_MAX=6 otherwise
      not present indications of:
      
      ==31547== Conditional jump or move depends on uninitialised value(s)
      ==31547==    at 0x2A1C44: Tcl_UniCharToUtf (tclUtf.c:161)
      ==31547==    by 0x211512: UtfToUtfProc (tclEncoding.c:2384)
      ==31547==    by 0x211110: UtfIntToUtfExtProc (tclEncoding.c:2199)
      ==31547==    by 0x20FA04: Tcl_UtfToExternal (tclEncoding.c:1429)
      ==31547==    by 0x24C289: Write (tclIO.c:4294)
      ==31547==    by 0x24BFA8: Tcl_WriteObj (tclIO.c:4168)
      ==31547==    by 0x255E3E: Tcl_PutsObjCmd (tclIOCmd.c:185)
      ==31547==    by 0x14F97A: Dispatch (tclBasic.c:4456)
      ==31547==    by 0x14FA00: TclNRRunCallbacks (tclBasic.c:4492)
      ==31547==    by 0x14F2D6: Tcl_EvalObjv (tclBasic.c:4215)
      ==31547==    by 0x151713: TclEvalEx (tclBasic.c:5361)
      ==31547==    by 0x262AED: Tcl_FSEvalFileEx (tclIOUtil.c:1824)
      ...
      
      and
      
      ==31547== Conditional jump or move depends on uninitialised value(s)
      ==31547==    at 0x2A1C29: Tcl_UniCharToUtf (tclUtf.c:161)
      ==31547==    by 0x211512: UtfToUtfProc (tclEncoding.c:2384)
      ==31547==    by 0x211165: UtfExtToUtfIntProc (tclEncoding.c:2248)
      ==31547==    by 0x20F724: Tcl_ExternalToUtf (tclEncoding.c:1257)
      ==31547==    by 0x24DB5C: FilterInputBytes (tclIO.c:5306)
      ==31547==    by 0x24C9AA: Tcl_GetsObj (tclIO.c:4576)
      ==31547==    by 0x2561B6: Tcl_GetsObjCmd (tclIOCmd.c:327)
      ==31547==    by 0x14F97A: Dispatch (tclBasic.c:4456)
      ==31547==    by 0x14FA00: TclNRRunCallbacks (tclBasic.c:4492)
      ==31547==    by 0x14F2D6: Tcl_EvalObjv (tclBasic.c:4215)
      ==31547==    by 0x151713: TclEvalEx (tclBasic.c:5361)
      ==31547==    by 0x262AED: Tcl_FSEvalFileEx (tclIOUtil.c:1824)
      ...
      
      which could indicate a logic problem in the state machine of
      detecting and handling surrogate pairs.
      
    4. login: "chw"
    5. mimetype: "text/plain"
  6. Ticket change [644c88bd27] (rid 177694) by chw on 2019-12-08 02:11:00:

    1. closedate changed to: "2458825.59098353"
    2. icomment:
      Sorry again, this was the (wrong) test case which triggered valgrind:
      
      test encoding-16.3 {UnicodeToUtfProc} -constraints fullutf -body {
          set val [encoding convertfrom unicode \
              [testbytestring "\xdc\xdc\xd8\xd8\xee\xee"]]
          [list "\udcdc\ud8d8\ueee" [format %x [scan $val %c]]]
      } -result [list dcdc]
      
    3. login: "chw"
    4. mimetype: "text/plain"