Artifacts Associated With Ticket bf7135428c
Ticket change [d76ca959dd] (rid 140256) by dgp on 2014-10-10 16:31:23:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tcl_Write() as released in Tcl 8.5.16 and 8.6.2 no longer compatibly returns the same values it did in prior releases. Tcl_Write(chan, buf, toWrite) does not have its return value clearly documented. It is only described as "similar to Tcl_WriteChars". In the code comments heading the Tcl_Write implementation it is claimed that the return value is "number of bytes written or -1 in case of error". But this is ambiguous. Does that mean the number of bytes taken out of "buf" (some value <= toWrite)? Or does it mean the number of bytes sent out to the channel output driver? If we take our clue from the "similar to Tcl_WriteChars" language, we might assume that, like every other Tcl_Write* routine, what gets reported is the number of bytes sent out to the driver. Since the only way Tcl_Write could consume less than "toWrite" bytes from "buf" would be in case of an error, and we have the special value -1 to signal errors, it's natural to assume that Tcl_Write () would not be returning the number of bytes taken from "buf" because in the absence of an error that would always just be an echo back of the "toWrite" value, and useless. But you'd be making assumptions contrary to the code history. In fact, up until now, Tcl_Write() has indeed been echoing back the "toWrite" value on success. The refactoring work on channels incompatibly changed that to reporting the number of bytes written, and on Windows by default, and anywhere with -translation crlf active, that can be an incompatible difference. As you might guess, this is damaging a deployed application of mine. As soon as folks upgrade to ActiveTcl 8.6.2.0, their programs stop working. That's what's reported. It's clear the same issue will plague those working with deployed programs using tcl85.dll from ActiveTcl 8.5.16.0.
- foundin initialized to: "8.5.16"
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "25. Channel System"
- title initialized to: "Tcl_Write() breaks interface in 8.5.16 and 8.6.2"
- type initialized to: "Bug"
Ticket change [05db5524d8] (rid 140257) by dgp on 2014-10-10 17:04:34:
- icomment:
ok, the "useless" assessment is too strong. If toWrite = -1 is passed in, all bytes up to the terminating NUL are written, and the return is a count of how many that was.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [07341351a8] (rid 140276) by dgp on 2014-10-10 19:57:04:
- assignee changed to: "dgp"
- closedate changed to: "2456941.33130264"
- closer changed to: "dgp"
- icomment:
Trivially simple fix committed to both branches.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"