From 3008e4d6d986d83c4667a990e7a0ae0e5d93cb72 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 28 Jul 2004 10:10:58 +0000 Subject: [PATCH] - Needed to move the partial-dir check in the generator. - Improved the docs some more. --- partial-dir.diff | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/partial-dir.diff b/partial-dir.diff index e230ed5..2a3c4c2 100644 --- a/partial-dir.diff +++ b/partial-dir.diff @@ -12,8 +12,8 @@ You must run "make proto" after applying this patch. char *fname = cleanup_fname; cleanup_fname = NULL; if (cleanup_fd_r != -1) ---- orig/generator.c 2004-07-26 16:24:55 -+++ generator.c 2004-07-27 03:58:55 +--- orig/generator.c 2004-07-28 10:05:29 ++++ generator.c 2004-07-28 09:58:28 @@ -42,6 +42,7 @@ extern int size_only; extern int io_timeout; extern int protocol_version; @@ -22,26 +22,23 @@ You must run "make proto" after applying this patch. extern char *compare_dest; extern int link_dest; extern int whole_file; -@@ -418,7 +419,18 @@ static void recv_generator(char *fname, +@@ -496,6 +497,16 @@ static void recv_generator(char *fname, return; } -- fnamecmp = fname; + if (partial_dir) { + STRUCT_STAT st2; -+ if (!(fnamecmp = partial_dir_fname(fname))) -+ fnamecmp = fname; -+ else if (link_stat(fnamecmp, &st2, 0) == 0 ++ char *partialptr = partial_dir_fname(fname); ++ if (partialptr && link_stat(partialptr, &st2, 0) == 0 + && S_ISREG(st2.st_mode)) { -+ statret = 0; + st = st2; -+ } else -+ fnamecmp = fname; -+ } else -+ fnamecmp = fname; ++ fnamecmp = partialptr; ++ } ++ } ++ + /* open the file */ + fd = do_open(fnamecmp, O_RDONLY, 0); - if (statret == -1 && compare_dest != NULL) { - /* try the file at compare_dest instead */ --- orig/options.c 2004-07-23 17:16:13 +++ options.c 2004-07-26 16:43:48 @@ -118,6 +118,7 @@ unsigned int backup_dir_remainder; @@ -234,7 +231,7 @@ You must run "make proto" after applying this patch. /* Log-message categories. FLOG is only used on the daemon side to * output messages to the log file. */ --- orig/rsync.yo 2004-07-24 16:52:10 -+++ rsync.yo 2004-07-27 23:48:13 ++++ rsync.yo 2004-07-28 02:26:19 @@ -317,6 +317,7 @@ verb( --ignore-errors delete even if there are I/O errors --max-delete=NUM don't delete more than NUM files @@ -243,7 +240,7 @@ You must run "make proto" after applying this patch. --force force deletion of dirs even if not empty --numeric-ids don't map uid/gid values by user/group name --timeout=TIME set I/O timeout in seconds -@@ -865,6 +866,26 @@ it is more desirable to keep partially t +@@ -865,6 +866,29 @@ it is more desirable to keep partially t --partial option tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster. @@ -251,21 +248,24 @@ You must run "make proto" after applying this patch. +put a partially transferred file into DIR instead of writing out the +file to the destination dir. Rsync will also use a file found in this +dir as data to speed up the transfer (i.e. when you redo the send after -+rsync creates a partial file). ++rsync creates a partial file) and delete such a file after it has served ++its purpose. + -+Rsync will create the dir if it is missing, so feel free to use a -+relative path (such as "--partial-dir=.rsync-partial") if you want the -+file put into a directory created in the destination file's directory -+(rsync will also try to remove the DIR if a partial file was found to -+already exist and the DIR was specified as a relative path). ++Rsync will create the dir if it is missing (just the last dir -- not the ++whole path). This makes it easy to use a relative path (such as ++"--partial-dir=.rsync-partial") to have rsync create the partial-directory ++in the destination file's directory (rsync will also try to remove the DIR ++if a partial file was found to exist at the start of the transfer and the ++DIR was specified as a relative path). + +If you are deleting files on the destination and your partial-dir is -+inside the destination hierarchy, you should use --delete-after or add an -+exclude to prevent the partial file from being deleted before it can be -+used (e.g. "--exclude=.rsync-partial/"). ++inside the destination hierarchy, make sure you specify an exclude to ++prevent the partial file from being deleted (it could get deleted at the ++end of the transfer when using --delete-after, or at the beginning of the ++transfer when using --delete). E.g. "--exclude=.rsync-partial/". + -+IMPORTANT: do NOT use a directory for the --partial-dir that is writable -+by other users (such as /tmp) -- it is insecure! ++IMPORTANT: the --partial-dir should not be writable by other users to ++avoid a security risk. E.g. AVOID "/tmp". + dit(bf(--progress)) This option tells rsync to print information showing the progress of the transfer. This gives a bored user -- 2.34.1