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