Skip to content

Commit

Permalink
* s3cmd: Don't crash when file disappears before
Browse files Browse the repository at this point in the history
	  checking MD5.



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@457 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information
ludvigm committed Dec 23, 2010
1 parent 80bf944 commit bff2856
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2010-12-24 Michal Ludvig <mludvig@logix.net.nz>

* s3cmd: Don't crash when file disappears before
checking MD5.

2010-12-09 Michal Ludvig <mludvig@logix.net.nz>

* Released version 1.0.0-rc2
Expand Down
26 changes: 17 additions & 9 deletions s3cmd
Expand Up @@ -805,15 +805,23 @@ def _compare_filelists(src_list, dst_list, src_remote, dst_remote):

if attribs_match and 'md5' in cfg.sync_checks:
## ... same size, check MD5
if src_remote == False and dst_remote == True:
src_md5 = Utils.hash_file_md5(src_list[file]['full_name'])
dst_md5 = dst_list[file]['md5']
elif src_remote == True and dst_remote == False:
src_md5 = src_list[file]['md5']
dst_md5 = Utils.hash_file_md5(dst_list[file]['full_name'])
elif src_remote == True and dst_remote == True:
src_md5 = src_list[file]['md5']
dst_md5 = dst_list[file]['md5']
try:
if src_remote == False and dst_remote == True:
src_md5 = Utils.hash_file_md5(src_list[file]['full_name'])
dst_md5 = dst_list[file]['md5']
elif src_remote == True and dst_remote == False:
src_md5 = src_list[file]['md5']
dst_md5 = Utils.hash_file_md5(dst_list[file]['full_name'])
elif src_remote == True and dst_remote == True:
src_md5 = src_list[file]['md5']
dst_md5 = dst_list[file]['md5']
except:
# MD5 sum verification failed - ignore that file altogether
debug(u"IGNR: %s (disappeared)" % (file))
warning(u"%s: file disappeared, ignoring." % (file))
del(src_list[file])
del(dst_list[file])
continue

if src_md5 != dst_md5:
## Checksums are different.
Expand Down

0 comments on commit bff2856

Please sign in to comment.