From 0808daa5ca0ad76d46c74eaad2c46c023704cdc8 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 27 Nov 2004 18:21:46 +0000 Subject: [PATCH] Fixed failing hunks. --- dir-times.diff | 38 +++++++++------- fname-convert.diff | 34 +++++++-------- fsync.diff | 20 ++++----- fuzzy.diff | 88 +++++++++++++++++++------------------- inplace-protocol-bump.diff | 16 +++---- link-by-hash.diff | 50 +++++++++++----------- param-port.diff | 10 ++--- remove-sent-files.diff | 50 +++++++++++----------- 8 files changed, 155 insertions(+), 151 deletions(-) diff --git a/dir-times.diff b/dir-times.diff index 7e5b792..ea39018 100644 --- a/dir-times.diff +++ b/dir-times.diff @@ -1,4 +1,4 @@ ---- orig/options.c 2004-10-14 17:11:40 +--- orig/options.c 2004-11-27 17:53:24 +++ options.c 2004-07-03 20:17:33 @@ -48,6 +48,7 @@ int preserve_devices = 0; int preserve_uid = 0; @@ -8,7 +8,7 @@ int update_only = 0; int cvs_exclude = 0; int dry_run = 0; -@@ -252,7 +253,8 @@ void usage(enum logcode F) +@@ -259,7 +260,8 @@ void usage(enum logcode F) rprintf(F," -o, --owner preserve owner (root only)\n"); rprintf(F," -g, --group preserve group\n"); rprintf(F," -D, --devices preserve devices (root only)\n"); @@ -18,7 +18,7 @@ rprintf(F," -S, --sparse handle sparse files efficiently\n"); rprintf(F," -n, --dry-run show what would have been transferred\n"); rprintf(F," -W, --whole-file copy whole files, no incremental checks\n"); -@@ -355,6 +357,7 @@ static struct poptOption long_options[] +@@ -365,6 +367,7 @@ static struct poptOption long_options[] {"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 }, {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, @@ -26,7 +26,7 @@ {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 }, {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 }, {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 }, -@@ -1007,6 +1010,8 @@ void server_options(char **args,int *arg +@@ -1080,6 +1083,8 @@ void server_options(char **args,int *arg argstr[x++] = 'D'; if (preserve_times) argstr[x++] = 't'; @@ -69,7 +69,7 @@ rsyserr(FERROR, errno, "failed to set times on %s", full_fname(fname)); return 0; ---- orig/rsync.yo 2004-10-06 00:12:16 +--- orig/rsync.yo 2004-11-27 17:53:24 +++ rsync.yo 2004-08-11 17:27:51 @@ -329,7 +329,8 @@ verb( -o, --owner preserve owner (root only) @@ -81,7 +81,7 @@ -S, --sparse handle sparse files efficiently -n, --dry-run show what would have been transferred -W, --whole-file copy whole files, no incremental checks -@@ -602,14 +603,23 @@ dit(bf(-D, --devices)) This option cause +@@ -611,14 +612,23 @@ dit(bf(-D, --devices)) This option cause block device information to the remote system to recreate these devices. This option is only available to the super-user. @@ -198,27 +198,33 @@ # The script would have aborted on error, so getting here means we've won. exit 0 ---- orig/testsuite/compare-dest.test 2004-07-23 17:16:13 -+++ testsuite/compare-dest.test 2004-08-13 09:00:35 -@@ -18,15 +18,15 @@ altdir="$tmpdir/alt" +--- orig/testsuite/compare-dest.test 2004-11-27 18:01:54 ++++ testsuite/compare-dest.test 2004-11-27 18:06:27 +@@ -19,19 +19,19 @@ alt2dir="$tmpdir/alt2" hands_setup # Setup the alt and chk dirs --$RSYNC -av --include=text --include='*/' --exclude='*' "$fromdir/" "$altdir/" -+$RSYNC -adv --include=text --include='*/' --exclude='*' "$fromdir/" "$altdir/" +-$RSYNC -av --include=text --include='*/' --exclude='*' "$fromdir/" "$alt1dir/" +-$RSYNC -av --include=etc-ltr-list --include='*/' --exclude='*' "$fromdir/" "$alt2dir/" ++$RSYNC -adv --include=text --include='*/' --exclude='*' "$fromdir/" "$alt1dir/" ++$RSYNC -adv --include=etc-ltr-list --include='*/' --exclude='*' "$fromdir/" "$alt2dir/" sleep 1 touch "$fromdir/dir/text" --$RSYNC -av --exclude=/text "$fromdir/" "$chkdir/" -+$RSYNC -adv --exclude=/text "$fromdir/" "$chkdir/" +-$RSYNC -av --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/" ++$RSYNC -adv --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/" # Let's do it! --checkit "$RSYNC -avv --no-whole-file --compare-dest=\"$altdir\" \ -+checkit "$RSYNC -advv --no-whole-file --compare-dest=\"$altdir\" \ +-checkit "$RSYNC -avv --no-whole-file \ ++checkit "$RSYNC -advv --no-whole-file \ + --compare-dest=\"$alt1dir\" --compare-dest=\"$alt2dir\" \ \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir" +-checkit "$RSYNC -avv --no-whole-file \ ++checkit "$RSYNC -advv --no-whole-file \ + --copy-dest=\"$alt1dir\" --copy-dest=\"$alt2dir\" \ + \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" - # The script would have aborted on error, so getting here means we've won. --- orig/testsuite/daemon-gzip-download.test 2004-05-18 09:14:24 +++ testsuite/daemon-gzip-download.test 2004-07-03 20:17:33 @@ -29,9 +29,9 @@ export RSYNC_CONNECT_PROG diff --git a/fname-convert.diff b/fname-convert.diff index 2e5232c..78fc213 100644 --- a/fname-convert.diff +++ b/fname-convert.diff @@ -47,7 +47,7 @@ some utility functions. Note that you'll need to run 'make proto' after applying this patch. ---- orig/Makefile.in 2004-10-14 17:11:40 +--- orig/Makefile.in 2004-11-03 11:56:03 +++ Makefile.in 2004-07-03 20:18:02 @@ -35,7 +35,7 @@ OBJS1=rsync.o generator.o receiver.o cle main.o checksum.o match.o syscall.o log.o backup.o @@ -382,9 +382,9 @@ Note that you'll need to run 'make proto' after applying this patch. + if (verbose > 2) + rprintf(FINFO, "Converted filename: %s -> %s\n", src, dest); +} ---- orig/generator.c 2004-10-06 00:12:16 +--- orig/generator.c 2004-11-27 17:53:24 +++ generator.c 2004-07-03 20:18:02 -@@ -252,6 +252,12 @@ static void generate_and_send_sums(int f +@@ -255,6 +255,12 @@ static void generate_and_send_sums(int f * * @note This comment was added later by mbp who was trying to work it * out. It might be wrong. @@ -396,7 +396,7 @@ Note that you'll need to run 'make proto' after applying this patch. + * reporting to the sender. */ static void recv_generator(char *fname, struct file_struct *file, int i, - int f_out) + int f_out, int f_out_name) --- orig/log.c 2004-09-07 19:54:51 +++ log.c 2004-07-03 20:18:02 @@ -57,6 +57,7 @@ struct { @@ -407,9 +407,9 @@ Note that you'll need to run 'make proto' after applying this patch. { RERR_SIGNAL , "received SIGUSR1 or SIGINT" }, { RERR_WAITCHILD , "some error returned by waitpid()" }, { RERR_MALLOC , "error allocating core memory buffers" }, ---- orig/main.c 2004-10-08 20:16:26 +--- orig/main.c 2004-11-27 17:53:24 +++ main.c 2004-07-22 00:31:47 -@@ -332,7 +332,7 @@ static pid_t do_cmd(char *cmd, char *mac +@@ -333,7 +333,7 @@ static pid_t do_cmd(char *cmd, char *mac whole_file = 1; ret = local_child(argc, args, f_in, f_out, child_main); } else @@ -418,28 +418,28 @@ Note that you'll need to run 'make proto' after applying this patch. if (dir) free(dir); ---- orig/options.c 2004-10-14 17:11:40 -+++ options.c 2004-10-14 17:19:47 -@@ -129,6 +129,7 @@ char *backup_dir = NULL; - char backup_dir_buf[MAXPATHLEN]; +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:09:09 +@@ -132,6 +132,7 @@ char backup_dir_buf[MAXPATHLEN]; int rsync_port = RSYNC_PORT; + int copy_dest = 0; int link_dest = 0; +char *fname_convert_cmd = NULL; int verbose = 0; int quiet = 0; -@@ -280,6 +281,7 @@ void usage(enum logcode F) - rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n"); - rprintf(F," --link-dest=DIR create hardlinks to DIR for unchanged files\n"); +@@ -289,6 +290,7 @@ void usage(enum logcode F) + rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n"); + rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); rprintf(F," -P equivalent to --partial --progress\n"); + rprintf(F," --fname-convert=CMD invoke CMD for filename conversion\n"); rprintf(F," -z, --compress compress file data\n"); rprintf(F," -C, --cvs-exclude auto ignore files in the same way CVS does\n"); rprintf(F," --exclude=PATTERN exclude files matching PATTERN\n"); -@@ -371,6 +373,7 @@ static struct poptOption long_options[] - {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 }, - {"compare-dest", 0, POPT_ARG_STRING, &compare_dest, 0, 0, 0 }, - {"link-dest", 0, POPT_ARG_STRING, &compare_dest, OPT_LINK_DEST, 0, 0 }, +@@ -383,6 +385,7 @@ static struct poptOption long_options[] + {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, + {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, + {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, + {"fname-convert", 0, POPT_ARG_STRING, &fname_convert_cmd, 0, 0, 0 }, /* TODO: Should this take an optional int giving the compression level? */ {"compress", 'z', POPT_ARG_NONE, &do_compression, 0, 0, 0 }, diff --git a/fsync.diff b/fsync.diff index bbb3b83..f350bc3 100644 --- a/fsync.diff +++ b/fsync.diff @@ -1,8 +1,8 @@ This patch from Sami Farin lets you specify --fsync if you want fsync() to be called on every file we write. ---- orig/options.c 2004-10-14 17:11:40 -+++ options.c 2004-07-03 20:18:13 +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:10:44 @@ -38,6 +38,7 @@ int make_backups = 0; **/ int whole_file = -1; @@ -11,7 +11,7 @@ to be called on every file we write. int archive_mode = 0; int keep_dirlinks = 0; int copy_links = 0; -@@ -240,6 +241,7 @@ void usage(enum logcode F) +@@ -247,6 +248,7 @@ void usage(enum logcode F) rprintf(F," -b, --backup make backups (see --suffix & --backup-dir)\n"); rprintf(F," --backup-dir make backups into this directory\n"); rprintf(F," --suffix=SUFFIX backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX); @@ -19,7 +19,7 @@ to be called on every file we write. rprintf(F," -u, --update update only (don't overwrite newer files)\n"); rprintf(F," --inplace update destination files inplace (SEE MAN PAGE)\n"); rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n"); -@@ -339,6 +341,7 @@ static struct poptOption long_options[] +@@ -349,6 +351,7 @@ static struct poptOption long_options[] {"safe-links", 0, POPT_ARG_NONE, &safe_symlinks, 0, 0, 0 }, {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 }, {"backup", 'b', POPT_ARG_NONE, &make_backups, 0, 0, 0 }, @@ -27,27 +27,27 @@ to be called on every file we write. {"dry-run", 'n', POPT_ARG_NONE, &dry_run, 0, 0, 0 }, {"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 }, {"cvs-exclude", 'C', POPT_ARG_NONE, &cvs_exclude, 0, 0, 0 }, -@@ -1135,6 +1138,9 @@ void server_options(char **args,int *arg +@@ -1213,6 +1216,9 @@ void server_options(char **args,int *arg args[ac++] = tmpdir; } + if (do_fsync && am_sender) + args[ac++] = "--fsync"; + - if (compare_dest && am_sender) { + if (basis_dir[0] && am_sender) { /* the server only needs this option if it is not the sender, * and it may be an older version that doesn't know this ---- orig/receiver.c 2004-09-21 09:40:27 +--- orig/receiver.c 2004-11-27 17:57:31 +++ receiver.c 2004-07-16 20:13:31 -@@ -36,6 +36,7 @@ extern int preserve_hard_links; +@@ -37,6 +37,7 @@ extern int preserve_hard_links; extern int preserve_perms; extern int cvs_exclude; extern int io_error; +extern int do_fsync; extern char *tmpdir; extern char *partial_dir; - extern char *compare_dest; -@@ -305,6 +306,12 @@ static int receive_data(int f_in, char * + extern char *basis_dir[]; +@@ -306,6 +307,12 @@ static int receive_data(int f_in, char * exit_cleanup(RERR_FILEIO); } diff --git a/fuzzy.diff b/fuzzy.diff index ba02e1d..0829e0d 100644 --- a/fuzzy.diff +++ b/fuzzy.diff @@ -1,20 +1,20 @@ The changes to generator.c were greatly simplified, making the patch easier to maintain and fixing the failing test in the testsuite. -Very lightly tested. +Lightly tested. Be sure to run "make proto" before "make". ---- orig/generator.c 2004-11-03 20:30:45 -+++ generator.c 2004-11-03 22:52:53 -@@ -43,6 +43,7 @@ extern int ignore_times; - extern int size_only; +--- orig/generator.c 2004-11-27 17:53:24 ++++ generator.c 2004-11-27 18:12:57 +@@ -44,6 +44,7 @@ extern int size_only; + extern OFF_T max_size; extern int io_timeout; extern int protocol_version; +extern int fuzzy_basis; extern int always_checksum; extern char *partial_dir; - extern char *compare_dest; -@@ -244,6 +245,92 @@ static void generate_and_send_sums(int f + extern char *basis_dir[]; +@@ -247,6 +248,92 @@ static void generate_and_send_sums(int f } @@ -107,7 +107,7 @@ Be sure to run "make proto" before "make". /* * Acts on file number @p i from @p flist, whose name is @p fname. -@@ -466,6 +553,15 @@ static void recv_generator(char *fname, +@@ -501,6 +588,15 @@ static void recv_generator(char *fname, } else partialptr = NULL; @@ -123,16 +123,16 @@ Be sure to run "make proto" before "make". if (statret == -1) { if (preserve_hard_links && hard_link_check(file, HL_SKIP)) return; -@@ -492,7 +588,7 @@ static void recv_generator(char *fname, - return; - } +@@ -529,6 +625,8 @@ static void recv_generator(char *fname, -- if (skip_file(fnamecmp, file, &st)) { -+ if (fnamecmp_type != FNAMECMP_FUZZY && skip_file(fnamecmp, file, &st)) { + if ((link_dest || copy_dest) && fnamecmp_type != FNAMECMP_FNAME) + ; ++ else if (fnamecmp_type == FNAMECMP_FUZZY) ++ ; + else if (unchanged_file(fnamecmp, file, &st)) { if (fnamecmp_type == FNAMECMP_FNAME) set_perms(fname, file, &st, PERMS_REPORT); - return; -@@ -563,8 +659,24 @@ prepare_to_open: +@@ -600,8 +698,24 @@ prepare_to_open: notify_others: write_int(f_out, i); @@ -158,8 +158,8 @@ Be sure to run "make proto" before "make". if (dry_run || read_batch) return; ---- orig/main.c 2004-11-03 20:30:45 -+++ main.c 2004-07-22 00:32:31 +--- orig/main.c 2004-11-27 17:53:24 ++++ main.c 2004-11-27 18:13:51 @@ -48,6 +48,7 @@ extern int keep_dirlinks; extern int preserve_hard_links; extern int protocol_version; @@ -172,39 +172,39 @@ Be sure to run "make proto" before "make". int pid; int status = 0; int error_pipe[2], name_pipe[2]; -- BOOL need_name_pipe = compare_dest && !dry_run; -+ BOOL need_name_pipe = (compare_dest || fuzzy_basis) && !dry_run; +- BOOL need_name_pipe = basis_dir[0] && !dry_run; ++ BOOL need_name_pipe = (basis_dir[0] || fuzzy_basis) && !dry_run; /* The receiving side mustn't obey this, or an existing symlink that * points to an identical file won't be replaced by the referent. */ ---- orig/options.c 2004-10-14 17:11:40 -+++ options.c 2004-10-14 17:21:51 -@@ -85,6 +85,7 @@ int safe_symlinks = 0; - int copy_unsafe_links = 0; +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:14:43 +@@ -86,6 +86,7 @@ int copy_unsafe_links = 0; int size_only = 0; + int daemon_bwlimit = 0; int bwlimit = 0; +int fuzzy_basis = 0; size_t bwlimit_writemax = 0; int delete_after = 0; int only_existing = 0; -@@ -279,6 +280,7 @@ void usage(enum logcode F) - rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n"); +@@ -288,6 +289,7 @@ void usage(enum logcode F) rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n"); - rprintf(F," --link-dest=DIR create hardlinks to DIR for unchanged files\n"); + rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n"); + rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); + rprintf(F," --fuzzy use similar file as basis if basis doesn't exist\n"); rprintf(F," -P equivalent to --partial --progress\n"); rprintf(F," -z, --compress compress file data\n"); rprintf(F," -C, --cvs-exclude auto ignore files in the same way CVS does\n"); -@@ -371,6 +373,7 @@ static struct poptOption long_options[] - {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 }, - {"compare-dest", 0, POPT_ARG_STRING, &compare_dest, 0, 0, 0 }, - {"link-dest", 0, POPT_ARG_STRING, &compare_dest, OPT_LINK_DEST, 0, 0 }, +@@ -383,6 +385,7 @@ static struct poptOption long_options[] + {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, + {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, + {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, + {"fuzzy", 0, POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 }, /* TODO: Should this take an optional int giving the compression level? */ {"compress", 'z', POPT_ARG_NONE, &do_compression, 0, 0, 0 }, {"stats", 0, POPT_ARG_NONE, &do_stats, 0, 0, 0 }, -@@ -890,6 +893,11 @@ int parse_arguments(int *argc, const cha - link_dest ? "--link-dest" : "--compare-dest"); +@@ -963,6 +966,11 @@ int parse_arguments(int *argc, const cha + dest_option); return 0; } + if (compare_dest) { @@ -215,7 +215,7 @@ Be sure to run "make proto" before "make". } else { if (keep_partial && !partial_dir) partial_dir = getenv("RSYNC_PARTIAL_DIR"); -@@ -1156,6 +1164,9 @@ void server_options(char **args,int *arg +@@ -1237,6 +1245,9 @@ void server_options(char **args,int *arg } } @@ -225,8 +225,8 @@ Be sure to run "make proto" before "make". *argc = ac; return; ---- orig/receiver.c 2004-11-03 20:30:45 -+++ receiver.c 2004-11-03 22:54:05 +--- orig/receiver.c 2004-11-27 17:57:31 ++++ receiver.c 2004-11-27 18:15:01 @@ -320,6 +320,27 @@ static int receive_data(int f_in, char * } @@ -255,7 +255,7 @@ Be sure to run "make proto" before "make". static void discard_receive_data(int f_in, OFF_T length) { receive_data(f_in, NULL, -1, 0, NULL, -1, length); -@@ -449,6 +470,10 @@ int recv_files(int f_in, struct file_lis +@@ -450,6 +471,10 @@ int recv_files(int f_in, struct file_lis case FNAMECMP_BACKUP: fnamecmp = get_backup_name(fname); break; @@ -263,12 +263,12 @@ Be sure to run "make proto" before "make". + read_gen_name(f_in_name, fnamecmpbuf); + fnamecmp = fnamecmpbuf; + break; - case FNAMECMP_CMPDEST: + case FNAMECMP_BASIS_DIR: default: pathjoin(fnamecmpbuf, sizeof fnamecmpbuf, ---- orig/rsync.h 2004-11-03 20:30:45 +--- orig/rsync.h 2004-11-27 17:53:24 +++ rsync.h 2004-11-03 22:53:09 -@@ -123,6 +123,7 @@ +@@ -125,6 +125,7 @@ #define FNAMECMP_FNAME 0x80 #define FNAMECMP_PARTIAL_DIR 0x81 #define FNAMECMP_BACKUP 0x82 @@ -276,12 +276,12 @@ Be sure to run "make proto" before "make". /* Log-message categories. FLOG is only used on the daemon side to ---- orig/rsync.yo 2004-10-06 00:12:16 -+++ rsync.yo 2004-07-03 19:27:25 -@@ -356,6 +356,7 @@ verb( - -T --temp-dir=DIR create temporary files in directory DIR +--- orig/rsync.yo 2004-11-27 17:53:24 ++++ rsync.yo 2004-11-27 18:15:22 +@@ -358,6 +358,7 @@ verb( --compare-dest=DIR also compare received files relative to DIR - --link-dest=DIR create hardlinks to DIR for unchanged files + --copy-dest=DIR ... and include copies of unchanged files + --link-dest=DIR hardlink to files in DIR when unchanged + --fuzzy use similar file as basis if basis is gone -P equivalent to --partial --progress -z, --compress compress file data diff --git a/inplace-protocol-bump.diff b/inplace-protocol-bump.diff index 7d2e75b..2bdf703 100644 --- a/inplace-protocol-bump.diff +++ b/inplace-protocol-bump.diff @@ -3,9 +3,9 @@ sender if --inplace was specified. This allows the sender to know when the transfer can fully utilize the basis file (i.e., when the basis file is not the destination file). ---- orig/generator.c 2004-11-11 22:13:09 +--- orig/generator.c 2004-11-27 17:53:24 +++ generator.c 2004-11-03 20:37:57 -@@ -568,6 +568,8 @@ prepare_to_open: +@@ -600,6 +600,8 @@ prepare_to_open: notify_others: write_int(f_out, i); @@ -61,22 +61,22 @@ is not the destination file). || s->sums[want_i].flags & SUMFLG_SAME_OFFSET) && sum == s->sums[want_i].sum1 && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) { ---- orig/options.c 2004-11-11 22:13:09 -+++ options.c 2004-11-03 20:47:21 -@@ -917,10 +917,9 @@ int parse_arguments(int *argc, const cha +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:18:27 +@@ -957,10 +957,9 @@ int parse_arguments(int *argc, const cha am_server ? "server" : "client"); return 0; #endif -- if (compare_dest) { +- if (compare_dest || copy_dest || link_dest) { + if (link_dest) { snprintf(err_buf, sizeof err_buf, - "--inplace does not yet work with %s\n", -- link_dest ? "--link-dest" : "--compare-dest"); +- dest_option); + "--inplace does not yet work with --link-dest\n"); return 0; } } else { ---- orig/rsync.h 2004-11-03 20:30:45 +--- orig/rsync.h 2004-11-27 17:53:24 +++ rsync.h 2004-11-03 20:32:34 @@ -62,7 +62,7 @@ #define FLAG_MOUNT_POINT (1<<2) /* sender only */ diff --git a/link-by-hash.diff b/link-by-hash.diff index bb7fb19..8ec19f7 100644 --- a/link-by-hash.diff +++ b/link-by-hash.diff @@ -365,44 +365,44 @@ the file's name. +} + +#endif ---- orig/options.c 2004-11-11 22:13:09 -+++ options.c 2004-10-14 17:24:21 -@@ -127,6 +127,7 @@ char *log_format = NULL; +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:19:42 +@@ -128,6 +128,7 @@ char *log_format = NULL; char *password_file = NULL; char *rsync_path = RSYNC_PATH; char *backup_dir = NULL; +char *link_by_hash_dir = NULL; char backup_dir_buf[MAXPATHLEN]; int rsync_port = RSYNC_PORT; - int link_dest = 0; -@@ -282,6 +283,7 @@ void usage(enum logcode F) - rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n"); + int copy_dest = 0; +@@ -288,6 +289,7 @@ void usage(enum logcode F) rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n"); - rprintf(F," --link-dest=DIR create hardlinks to DIR for unchanged files\n"); + rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n"); + rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); + rprintf(F," --link-by-hash=DIR create hardlinks by hash to DIR for regular files\n"); rprintf(F," -P equivalent to --partial --progress\n"); rprintf(F," -z, --compress compress file data\n"); rprintf(F," -C, --cvs-exclude auto ignore files in the same way CVS does\n"); -@@ -315,7 +317,7 @@ void usage(enum logcode F) - enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, - OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST, +@@ -322,7 +324,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP + OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, + OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, - OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, OPT_MAX_SIZE, + OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, OPT_MAX_SIZE, OPT_LINK_BY_HASH, OPT_REFUSED_BASE = 9000}; static struct poptOption long_options[] = { -@@ -375,6 +377,7 @@ static struct poptOption long_options[] - {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 }, - {"compare-dest", 0, POPT_ARG_STRING, &compare_dest, 0, 0, 0 }, - {"link-dest", 0, POPT_ARG_STRING, &compare_dest, OPT_LINK_DEST, 0, 0 }, +@@ -383,6 +385,7 @@ static struct poptOption long_options[] + {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, + {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, + {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, + {"link-by-hash", 0, POPT_ARG_STRING, 0, OPT_LINK_BY_HASH, 0, 0}, /* TODO: Should this take an optional int giving the compression level? */ {"compress", 'z', POPT_ARG_NONE, &do_compression, 0, 0, 0 }, {"stats", 0, POPT_ARG_NONE, &do_stats, 0, 0, 0 }, -@@ -716,6 +719,21 @@ int parse_arguments(int *argc, const cha - return 0; - #endif +@@ -749,6 +752,21 @@ int parse_arguments(int *argc, const cha + basis_dir[basis_dir_cnt++] = (char *)arg; + break; + case OPT_LINK_BY_HASH: +#if HAVE_LINK @@ -422,8 +422,8 @@ the file's name. default: /* A large opt value means that set_refuse_options() * turned this option off (opt-BASE is its index). */ -@@ -1182,6 +1200,11 @@ void server_options(char **args,int *arg - args[ac++] = compare_dest; +@@ -1225,6 +1243,11 @@ void server_options(char **args,int *arg + } } + if (link_by_hash_dir && am_sender) { @@ -434,12 +434,12 @@ the file's name. if (files_from && (!am_sender || remote_filesfrom_file)) { if (remote_filesfrom_file) { args[ac++] = "--files-from"; ---- orig/receiver.c 2004-11-03 20:30:45 -+++ receiver.c 2004-07-20 21:44:05 +--- orig/receiver.c 2004-11-27 17:57:31 ++++ receiver.c 2004-11-27 18:20:00 @@ -40,6 +40,7 @@ extern int io_error; extern char *tmpdir; extern char *partial_dir; - extern char *compare_dest; + extern char *basis_dir[]; +extern char *link_by_hash_dir; extern int make_backups; extern int do_progress; @@ -505,7 +505,7 @@ the file's name. } -@@ -549,8 +560,12 @@ int recv_files(int f_in, struct file_lis +@@ -550,8 +561,12 @@ int recv_files(int f_in, struct file_lis rprintf(FINFO, "%s\n", safe_fname(fname)); /* recv file data */ @@ -543,9 +543,9 @@ the file's name. if (ret < 0) { rsyserr(FERROR, errno, "%s %s -> \"%s\"", ret == -2 ? "copy" : "rename", ---- orig/rsync.h 2004-11-03 20:30:45 +--- orig/rsync.h 2004-11-27 17:53:24 +++ rsync.h 2004-07-03 20:20:15 -@@ -534,6 +534,14 @@ struct stats { +@@ -536,6 +536,14 @@ struct stats { int current_file_index; }; diff --git a/param-port.diff b/param-port.diff index b833dc7..705ee71 100644 --- a/param-port.diff +++ b/param-port.diff @@ -38,18 +38,18 @@ Adds the ability to set the default "port" in the rsyncd.conf file. FN_LOCAL_STRING(lp_name, name) FN_LOCAL_STRING(lp_comment, comment) ---- orig/options.c 2004-09-23 17:42:07 -+++ options.c 2004-09-28 18:43:43 -@@ -127,7 +127,7 @@ char *password_file = NULL; +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:21:07 +@@ -129,7 +129,7 @@ char *password_file = NULL; char *rsync_path = RSYNC_PATH; char *backup_dir = NULL; char backup_dir_buf[MAXPATHLEN]; -int rsync_port = RSYNC_PORT; +int rsync_port = 0; + int copy_dest = 0; int link_dest = 0; - int verbose = 0; ---- orig/rsyncd.conf.yo 2004-09-22 02:02:04 +--- orig/rsyncd.conf.yo 2004-10-06 00:12:16 +++ rsyncd.conf.yo 2004-09-28 18:53:35 @@ -160,6 +160,10 @@ being downloaded/uploaded by adding an e is a relatively new feature in rsync, so make sure your server is running diff --git a/remove-sent-files.diff b/remove-sent-files.diff index 448c827..7fe959b 100644 --- a/remove-sent-files.diff +++ b/remove-sent-files.diff @@ -4,9 +4,9 @@ command before "make": make proto ---- orig/io.c 2004-11-03 20:30:45 +--- orig/io.c 2004-11-25 16:32:40 +++ io.c 2004-07-03 20:17:10 -@@ -240,6 +240,14 @@ static void read_msg_fd(void) +@@ -243,6 +243,14 @@ static void read_msg_fd(void) read_loop(fd, buf, 4); redo_list_add(IVAL(buf,0)); break; @@ -21,7 +21,7 @@ command before "make": case MSG_INFO: case MSG_ERROR: case MSG_LOG: -@@ -673,6 +681,16 @@ static int readfd_unbuffered(int fd, cha +@@ -676,6 +684,16 @@ static int readfd_unbuffered(int fd, cha read_loop(fd, iobuf_in, remaining); iobuf_in_ndx = 0; break; @@ -38,7 +38,7 @@ command before "make": case MSG_INFO: case MSG_ERROR: if (remaining >= sizeof line) { ---- orig/main.c 2004-11-03 20:30:45 +--- orig/main.c 2004-11-27 17:53:24 +++ main.c 2004-08-13 08:24:23 @@ -42,6 +42,7 @@ extern int list_only; extern int local_server; @@ -48,7 +48,7 @@ command before "make": extern int orig_umask; extern int copy_links; extern int keep_dirlinks; -@@ -634,6 +635,8 @@ void start_server(int f_in, int f_out, i +@@ -648,6 +649,8 @@ void start_server(int f_in, int f_out, i if (am_sender) { keep_dirlinks = 0; /* Must be disabled on the sender. */ @@ -57,7 +57,7 @@ command before "make": recv_exclude_list(f_in); if (cvs_exclude) -@@ -715,6 +718,9 @@ int client_run(int f_in, int f_out, pid_ +@@ -732,6 +735,9 @@ int client_run(int f_in, int f_out, pid_ exit_cleanup(status); } @@ -67,9 +67,9 @@ command before "make": if (argc == 0) list_only = 1; ---- orig/options.c 2004-11-11 22:13:09 -+++ options.c 2004-10-14 17:17:53 -@@ -87,8 +87,10 @@ int size_only = 0; +--- orig/options.c 2004-11-27 17:53:24 ++++ options.c 2004-11-27 18:04:22 +@@ -88,8 +88,10 @@ int daemon_bwlimit = 0; int bwlimit = 0; size_t bwlimit_writemax = 0; int delete_after = 0; @@ -80,7 +80,7 @@ command before "make": int max_delete = 0; OFF_T max_size = 0; int ignore_errors = 0; -@@ -268,6 +270,7 @@ void usage(enum logcode F) +@@ -273,6 +275,7 @@ void usage(enum logcode F) rprintf(F," --delete delete files that don't exist on the sending side\n"); rprintf(F," --delete-excluded also delete excluded files on the receiving side\n"); rprintf(F," --delete-after receiver deletes after transferring, not before\n"); @@ -88,18 +88,16 @@ command before "make": rprintf(F," --ignore-errors delete even if there are I/O errors\n"); rprintf(F," --max-delete=NUM don't delete more than NUM files\n"); rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n"); -@@ -313,8 +316,8 @@ void usage(enum logcode F) +@@ -319,7 +322,7 @@ void usage(enum logcode F) } enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, -- OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST, -- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, +- OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, + OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_DELETE_SENT_FILES, -+ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_LINK_DEST, OPT_MODIFY_WINDOW, + OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, + OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, OPT_MAX_SIZE, - OPT_REFUSED_BASE = 9000}; - -@@ -333,6 +336,7 @@ static struct poptOption long_options[] +@@ -340,6 +343,7 @@ static struct poptOption long_options[] {"ignore-existing", 0, POPT_ARG_NONE, &opt_ignore_existing, 0, 0, 0 }, {"delete-after", 0, POPT_ARG_NONE, 0, OPT_DELETE_AFTER, 0, 0 }, {"delete-excluded", 0, POPT_ARG_NONE, 0, OPT_DELETE_EXCLUDED, 0, 0 }, @@ -107,7 +105,7 @@ command before "make": {"force", 0, POPT_ARG_NONE, &force_delete, 0, 0, 0 }, {"numeric-ids", 0, POPT_ARG_NONE, &numeric_ids, 0, 0, 0 }, {"exclude", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE, 0, 0 }, -@@ -610,6 +614,11 @@ int parse_arguments(int *argc, const cha +@@ -621,6 +625,11 @@ int parse_arguments(int *argc, const cha delete_mode = 1; break; @@ -119,7 +117,7 @@ command before "make": case OPT_EXCLUDE: add_exclude(&exclude_list, poptGetOptArg(pc), 0); break; -@@ -1194,6 +1203,9 @@ void server_options(char **args,int *arg +@@ -1237,6 +1246,9 @@ void server_options(char **args,int *arg } } @@ -129,7 +127,7 @@ command before "make": *argc = ac; return; ---- orig/receiver.c 2004-11-03 20:30:45 +--- orig/receiver.c 2004-11-27 17:57:31 +++ receiver.c 2004-08-13 08:38:51 @@ -46,6 +46,7 @@ extern char *backup_dir; extern char *backup_suffix; @@ -148,7 +146,7 @@ command before "make": char fnamecmpbuf[MAXPATHLEN]; struct file_struct *file; struct stats initial_stats; -@@ -579,7 +580,12 @@ int recv_files(int f_in, struct file_lis +@@ -580,7 +581,12 @@ int recv_files(int f_in, struct file_lis cleanup_disable(); @@ -162,7 +160,7 @@ command before "make": int msgtype = csum_length == SUM_LENGTH || read_batch ? FERROR : FINFO; if (msgtype == FERROR || verbose) { -@@ -603,9 +609,8 @@ int recv_files(int f_in, struct file_lis +@@ -604,9 +610,8 @@ int recv_files(int f_in, struct file_lis keptstr, redostr); } if (csum_length != SUM_LENGTH) { @@ -174,7 +172,7 @@ command before "make": } } } ---- orig/rsync.h 2004-11-03 20:30:45 +--- orig/rsync.h 2004-11-27 17:53:24 +++ rsync.h 2004-07-03 20:17:10 @@ -60,6 +60,7 @@ #define FLAG_TOP_DIR (1<<0) @@ -184,7 +182,7 @@ command before "make": /* update this if you make incompatible changes */ #define PROTOCOL_VERSION 28 -@@ -132,6 +133,7 @@ enum logcode { FERROR=1, FINFO=2, FLOG=3 +@@ -134,6 +135,7 @@ enum logcode { FERROR=1, FINFO=2, FLOG=3 /* Messages types that are sent over the message channel. The logcode * values must all be present here with identical numbers. */ enum msgcode { @@ -192,7 +190,7 @@ command before "make": MSG_DONE=5, /* current phase is done */ MSG_REDO=4, /* reprocess indicated flist index */ MSG_ERROR=FERROR, MSG_INFO=FINFO, MSG_LOG=FLOG, /* remote logging */ ---- orig/rsync.yo 2004-11-11 22:13:11 +--- orig/rsync.yo 2004-11-27 17:53:24 +++ rsync.yo 2004-07-03 20:17:10 @@ -343,6 +343,7 @@ verb( --delete delete files that don't exist on sender @@ -202,7 +200,7 @@ command before "make": --ignore-errors delete even if there are I/O errors --max-delete=NUM don't delete more than NUM files --max-size=SIZE don't transfer any file larger than SIZE -@@ -667,6 +668,11 @@ receiving side before transferring files +@@ -675,6 +676,11 @@ receiving side before transferring files sufficient space on the receiving filesystem. If you want to delete after transferring, use the --delete-after switch. Implies --delete. -- 2.34.1