Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: 9d2081a06d75c1c22dcd799e23ef8b9c93ecb4f8
Ticket: 8e1e31eac0fd6b6c4452bc108a98ab08c6b64588
lsort treats NUL chars strangely
User & Date: m7j4k9 2017-07-20 10:21:46
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The NUL character is not collated correctly.
    
    The Tcl command below demonstrates that the NUL character 
    is treated by lsort as if it had the bit value 0111 1111.1
    -- that's right, as if it were between 127 and 128.
    
    % join [lsort [list \0.1 \7.2 a.3 z.4 \x7F.5 \x80.6 \xFF.7]] :
    
    .2:a.3:z.4:.5: .1:€.6:ÿ.7
    
    Only NUL seems to be treated this oddly as confirmed by:
    
    % for { set list {} ; set i 0 } { $i < 256 } { incr i } { lappend list [format %c.%02x $i $i] }
    % lsort $list
    
  5. foundin changed to: "8.6.6"
  6. is_private changed to: "0"
  7. login: "m7j4k9"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "19f06fe5054ecb07284f096bd2da5fdc29221e4e"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "m7j4k9"
  14. subsystem changed to: "17. Commands I-L"
  15. title changed to: "lsort treats NUL chars strangely"
  16. type changed to: "Bug"