Tcl Source Code

View Ticket
Login
Ticket UUID: bc5b790099f7f89ba5f213bbf7bc92a22414f063
Title: read hangs on utf-8 channel
Type: Bug Version: 8.6.2 - 956d1be41ba7e5229efdbe931b8f92945cb11b26
Submitter: jcr Created on: 2014-10-01 18:55:27
Subsystem: 25. Channel System Assigned To: dgp
Priority: 9 Immediate Severity: Severe
Status: Closed Last Modified: 2014-10-02 14:47:18
Resolution: Fixed Closed By: dgp
    Closed on: 2014-10-02 14:47:18
Description:
The following script hangs at the final read.

# ----
set data {gi4uIMKn4oCCLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u4oCCLi4gwqfigIIK}

set f [file tempfile]
chan configure $f -encoding binary
puts -nonewline $f [binary decode base64 $data]
flush $f
seek $f 0
chan configure $f -encoding utf-8
puts stderr "about to read"
set newdata [read $f 130]
puts stderr [string length $newdata]
# ----
User Comments: dgp added on 2014-10-02 14:47:18:
Fix with test committed.

dgp added on 2014-10-02 14:03:33:
The padding for Tcl_ExternalToUtf() was calculated wrong.
Testing a fix...

dgp added on 2014-10-01 19:31:14:
Bug enters in checkin 2e1e7c8266 .

Almost certainly enters also in 04b06f7cea breaking 8.5.16 in the same way.