bug on --partial

Wayne Davison wayned at samba.org
Mon Dec 29 09:02:01 EST 2003


On Sun, Dec 28, 2003 at 12:43:05PM -0800, Wayne Davison wrote:
> An obvious change that could be made would be to count how much
> data came over the link versus how much came from the local file and
> choose from this ratio which file to save when interrupted

There is some code in rsync that attempts to avoid using the new temp
file unless some literal data was copied over the wire into the file
(which would have avoided your 400MB file getting truncated to 200MB).
However, it fails to differentiate where the data came from -- i.e. if
the data came from a file earlier in the transfer, a really big file
could get truncated to a shorter size before any new data came over the
wire for the current transfer.  The following patch should fix this (I
haven't tested it yet, but this is a pretty simple change):

--- receiver.c	15 Dec 2003 08:14:27 -0000	1.56
+++ receiver.c	28 Dec 2003 21:51:33 -0000
@@ -39,6 +39,7 @@
 extern char *backup_dir;
 extern char *backup_suffix;
 extern int backup_suffix_len;
+extern int cleanup_got_literal;
 
 static struct delete_list {
 	DEV64_T dev;
@@ -259,8 +260,6 @@
 			show_progress(offset, total_size);
 
 		if (i > 0) {
-			extern int cleanup_got_literal;
-
 			if (verbose > 3) {
 				rprintf(FINFO,"data recv %d at %.0f\n",
 					i,(double)offset);
@@ -384,6 +383,7 @@
 
 		stats.num_transferred_files++;
 		stats.total_transferred_size += file->length;
+		cleanup_got_literal = 0;
 
 		if (local_name)
 			fname = local_name;

Note that I'm not planning to put this into 2.6.0.  (I'm not going to
put anything into it that isn't of vital importance at this point.)

..wayne..



More information about the rsync mailing list