Tcl Source Code

View Ticket
Login
Ticket UUID: 1528500
Title: outputChannel incompatible with reflected channels
Type: Bug Created on: 2006-07-25 16:53:00
Submitter: andygoth Assigned to: dgp
Subsystem: 34. tcltest Package Severity: Minor
Priority: 5 Medium Last modified: 2026-10-28 13:44:57
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-28 13:44:57
Version: 8.6.18, 9.0.5, 9.1.0
Description:
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.
User Comments:
dgp added on 2006-07-26 00:01:14:
Logged In: YES 
user_id=80530


Same debugging session had
trouble with the [exit]
buried deep in [cleanupTests].

andygoth added on 2008-12-11 08:16:48:
Is anyone maintaining tcltest?

dgp added on 2008-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?

andygoth added on 2008-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.

dkf added on 2008-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. :-)

ferrieux added on 2008-12-11 16:25:26:
If you offer them 8.5b1 I can understand some disappointment ;-)

serhiy.storchaka added on 2026-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 [ca00499284|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.


dgp added on 2026-10-20 18:22:01:
will have a look

jan.nijtmans added on 2026-10-22 08:28:40:

Fixed in [891b7e7921|trunk]. Not backported yet to 9.0 and 8.6

Don, if you have any remarks, feel free to follow-up!


jan.nijtmans added on 2026-10-28 13:44:57:
Now also backported to core-9-0-branch and core-8-6-branch

Closing. Many thanks!