outputChannel incompatible with reflected channels
Closed / Fixed1528500fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 36 days ago
Descriptionplain2006-07-25 16:53:00
outputChannel mishandles the channel name passed to it. It only behaves as documented for stdout and stderr. If the channel name is anything else, it opens a file of that same name. This breaks any channel opened from within the program, including reflected channels, socket channels, and channels already connected to files.
Referenced by3
e44f1d0e87Many tcltest improvements, [773924ffff], [811659ffff], [572400ffff], [8413e79232] and [1528500fff] check-in2026-10-22 11:44:24891b7e7921Many tcltest improvements, [773924ffff], [9f4feaaaa1], [811659ffff], [572400ffff], [8413e79232] and [1528500fff] check-in2026-10-22 08:25:31ca00499284Fix [1528500fff]: tcltest::outputChannel and errorChannel use an already open channel as is instead of opening a file with its name. check-in2026-10-20 14:30:00
dgpplain2006-07-26 00:01:14
Logged In: YES user_id=80530 Same debugging session had trouble with the [exit] buried deep in [cleanupTests].
andygothplain2008-12-11 08:16:48
Is anyone maintaining tcltest?
dgpplain2008-12-11 11:28:29
Fair question, but also an unkind week to pose it. This one's basically a documentation bug, right? Can you suggest any language that would clarify things better?
andygothplain2008-12-11 11:42:28
Please pardon me if my timing is bad; I have no idea what is special about this week. I'm only asking this question now because I happened to be mucking with sourceforge for other reasons. I'm not actually using tcltest for anything at the moment, and it's been a long time since I've needed it. Lately my testing has been of an interactive nature, so automated testing isn't useful to me just now. I don't think it's a documentation bug, although it can be "fixed" by changing the documentation to explain outputChannel's surprising DWIM-style behavior. I'd prefer that outputChannel be modified to always treat the channel name as a Tcl channel, rather than sometimes treating it as a filename. While we're on the subject of surprising DWIM-style behavior, the [exit] inside [cleanupTests] should probably be examined too.
dkfplain2008-12-11 16:04:05
We're trying to finalize features for 8.5b1, which we want out before Christmas. And we're trying to find time to decorate and buy presents too. I guess Tcl 8.6b1 isn't quite enough for most families. :-)
ferrieuxplain2008-12-11 16:25:26
If you offer them 8.5b1 I can understand some disappointment ;-)
serhiy.storchakawiki2026-10-20 14:34:06
Still the case on main, 9.0 and 8.6: outputChannel and errorChannel open any name except stdout/stderr as a file, so with a reflected channel the output goes to a new file "rc0" in the current directory.
Proposed fix in branch [tcltest-output-open-channel]: a name in [chan names] is used as the channel (tcltest does not close it); other names are still file names, which -outfile/-errfile rely on. New test tcltest-6.7.1.
dgpplain2026-10-20 18:22:01
will have a look
jan.nijtmanswiki2026-10-22 08:28:40
Fixed in [trunk]. Not backported yet to 9.0 and 8.6
Don, if you have any remarks, feel free to follow-up!
jan.nijtmansplain2026-10-28 13:44:57
Now also backported to core-9-0-branch and core-8-6-branch Closing. Many thanks!
Log in (anonymous is fine) to add a comment.