[file copy] return value inconsistency
Closed / Fixed3597000fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2012-12-17 19:22:19
The [file copy] command does not define a return value, yet when copying across file systems, say from a Trofs file system to the unix file system, [file copy] will return the number of bytes copied. This return value inconsistency can be a nuisance.
ferrieuxplain2012-12-18 04:00:44
The discrepancy comes from a different attitude various parts of the code towards interp-passing: - TclCopyChannel (aka fcopy), which is used for the cross-fs case, takes an interp and is documented to set the result to the number of bytes transferred - The per-fs ->copyFileProc, used otherwise for performance reasons (and its ability to copy links), happens to take no interp, and to return only TCL_OK or TCL_ERROR. As a consequence, directly returning the number of bytes from copyFileProc seems out of reach within 8.x (compat). One possibility though, would be to stat() the just-copied source or dest file, but that's ugly, slow, and subject to race conditions. Any better idea appreciated.
ferrieuxplain2012-12-18 04:03:49
Another option is to use TSD (or a global in the unthreaded case). Not outstandingly elegant either.
dgpplain2013-03-19 21:35:14
allow_comments - 1 fix committed.
Log in (anonymous is fine) to add a comment.