|
2012-12-10
| ||
| 22:06 | • Closed ticket [3389289fff]: Incomplete closure of stdout on exit plus 8 othe... artifact: be9336f35a user: ferrieux | |
|
2011-08-10
| ||
| 06:28 | • Ticket [3389289fff]: 4 changes artifact: 9735a580d7 user: ferrieux | |
|
2011-08-09
| ||
| 22:52 | • New ticket [3389289fff]. artifact: 4c53d4882b user: ferrieux | |
Incomplete closure of stdout on exit
Closed / Wont Fix3389289fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 14 years ago
Descriptionplain2011-08-09 22:52:19
The CloseChannel function is not called on stdout when exiting. As a consequence, the output eofchar is not written. Note that proper behavior is restored by forcing a Finalize in 8.6 (eg with -DPURIFY). This bug was already present in 8.5 and allowed test chan-4.6 to run without side effect (detected in 3389251)
ferrieuxplain2011-08-10 06:28:59
Was also present in 8.4.
Easy way to check, all versions: pass this script as arg to tclsh (noninteractive):
fconfigure stdout -eofchar [list {} \x27]
close stdout
You should see a single quote: '
Then comment out the [close stdout], the single quote disappears, in 8.[456].
(except in 8.6HEAD+PURIFY, because of finalization)
ferrieuxplain2012-12-10 22:06:51
The reason is a subtle dance between channel refcounts, and per-interp vs. global responsibility, made even more complex by the special case of standard channels (though regular channels have the same problem). The bottom line is that CloseChannel (not to be confused with Tcl_Close, nor ChanClose, nor with the channel's closeProc... argh) fails to be called at exit. In 8.6 the issue gets a different light since we insist on making [exit] as quick and as deadlock-free as possible, so we skip many otherwise useless (if not outright dangerous) finalizers... among which the interp's deletion, which gets the final chance to call CloseChannel (as can be seen by forcing TCL_FINALIZE_ON_EXIT). In this context, closing the issue as "Won't Fix" because: - output-eofchar-plus-exit-minus-close has never worked in Tcl's history - no explicit promise has ever been made in the manpages - eofchar is a DOS-only notion of dubious use nowadays - fixing it would require (a) either an overhaul of the IO finalization code (b) or an increased risk for [exit] to revive tricky finalization bugs Note that I'm setting myself as assignee, ready to listen to arguments from people with a strong case for reopening.
Log in (anonymous is fine) to add a comment.