ftp.size lies after NLST command
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Smart Package Manager |
New
|
Undecided
|
Unassigned |
Bug Description
Imported: http://
Reason for Import: patch review
further details: https:/
#msg1159 (view) Author: Seweryn Walentynowicz Date: 2007-06-25.21:29:44
If we define channel, which use ftp protocol, sometimes we got an error:
"Server reports unexpected size"
It happens when file size in repodata differs from file size reading direct
from FTP session before fetching a file. This size is reading by FTP command
SIZE <filename>. As described in RFC this command returns size in bytes
( same as size in metadata file ) if FTP mode is binary, but in ASCII ftp
mode this size is greater ( including LF appended to end of each line, and
^Z at the end of file ).
And now in smart fetcher.py code we have:
ftp.
...
try:
total = ftp.size(filename)
...
if size != total:
raise.
calling ftp.nlst function from python ftplib set mode of FTP session to ASCII
( send command 'TYPE A' before 'NLST ...' ). After that size reading with
ftp.size was greater than real bytes size of file.
I've patched my local copy with :
try:
+ ftp.voidcmd('TYPE I')
total = ftp.size(filename)
and now all works fine.