Skip to content
Tcl Source Code History Of Ticket 2564363fff
Login

History Of Ticket 2564363fff

Artifacts Associated With Ticket 2564363fff

  1. Ticket change [e29ca67468] (rid 87661) by dgp on 2009-02-04 15:40:07:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      % set a [encoding convertfrom identity \x21]
      !
      % set b [encoding convertfrom identity \xc0\xA1]
      !
      % expr {$a eq $b}
      0
      % string equal $a $b
      0
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "dgp"
    10. subsystem initialized to: "18. Commands M-Z"
    11. title initialized to:
      string equality testing does not cover encoding variants
      
    12. type initialized to: "Bug"
  2. Ticket change [ee97a19148] (rid 104102) by dkf on 2009-02-04 22:47:08:

    1. subsystem changed to: "10. Objects"
  3. Ticket change [096a49bc4e] (rid 89721) by dkf on 2009-02-04 22:47:09:

    1. assignee changed to: "msofer"
  4. Ticket change [a6b805b864] (rid 98656) by dgp on 2009-02-04 22:55:05:

    1. icomment:
      
      extended example showing the inconsistency
      due to shimmering, and differing definitions
      of equality for different intreps:
      
      % set a [encoding convertfrom identity \x21]
      !
      % set b [encoding convertfrom identity \xc0\xa1]
      !
      % set s string; # Force direct evaluation - no compile!
      string
      % $s equal $a $b
      0
      % string length $a; # Convert to the "string" objType
      1
      % string length $b
      1
      % $s equal $a $b
      1
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [a709b1b8b9] (rid 98714) by dkf on 2009-02-04 23:09:58:

    1. icomment:
      IMO the core problem is the identity encoding.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [1500e6a376] (rid 124493) by dgp on 2009-02-04 23:16:37:

    1. icomment:
      
      here the identity encoding is simply
      a tool for introducing the encoding
      variants to be tested.
      
      The core problem is that Tcl has not
      made up its mind whether such variants
      are to be accepted or rejected.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [68731a5931] (rid 103069) by ferrieux on 2009-02-05 07:31:51:

    1. icomment:
      It seems we are clearly violating advice given in (uncompiled) StringEqualCmd:
      
         * Remember to keep code here in some sync with the byte-compiled versions
         * in tclExecute.c (INST_STR_EQ, INST_STR_NEQ and INST_STR_CMP as well as
      
      Indeed the code near that comment tries two shimmer-less comparisons (ByteArray and String) before resorting to GetStringFromObj(). While the equivalent code in TEBC goes straight to it...
      One first idea would be to respect the above advice and stick to perfet eval-compile symmetry.
      However, shimmering is just a matter of speed and shouldn't affect the external EIAS semantics.
      So it might be better to remove that comment, since the lack of symmetry helps highlight a nasty bug.
      
      Now to the bug itself: here we have two pure-strep's (results from [encoding convertfrom identity]), which are two different UTF-8 strings. By calling [string length] on them we compute their String(unicode) intrep, which happen to be the same. Then when we call the non-compiled variant of [string equal] we hit the shimmer-less case, comparing on the (equal) unicode strings.
      
      So it seems we have a situation similar to non-canonical lists that would be compared on their List intreps.
      The solution would be to add similarly an "isCanonical" flag to the String intrep, and take that flag into account in the "fast-track" comparisons (ie forbid such comparisons on all but canonical Strings).
      
      More generally this would be the case of any intrep that is "fast-tracked" in one of the equality tests and fails to record deviation from canonicity.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  8. Ticket change [d648a0e258] (rid 123776) by jenglish on 2009-02-05 07:50:31:

    1. icomment:
      > The core problem is that Tcl has not
      > made up its mind whether such variants
      > are to be accepted or rejected.
      
      My vote: rejected.  More specifically: invalid UTF-8 octet sequences as a Tcl_Obj* string value  leads to undefined behavior.  (Not an error, _undefined behavior_. Tcl should not be required to detect such conditions, either.)
      
      And [encoding convertfrom identity] has to go.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  9. Ticket change [ddcea4361c] (rid 114738) by msofer on 2009-05-01 08:24:17:

    1. priority changed to: "6"
  10. Ticket change [4abf6a8492] (rid 126580) by msofer on 2009-05-01 08:26:40:

    1. priority changed to: "7 High"
  11. Ticket change [b8592dbe5e] (rid 128951) by dkf on 2009-05-01 15:26:05:

    1. icomment:
      I agree about eliminating the identity “encoding”; it's nothing but trouble.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  12. Ticket change [bfae941098] (rid 102285) by msofer on 2009-12-11 09:50:56:

    1. assignee changed to: "dgp"
    2. icomment:
      just passing it around ....
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. username: "msofer"
  13. Ticket change [2893d3853a] (rid 154203) by dgp on 2017-06-05 17:07:18:

    1. closer changed to: "nobody"
    2. comment changed to:
      % set a [encoding convertfrom identity \x21]
      !
      % set b [encoding convertfrom identity \xc0\xA1]
      !
      % expr {$a eq $b}
      0
      % string equal $a $b
      0
      
    3. icomment:
      
      This may be fixed now by fixing
      
      https://core.tcl.tk/tcl/tktview/67aa9a207037ae67f9014b544c3db34fa732f2dc
      
      At least the expression of the problem is now changed.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. severity changed to: "Minor"
  14. Ticket change [fd6903be46] (rid 259708) by serhiy.storchaka on 2026-10-21 10:03:36:

    1. icomment:
      Fixed in 8.6.7 by [164b69bdfd] (9.0: [8e28fedaa0]) for [67aa9a2070]: an overlong sequence no longer decodes to the same character, so eq, <tt>string equal</tt> and the non-compiled path agree before and after shimmering. 9.0 also dropped the identity encoding.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  15. Ticket change [af2fad5e62] (rid 260003) by serhiy.storchaka on 2026-10-22 17:19:30:

    1. closedate changed to: "2461334.9191759955"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"