Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-03-19
21:35 • Closed ticket [3597000fff]: file copy return value inconsistency plus 7 ot... artifact: bc114e66eb user: dgp
2012-12-18
04:03 • Ticket [3597000fff]: 4 changes artifact: 0a781ae8db user: ferrieux
04:00 • Ticket [3597000fff]: 4 changes artifact: 4995ad6473 user: ferrieux
2012-12-17
19:22 • New ticket [3597000fff]. artifact: 33e472a85e user: bgriffin

[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.