Bug 12030 - rsync leaves temporary files when transfer is interrupted.
Summary: rsync leaves temporary files when transfer is interrupted.
Status: NEW
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.2
Hardware: All FreeBSD
: P5 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-20 19:35 UTC by Yuri
Modified: 2016-07-30 22:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2016-07-20 19:35:22 UTC
When the transfer 'rsync -a dir remote:.' is interrupted and then reran, it leaves the temporary files with a period as a prefix and suffixes like this: .T5umN0

It will be great if rsync first cleaned up the previously left temp files that have the same name pattern.
Comment 1 Kevin Korb 2016-07-20 21:48:23 UTC
By default rsync does delete the incomplete file when it is aborted.  The override for that is --partial (which is implied by -P).

However, it also depends on how the rsync is interrupted.  If it crashed or was killed then it wouldn't have the opportunity to clean up.  If network connectivity was lost then it is possible that the sshd and rsync are actually still running waiting to receive the rest of that file.
Comment 2 Yuri 2016-07-30 22:00:51 UTC
The intelligent way to handle this is to verify the leftover temporary file content with partial checksums and reuse it if the content is the same as an incoming file.
Comment 3 Kevin Korb 2016-07-30 22:07:21 UTC
If you use --partial or --inplace and you don't use --whole-file that is exactly what it will do.