Skip to content
Tcl Source Code History Of Ticket 218947
Login

History Of Ticket 218947

Artifacts Associated With Ticket 218947

  1. Ticket change [4e5802db97] (rid 127214) by nobody on 2000-10-26 01:08:29:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2871 Bug
      Version: 8.2
      SubmitDate: '1999-09-23'
      LastModified: '1999-10-20'
      Severity: SER
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Linux-SuSE
      OSVersion: 6.0
      Machine: Other
      FixedDate: '1999-10-20'
      FixedInVersion: 8.2.2
      ClosedDate: '2000-10-25'
      
      
      Name:
      Hans Banken
      
      ReproducibleScript:
      #!/usr/bin/tclsh
          set str "0123456789\x00\ abcdedfghi"
          puts "str: $str"
          puts "before scan - compare index 10 with \x00: [string compare [string index $str 10] \x00]"
          binary scan $str H* dump
          puts "access with string index: $dump\ncompare index 10 with \x00:
          [string compare [string index $str 10] \x00]"
          puts "access with string range: $dump\ncompare range 10,10 with \x00:
          [string compare [string range $str 10 10] \x00]"
      
          # Executing this script results in:
          #   str: 0123456789 abcdedfghi
          #   before scan - compare index 10 with : 0
          #   access with string index:
          30313233343536373839002061626364656466676869
          #   compare index 10 with : -1
          #   access with string range:
          30313233343536373839002061626364656466676869
          #   compare range 10,10 with : 0
      
      ObservedBehavior:
      You might get wrong results when comparing the result of a string index
          operation
      
      
      
      This is tricky.  What is happening is that the user is shimmering
      the object between a string and a bytearray.  'string' has an
      overloaded use, where it will access a bytearray by bytes, and
      strings as strings.  In the first case, you get the unicode
      version of \x00.  In the second, you get the true one-byte \x00
      (just a null byte), which is not the same as the unicode one
      (which is two bytes).  In the third case, STR_RANGE creates
      a bytearray obj, which will get converted OK.  The problem appears
      to be that STR_INDEX for bytearrays wants to return a string type obj. 
      -- 09/24/1999 hobbs
      Fixed 10/20/1999 (for 8.3b1) by making STR_INDEX for ByteArrays
      return a ByteArray object. 
      -- 10/20/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to:
      string compare with result from string index does not work p
      
    11. type initialized to: "Bug"
  2. Ticket change [ddc3d90a56] (rid 114729) by welch on 2000-10-26 08:32:14:

    1. closedate changed to: "2000-10-26T01:32:14"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [16696660f0] (rid 124713) by dgp on 2001-04-19 03:33:36:

    1. closedate changed to: "2001-04-18T20:33:36"
    2. closer changed to: "dgp"
    3. subsystem changed to: "12. ByteArray Object"