Blame SOURCES/rsync-3.1.3-append-check.patch

1110d0
commit bd17c2a4e237ca1f38544db65053ecfea6054009
1110d0
Author: Tomas Korbar <tkorbar@redhat.com>
1110d0
Date:   Thu Sep 24 13:17:45 2020 +0200
1110d0
1110d0
    Skip files for transfer that has been truncated during negotiation
1110d0
1110d0
diff --git a/rsync.1 b/rsync.1
1110d0
index 6cabd44..855dd47 100644
1110d0
--- a/rsync.1
1110d0
+++ b/rsync.1
1110d0
@@ -1004,8 +1004,10 @@ This causes rsync to update a file by appending data onto
1110d0
 the end of the file, which presumes that the data that already exists on
1110d0
 the receiving side is identical with the start of the file on the sending
1110d0
 side.  If a file needs to be transferred and its size on the receiver is
1110d0
-the same or longer than the size on the sender, the file is skipped.  This
1110d0
-does not interfere with the updating of a file\(cq\&s non\-content attributes
1110d0
+the same or longer than the size on the sender, the file is skipped. It
1110d0
+also skips any files whose size on the sending side gets shorter during
1110d0
+the send negotiations (rsync warns about a "diminished" file when this
1110d0
+happens). This does not interfere with the updating of a file\(cq\&s non\-content attributes
1110d0
 (e.g. permissions, ownership, etc.) when the file does not need to be
1110d0
 transferred, nor does it affect the updating of any non\-regular files.
1110d0
 Implies \fB\-\-inplace\fP.
1110d0
diff --git a/sender.c b/sender.c
1110d0
index 1cc28a1..e22eadd 100644
1110d0
--- a/sender.c
1110d0
+++ b/sender.c
1110d0
@@ -379,6 +379,16 @@ void send_files(int f_in, int f_out)
1110d0
 			}
1110d0
 		}
1110d0
 
1110d0
+		if (append_mode > 0 && st.st_size < F_LENGTH(file)) {
1110d0
+			rprintf(FWARNING, "skipped diminished file: %s\n",
1110d0
+				full_fname(fname));
1110d0
+			free_sums(s);
1110d0
+			close(fd);
1110d0
+			if (protocol_version >= 30)
1110d0
+				send_msg_int(MSG_NO_SEND, ndx);
1110d0
+			continue;
1110d0
+		}
1110d0
+
1110d0
 		if (st.st_size) {
1110d0
 			int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE);
1110d0
 			mbuf = map_file(fd, st.st_size, read_size, s->blength);