|
2009-06-26
| ||
| 23:57 | • Closed ticket [2812527fff]: ftp library - connection close plus 8 other chan... artifact: 4df16eacb0 user: dgp | |
| 03:17 | • New ticket [2812527fff]. artifact: 5e14e461a5 user: russellbell | |
ftp library - connection close
Closed / Invalid2812527fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-06-26 03:17:44
I've found a bug in the ftp client library 2.4.8 that bites
when a connection is closed. When you call ::ftp::Close $handle
you sometimes get a TCL exception (thrown in an event handler
so a catch around ::ftp::Close doesn't help) and sometimes
you get an endless loop. Depends on the ftp server you're
talk to and doesn't happen consistently, but enough to be
annoying.
The faulty code is about line 35 of ::ftp::StateHandler which
does "set number [gets $sock bufline]". This code reads
a continuation line, so normally isn't called after the
socket is closed, but sometimes it is and an exception is
the result. Fix is to wrap in a catch, easy enough.
But then the second bug bites - this code is in a loop and
if the gets returns <= 0, the loop is infinite. Fix is to
break from the loop, and change the code structure a little
to ensure "if { [eof $ftp(CtrlSock)] } ..." gets called
in this case.
I believe this is a separate issue to 1076923 found by Keith
Vetter - that was the gets on line 16 of ::ftp::StateHandler.
If it's helpful I can provide source for my fix to ftp 2.4.8,
[email protected]
dgpplain2009-06-26 23:57:52
allow_comments - 1 The ftp package is over in the tcllib project.
Log in (anonymous is fine) to add a comment.