Diff
Not logged in

Differences From Artifact [30b51577c1]:

To Artifact [ab4deb0189]:


9445
9446
9447
9448
9449
9450
9451
9452
9453

9454
9455

9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469



























9470
9471
9472
9473



9474
9475
9476
9477
9478
9479
9480
9481
9445
9446
9447
9448
9449
9450
9451


9452
9453

9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467

9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495



9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506







-
-
+

-
+













-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
+
+
+








    invalid or incomplete multibyte or wide character}}

test io-75.14 {
	[gets] succesfully returns lines prior to error

	invalid utf-8 encoding [gets] continues in non-strict mode after error
} -setup {
    set fn [makeFile {} io-75.14]
    set f [open $fn w+]
    set chan  [file tempfile]
    fconfigure $f -encoding binary
    # \xc0 is invalid in utf-8
    # \xc0\n is an invalid utf-8 sequence
    puts -nonewline $f a\nb\xc0\nc\n
    flush $f
    seek $f 0
    fconfigure $f -encoding utf-8 -buffering none -eofchar {} \
	-translation lf -profile strict
} -body {
    lappend res [gets $f]
    set status [catch {gets $f} cres copts]
    lappend res $status $cres
    chan configure $f -profile tcl8 
    lappend res [gets $f]
    lappend res [gets $f]
    close $f
	return $res
    return $res
} -match glob -result {a 1 {error reading "*":\
    invalid or incomplete multibyte or wide character} bÀ c}

test io-75.15 {
    invalid utf-8 encoding strict gets does not hang
    after error reconfigure and read
} -setup {
    set res {}
    set chan [file tempfile]
    fconfigure $chan -encoding binary
    # \xc0\x40 is an invalid utf-8 sequence
    puts $chan hello\nAB\xc0\x40CD\nEFG
	seek $chan 0
} -body {
    #Now try to read it with [gets]
    fconfigure $chan -encoding utf-8 -profile strict
    lappend res [gets $chan]
    set status [catch {gets $chan} cres copts]
    lappend res $status $cres
    set status [catch {gets $chan} cres copts]
    lappend res $status $cres
    chan configure $chan -encoding binary
    foreach char [split [read $chan 6] {}] {
	lappend res [format %x [scan $char %c]]
    }
    return $res
} -cleanup {
    removeFile io-75.14
} -match glob -result {a 1 {error reading "*":\
    invalid or incomplete multibyte or wide character} bÀ c}
    close $chan
} -match glob -result {hello 1 {error reading "*": invalid or incomplete multibyte or wide character}\
    1 {error reading "*": invalid or incomplete multibyte or wide character} 41 42 c0 40 43 44}

# ### ### ### ######### ######### #########



test io-76.0 {channel modes} -setup {
    set datafile [makeFile {some characters} dummy]
    set f [open $datafile r]
9577
9578
9579
9580
9581
9582
9583
9584

9585
9586
9587
9588
9589
9590
9591
9602
9603
9604
9605
9606
9607
9608

9609
9610
9611
9612
9613
9614
9615
9616







-
+







    set f [open $datafile r+]
} -constraints testchannel -body {
    testchannel mremove-wr $f
    testchannel mremove-rd $f
} -returnCodes error -cleanup {
    close $f
    removeFile dummy
} -match glob -result {Tcl_RemoveChannelMode error:
} -match glob -result {Tcl_RemoveChannelMode error:\
    Bad mode, would make channel inacessible. Channel: "*"}

test io-76.10 {channel mode dropping} -setup {
    set datafile [makeFile {some characters} dummy]
    set f [open $datafile r+]
} -constraints testchannel -body {
    testchannel mremove-rd $f