You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose you edit a file in such a way as to not change the file size and then upload it to S3.
If you then try to sync it back down elsewhere, the logic in s3/comparator.py - compare_time() will skip over this file if the local version is older.
The text was updated successfully, but these errors were encountered:
This is a bug from what I can see and nothing to do with #599. I've come across this myself where syncing down from s3 would skip files when file size was the same even though the last modified time in S3 was newer than the last modified time on the local file system and a sync was required.
As @chris-gilmore mentioned, it seems like its just because the compare_time() function is wrong.
In aws-cli/awscli/customizations/s3/syncstrategy/base.py, lines 207 - 223 (as of 9f56e8f):
if cmd == "upload" or cmd == "copy":
if self.total_seconds(delta) >= 0:
# Destination is newer than source.
return True
else:
# Destination is older than source, so
# we have a more recently updated file
# at the source location.
return False
elif cmd == "download":
if self.total_seconds(delta) <= 0:
return True
else:
# delta is positive, so the destination
# is newer than the source.
return False
There shouldn't be any logic difference between the cmd == "upload" or cmd == "copy" or cmd == "download". Its comparing src file and destination file times, and so all it needs to know is if the src file is newer than the destination or not.
i.e. Change the above block of code just to:
if self.total_seconds(delta) >= 0:
# Destination is newer than source.
return True
else:
# Destination is older than source, so
# we have a more recently updated file
# at the source location.
return False
This same code was also in an issue in earlier versions where the sync strategies weren't split out, and the comparison code was in comparator.py
Suppose you edit a file in such a way as to not change the file size and then upload it to S3.
If you then try to sync it back down elsewhere, the logic in s3/comparator.py - compare_time() will skip over this file if the local version is older.
The text was updated successfully, but these errors were encountered: