Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d76ca959dd0059f5aab7af77fff20321f212c750
Ticket: bf7135428c3086e7704e2ccddf8c3066eb7fc36c
Tcl_Write() breaks interface in 8.5.16 and 8.6.2
User & Date: dgp on 2014-10-10 16:31:23
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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.
    
  5. foundin changed to: "8.5.16"
  6. is_private changed to: "0"
  7. login: "dgp"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Critical"
  11. status changed to: "Open"
  12. submitter changed to: "dgp"
  13. subsystem changed to: "25. Channel System"
  14. title changed to: "Tcl_Write() breaks interface in 8.5.16 and 8.6.2"
  15. type changed to: "Bug"