Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
03:37 • Closed ticket [230478ffff]: another fcopy bug? plus 3 other changes artifact: b650b3bee2 user: andreas_kupries
01:55 • Ticket [230478ffff]: 4 changes artifact: c05498b799 user: dgp
00:26 • Ticket [230478ffff]: 4 changes artifact: 4b6006c1d8 user: andreas_kupries
2001-04-04
22:35 • Ticket [230478ffff]: 5 changes artifact: d2bc4fcd6b user: dgp
2001-01-30
17:55 • New ticket [230478ffff]. artifact: 55148066ae user: dgp

another [fcopy] bug?

Closed / Invalid230478ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2001-01-30 17:55:05
The [fcopy] docs say:

Without the -command option, fcopy blocks until
the copy is complete and returns the number of
bytes written to outchan.

In revision 1.28 of generic/tclIO.c in CopyData(), how
does the code avoid the "return TCL_OK" on line 7066
and line 7109 when no -command option has been specified
(i.e. cmdPtr == NULL) ?

If these returns are not avoided, then [fcopy] will not
block until the copy completes, and will return an empty
string instead of the number of bytes copied, right?

Is there something subtle and tricky I'm missing that
guarantees this problem will not arise?
dgpplain2001-04-04 22:35:42
Logged In: YES 
user_id=80530

Andreas, since you are already looking at [fcopy]/
CopyData(), could you take a look at this?
andreas_kupriesplain2001-04-05 00:26:07
Logged In: YES 
user_id=75003

Yes, there is some trickery.

If you look at 'TclCopyChannel', the procedure which calls
'CopyData' you will find that it configures the channels
into blocking mode if there is no command (ptr).

This means that the read calls will only return in case of
an error (size < 0) or if the buffer is full or EOF was
reached. Only in the case of EOF size == 0 is possible and
EOF is handled specially at that point (breaking out of the
loop). It also means that there is never a background flush
running, so it avoids the second return too.
dgpplain2001-04-05 01:55:22
Logged In: YES 
user_id=80530

I think I get it now.  Feel free to close/invalidate this
report.  Or add some source code comments if you think
others will become similarly concerned.
andreas_kupries Closed ticket [230478ffff]. [History diff]2001-04-05 03:37:59
Log in (anonymous is fine) to add a comment.