Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-03-24
22:00 • Ticket [6978c01b65] Channel encoding difference 8.6 <-> 9.0 status sti... artifact: 90a548d283 user: jan.nijtmans
13:18
Merge trunk 78beedf7e2: Fix [1bedc53c8c]: synchronous [read] with -strictencoding does not produce a... check-in: 65e92802c3 user: pooryorick tags: unchained
2023-03-21
17:51 • Closed ticket [1bedc53c8c]: synchronous read with -strictencoding does not pro... artifact: 3a53c0d261 user: jan.nijtmans
16:28
Fix [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input check-in: 18437bdc82 user: jan.nijtmans tags: core-8-branch
2023-03-20
23:17
Proposed fix for [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on ... check-in: a7bce7dbba user: jan.nijtmans tags: bug-1bedc53c8c
2023-01-17
08:22 • Pending ticket [1bedc53c8c]: synchronous read with -strictencoding does not pr... artifact: 9a3bafa455 user: jan.nijtmans
08:21 • Closed ticket [b8f575aa23]: Tcl 9: eof erroneously flagged with not reported enc... artifact: b9ba254482 user: jan.nijtmans
2023-01-16
20:33 • Closed ticket [1bedc53c8c]: synchronous read with -strictencoding does not pro... artifact: 3ad6928f35 user: pooryorick
20:29 • Open ticket [b8f575aa23]: Tcl 9: eof erroneously flagged with not reported encod... artifact: 32574474c6 user: pooryorick
2022-12-30
21:05
New test, io-12.9.strict, for issue report [1bedc53c8cb878f0]. check-in: 703a1a4792 user: pooryorick tags: py-b8f575aa23
20:48 • Ticket [1bedc53c8c] synchronous read with -strictencoding does not produce an ... artifact: 5cd1b947ca user: pooryorick
2022-12-29
23:39 • Ticket [1bedc53c8c]: 4 changes artifact: c9fcfde7d8 user: jan.nijtmans
23:38 • Ticket [b8f575aa23] Tcl 9: eof errorneously flagged with not reported encoding r... artifact: e2a1886fc3 user: jan.nijtmans
2022-12-27
21:51 • New ticket [1bedc53c8c] synchronous read with -strictencoding does not produce... artifact: d3aa224dd6 user: pooryorick

synchronous [read] with -strictencoding does not produce an error on invalid input

Closed / Fixed1bedc53c8cb878f0bf2a9b65c83b9e481f85fb47Created 4 years agoUpdated 4 years ago
Descriptionwiki2022-12-27 21:51:54
In trunk, test io-12.9, "ReadChars: multibyte chars split FAILED" does not result in an error when the test is changed so that the channel is configured with -strictencdoing 1:

test io-12.9 {ReadChars: multibyte chars split} -body {
    set f [open $path(test1) w]
    fconfigure $f -translation binary
    puts -nonewline $f [string repeat a 9]\xC2
    close $f
    set f [open $path(test1)]
    fconfigure $f -strictencoding 1 -encoding utf-8 -buffersize 10
    set in [read $f]
    close $f
    scan [string index $in end] %c
} -cleanup {
    catch {close $f}
} -result 194

This is incorrect. An error should be returned.

If a second [read] is added, it returns an error:

test io-12.9 {ReadChars: multibyte chars split} -body {
    set f [open $path(test1) w]
    fconfigure $f -translation binary
    puts -nonewline $f [string repeat a 9]\xC2
    close $f
    set f [open $path(test1)]
    fconfigure $f -strictencoding 1 -encoding utf-8 -buffersize 10
    set in [read $f]
    read $f
    close $f
    scan [string index $in end] %c
} -cleanup {
    catch {close $f}
} -result 194

This is also incorrect, because [read $chan] is defined to read all characters up until the end of the channel, implying that all data on the channel has been correctly read.

The first [read] should return an error.

Referenced by5
  • 90a548d283Ticket [6978c01b65] Channel encoding difference 8.6 <-> 9.0 status still Closed with 4 other changes ticket2023-03-24 22:00:27
  • 65e92802c3Merge trunk 78beedf7e2: Fix [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input. check-in2023-03-24 13:18:51
  • 18437bdc82Fix [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input check-in2023-03-21 16:28:57
  • a7bce7dbbaProposed fix for [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input check-in2023-03-20 23:17:11
  • e2a1886fc3Ticket [b8f575aa23] Tcl 9: eof errorneously flagged with not reported encoding read error status still Open with 3 other changes ticket2022-12-29 23:38:34
jan.nijtmans Ticket [1bedc53c8c]: 4 changes [History diff]2022-12-29 23:39:48
pooryorickwiki2022-12-30 20:48:51

Report. [b8f575aa2398b0e4] was closed as a duplicate of this report. Branch py-b8f575aa23 is dedicated to this issue.

pooryorickwiki2023-01-16 20:33:00

Closed as duplicate of [b8f575aa2398b0e4]."Tcl 9: eof erroneously flagged with not reported encoding read error"

jan.nijtmans Pending ticket [1bedc53c8c]. [History diff]2023-01-17 08:22:02
jan.nijtmanswiki2023-03-21 17:51:12

Fixed [here]

Log in (anonymous is fine) to add a comment.