Prevent 's3cmd get' from leaving dangling empty files on failure #98

Merged
merged 1 commit into from Jan 1, 2013

Conversation

Projects
None yet
2 participants
@orenhe
Contributor

orenhe commented Dec 31, 2012

's3cmd get' command opens destination files as 'ab' (append+write) before even trying to download. In effect, if the
file doesn't exist, s3cmd creates it.

This patch resolves an unwanted side-effect empty files being left by s3cmd after an error.
(e.g. file not found, no permission.)

Should only delete files that s3cmd created.

Signed-off-by: Oren Held oren@held.org.il

s3cmd get: delete a files if object_get had failed
's3cmd get' command opens destination files as 'ab' (append+write) before even trying to download. In effect, if the
file doesn't exist, s3cmd creates it.

This patch resolves an unwanted side-effect empty files being left by s3cmd after an error.
(e.g. file not found, no permission.)

Should only delete files that s3cmd created.

Signed-off-by: Oren Held <oren@held.org.il>

mludvig added a commit that referenced this pull request Jan 1, 2013

Merge pull request #98 from orenhe/master
Prevent 's3cmd get' from leaving dangling empty files on failure

@mludvig mludvig merged commit a91c40f into s3tools:master Jan 1, 2013

@orenhe

This comment has been minimized.

Show comment Hide comment
@orenhe

orenhe Feb 16, 2013

Contributor

There's a bug in this commit, with a very simple fix see #110

Contributor

orenhe commented on 1a05156 Feb 16, 2013

There's a bug in this commit, with a very simple fix see #110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment