Changes On Branch apn-bug-0f1ddc0df7
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch apn-bug-0f1ddc0df7 Excluding Merge-Ins

This is equivalent to a diff from fc656d2220 to 78b651f917

2024-08-24
12:12
Merge [fc656d2220534953]: TIP #661 implementation: Disable the Tcl 8 compatibility macros in Tcl 9 b... check-in: e018cb1711 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2023-12-07
03:02
Fix [0f1ddc0df7] - use replace profile for exec i/o check-in: 43d35b1d8b user: apnadkarni tags: trunk, main
2023-12-05
17:29
Comment correction: Error channels should *not* raise encoding errors Closed-Leaf check-in: 78b651f917 user: oehhar tags: apn-bug-0f1ddc0df7
16:57
Also ensure no encoding exceptions raised when reading pipe stderr check-in: 734e20257e user: apnadkarni tags: apn-bug-0f1ddc0df7
13:09
Test case for bug check-in: a71b553825 user: apnadkarni tags: apn-bug-0f1ddc0df7
10:41
Add (back) testcases for the compabitiliby macro's (which need TCL_8_API now) check-in: 40ab3f2a32 user: jan.nijtmans tags: trunk, main
09:52
TIP #661 implementation: Disable the Tcl 8 compatibility macros in Tcl 9 by default. Revert TIP #664 check-in: fc656d2220 user: jan.nijtmans tags: trunk, main
09:27
Revert TIP #664 (put back the type-casts) Closed-Leaf check-in: f69e557217 user: jan.nijtmans tags: disabletcl8api
2023-11-30
20:06
Merge 8.7 check-in: e993af87ba user: oehhar tags: trunk, main

Changes to generic/tclIOCmd.c.
939
940
941
942
943
944
945





946
947
948
949
950
951
952
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957







+
+
+
+
+







     */

    TclStackFree(interp, (void *) argv);

    if (chan == NULL) {
	return TCL_ERROR;
    }

    /* Bug [0f1ddc0df7] - encoding errors - use replace profile */
    if (Tcl_SetChannelOption(NULL, chan, "-profile", "replace") != TCL_OK) {
	return TCL_ERROR;
    }

    if (background) {
	/*
	 * Store the list of PIDs from the pipeline in interp's result and
	 * detach the PIDs (instead of waiting for them).
	 */

Changes to tests/exec.test.
708
709
710
711
712
713
714





























715
716
717
718
719
720
721
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    viewFile $log
} -result "\"Testing exec-20.0\""
test exec-20.1 {exec .CMD file} -constraints {win} -body {
    set log [makeFile {} exec201.log]
    exec [makeFile "echo %1> $log" exec201.CMD] "Testing exec-20.1"
    viewFile $log
} -result "\"Testing exec-20.1\""

# Test with encoding mismatches (Bug 0f1ddc0df7fb7)
test exec-21.1 {exec encoding mismatch on stdout} -setup {
    set path(script) [makeFile {
        fconfigure stdout -translation binary
        puts a\xe9b
    } script]
    set enc [encoding system]
    encoding system utf-8
} -cleanup {
    removeFile $path(script)
    encoding system $enc
} -body {
    exec [info nameofexecutable] $path(script)
} -result a\uFFFDb
test exec-21.2 {exec encoding mismatch on stderr} -setup {
    set path(script) [makeFile {
        fconfigure stderr -translation binary
        puts stderr a\xe9b
    } script]
    set enc [encoding system]
    encoding system utf-8
} -cleanup {
    removeFile $path(script)
    encoding system $enc
} -body {
    list [catch {exec [info nameofexecutable] $path(script)} r] $r
} -result [list 1 a\uFFFDb]


# ----------------------------------------------------------------------
# cleanup

foreach file {gorp.file gorp.file2 echo echo2 cat wc sh sh2 sleep exit err} {
    removeFile $file
}
Changes to tests/io.test.
9819
9820
9821
9822
9823
9824
9825

































9826
9827
9828
9829
9830
9831
9832
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    testchannel mremove-rd $f
    testchannel mremove-wr $f
} -returnCodes error -cleanup {
    close $f
    removeFile dummy
} -match glob -result {Tcl_RemoveChannelMode error:\
    Bad mode, would make channel inacessible. Channel: "*"}

# Encoding errors on pipeline
# Ensures fix for exec bug [0f1ddc0df7] does not affect open
# It should still fail unless -profile is explicitly set to replace
test io-77.1 {open pipe encoding mismatch} -setup {
    set scriptFile [makeFile {
        fconfigure stdout -translation binary
        puts -nonewline a\xe9b
        flush stdout
    } script]
} -cleanup {
    close $fd
    removeFile $scriptFile
} -body {
    set fd [open |[list [info nameofexecutable] $scriptFile r+]]
    fconfigure $fd -encoding utf-8
    list [catch {read $fd} result opts] [string match {error reading "*": invalid or incomplete multibyte or wide character} $result] [dict get $opts -errorcode]
} -result [list 1 1 {POSIX EILSEQ {invalid or incomplete multibyte or wide character}}]
test io-77.2 {open pipe encoding mismatch - use replace profile} -setup {
    set scriptFile [makeFile {
        fconfigure stdout -translation binary
        puts -nonewline a\xe9b
        flush stdout
    } script]
} -cleanup {
    close $fd
    removeFile $scriptFile
} -body {
    set fd [open |[list [info nameofexecutable] $scriptFile r+]]
    fconfigure $fd -encoding utf-8 -profile replace
    read $fd
} -result a\uFFFDb


# cleanup
foreach file [list fooBar longfile script script2 output test1 pipe my_script \
	test2 test3 cat stdout kyrillic.txt utf8-fcopy.txt utf8-rp.txt] {
    removeFile $file
}
cleanupTests
Changes to unix/tclUnixPipe.c.
1098
1099
1100
1101
1102
1103
1104


1105
1106
1107
1108
1109
1110
1111
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113







+
+







	 * routine.
	 */

	if (pipePtr->errorFile) {
	    errChan = Tcl_MakeFileChannel(
		    INT2PTR(GetFd(pipePtr->errorFile)),
		    TCL_READABLE);
	    /* Error channels should not raise encoding errors */
	    Tcl_SetChannelOption(NULL, errChan, "-profile", "replace");
	} else {
	    errChan = NULL;
	}
	result = TclCleanupChildren(interp, pipePtr->numPids, pipePtr->pidPtr,
		errChan);
    }

Changes to win/tclWinPipe.c.
2119
2120
2121
2122
2123
2124
2125


2126

2127
2128
2129
2130
2131
2132
2133
2119
2120
2121
2122
2123
2124
2125
2126
2127

2128
2129
2130
2131
2132
2133
2134
2135







+
+
-
+








	if (pipePtr->errorFile) {
	    WinFile *filePtr = (WinFile *) pipePtr->errorFile;

	    errChan = Tcl_MakeFileChannel((void *) filePtr->handle,
		    TCL_READABLE);
	    Tcl_Free(filePtr);
	    Tcl_SetChannelOption(NULL, errChan, "-profile", "replace");
	}
	} else {
	else {
	    errChan = NULL;
	}

	result = TclCleanupChildren(interp, pipePtr->numPids,
		pipePtr->pidPtr, errChan);
    }