From fe6407b5a9f04c88f74ea95e959aaa38334e41a6 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 15 May 2004 20:52:13 +0000 Subject: [PATCH] Fixed failing hunks and/or fuzz. --- atimes.diff | 66 ++++++++++++++++---------------- dir-times.diff | 4 +- early-chmod.diff | 22 +++++------ fsync.diff | 30 +++++++-------- fuzzy.diff | 72 +++++++++++++++++----------------- inplace.diff | 38 +++++++++--------- link-by-hash.diff | 87 +++++++++++++++++++----------------------- remove-sent-files.diff | 36 ++++++++--------- write-only.diff | 12 +++--- 9 files changed, 178 insertions(+), 189 deletions(-) diff --git a/atimes.diff b/atimes.diff index 5af4cb7..18803a8 100644 --- a/atimes.diff +++ b/atimes.diff @@ -4,9 +4,9 @@ command before "make": make proto ---- batch.c 6 Mar 2004 07:45:52 -0000 1.31 -+++ batch.c 13 May 2004 18:54:03 -0000 -@@ -342,6 +342,8 @@ void show_flist(int index, struct file_s +--- batch.c 15 May 2004 19:31:10 -0000 1.32 ++++ batch.c 15 May 2004 20:13:11 -0000 +@@ -335,6 +335,8 @@ void show_flist(int index, struct file_s rprintf(FINFO, "flist->flags=%#x\n", fptr[i]->flags); rprintf(FINFO, "flist->modtime=%#lx\n", (long unsigned) fptr[i]->modtime); @@ -15,8 +15,8 @@ command before "make": rprintf(FINFO, "flist->length=%.0f\n", (double) fptr[i]->length); rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode); ---- flist.c 11 May 2004 17:25:16 -0000 1.221 -+++ flist.c 13 May 2004 18:54:03 -0000 +--- flist.c 15 May 2004 19:31:10 -0000 1.223 ++++ flist.c 15 May 2004 20:13:11 -0000 @@ -57,6 +57,7 @@ extern int relative_paths; extern int implied_dirs; extern int copy_links; @@ -127,8 +127,8 @@ command before "make": file->length = st.st_size; file->mode = st.st_mode; file->uid = st.st_uid; ---- generator.c 13 May 2004 06:55:01 -0000 1.82 -+++ generator.c 13 May 2004 18:54:03 -0000 +--- generator.c 15 May 2004 19:31:10 -0000 1.83 ++++ generator.c 15 May 2004 20:13:11 -0000 @@ -98,7 +98,7 @@ static int skip_file(char *fname, struct return 0; } @@ -138,7 +138,7 @@ command before "make": } -@@ -466,7 +466,7 @@ void recv_generator(char *fname, struct +@@ -467,7 +467,7 @@ void recv_generator(char *fname, struct return; } @@ -148,7 +148,7 @@ command before "make": rprintf(FINFO,"%s is newer\n",fname); return; --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 18:54:04 -0000 ++++ options.c 15 May 2004 20:13:11 -0000 @@ -46,6 +46,7 @@ int preserve_devices = 0; int preserve_uid = 0; int preserve_gid = 0; @@ -182,8 +182,8 @@ command before "make": if (preserve_perms) argstr[x++] = 'p'; if (recurse) ---- rsync.c 13 May 2004 18:51:22 -0000 1.138 -+++ rsync.c 13 May 2004 18:54:04 -0000 +--- rsync.c 15 May 2004 19:31:10 -0000 1.139 ++++ rsync.c 15 May 2004 20:13:12 -0000 @@ -25,6 +25,7 @@ extern int verbose; extern int dry_run; @@ -220,8 +220,8 @@ command before "make": - if (set_modtime(fname,file->modtime) != 0 && + if (updated && set_times(fname, mtime, atime) != 0 && !S_ISDIR(st->st_mode)) { - rprintf(FERROR, "failed to set times on %s: %s\n", - full_fname(fname), strerror(errno)); + rsyserr(FERROR, errno, "failed to set times on %s", + full_fname(fname)); return 0; } - updated = 1; @@ -229,7 +229,7 @@ command before "make": change_uid = am_root && preserve_uid && st->st_uid != file->uid; --- rsync.h 13 May 2004 18:51:22 -0000 1.203 -+++ rsync.h 13 May 2004 18:54:04 -0000 ++++ rsync.h 15 May 2004 20:13:12 -0000 @@ -54,6 +54,7 @@ #define XMIT_HAS_IDEV_DATA (1<<9) #define XMIT_SAME_DEV (1<<10) @@ -255,7 +255,7 @@ command before "make": gid_t gid; mode_t mode; --- rsync.yo 7 May 2004 00:18:37 -0000 1.169 -+++ rsync.yo 13 May 2004 18:54:05 -0000 ++++ rsync.yo 15 May 2004 20:13:12 -0000 @@ -299,6 +299,7 @@ verb( -g, --group preserve group -D, --devices preserve devices (root only) @@ -276,8 +276,8 @@ command before "make": dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers, instead it will just report the actions it would have taken. ---- tls.c 9 Apr 2004 20:22:44 -0000 1.19 -+++ tls.c 13 May 2004 18:54:05 -0000 +--- tls.c 15 May 2004 19:09:42 -0000 1.20 ++++ tls.c 15 May 2004 20:13:13 -0000 @@ -39,6 +39,7 @@ @@ -292,10 +292,10 @@ command before "make": +static int display_atime = 0; - static void failed (char const *what, - char const *where) -@@ -57,14 +59,29 @@ static void failed (char const *what, - exit (1); + static void failed(char const *what, char const *where) + { +@@ -56,14 +58,29 @@ static void failed(char const *what, cha + exit(1); } +static void storetime(char *dest, time_t t) @@ -315,7 +315,7 @@ command before "make": + } +} - static void list_file (const char *fname) + static void list_file(const char *fname) { STRUCT_STAT buf; char permbuf[PERMSTRING_SIZE]; @@ -326,7 +326,7 @@ command before "make": char linkbuf[4096]; if (do_lstat(fname, &buf) == -1) -@@ -97,19 +114,8 @@ static void list_file (const char *fname +@@ -96,19 +113,8 @@ static void list_file(const char *fname) permstring(permbuf, buf.st_mode); @@ -348,7 +348,7 @@ command before "make": /* TODO: Perhaps escape special characters in fname? */ -@@ -120,24 +126,55 @@ static void list_file (const char *fname +@@ -119,24 +125,55 @@ static void list_file(const char *fname) (long)minor(buf.st_rdev)); } else /* NB: use double for size since it might not fit in a long. */ printf("%12.0f", (double)buf.st_size); @@ -378,8 +378,8 @@ command before "make": main(int argc, char *argv[]) { - if (argc < 2) { -- fprintf (stderr, "usage: " PROGRAM " DIR ...\n" -- "Trivial file listing program for portably checking rsync\n"); +- fprintf(stderr, "usage: " PROGRAM " DIR ...\n" +- "Trivial file listing program for portably checking rsync\n"); - return 1; + poptContext pc; + const char **extra_args; @@ -401,7 +401,7 @@ command before "make": } - for (argv++; *argv; argv++) { -- list_file (*argv); +- list_file(*argv); - } + extra_args = poptGetArgs(pc); + if (*extra_args == NULL) @@ -413,8 +413,8 @@ command before "make": return 0; } ---- util.c 8 May 2004 20:03:39 -0000 1.142 -+++ util.c 13 May 2004 18:54:05 -0000 +--- util.c 15 May 2004 19:31:10 -0000 1.143 ++++ util.c 15 May 2004 20:13:13 -0000 @@ -124,32 +124,40 @@ void overflow(char *str) @@ -462,7 +462,7 @@ command before "make": t[0].tv_usec = 0; t[1].tv_sec = modtime; t[1].tv_usec = 0; -@@ -1063,8 +1071,8 @@ int msleep(int t) +@@ -1058,8 +1066,8 @@ int msleep(int t) /** @@ -473,7 +473,7 @@ command before "make": * --modify-window). * * @retval 0 if the times should be treated as the same -@@ -1073,7 +1081,7 @@ int msleep(int t) +@@ -1068,7 +1076,7 @@ int msleep(int t) * * @retval -1 if the 2nd is later **/ @@ -483,7 +483,7 @@ command before "make": extern int modify_window; --- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ testsuite/copy-atimes.test 13 May 2004 18:54:05 -0000 ++++ testsuite/copy-atimes.test 15 May 2004 20:13:13 -0000 @@ -0,0 +1,22 @@ +#! /bin/sh + @@ -508,7 +508,7 @@ command before "make": +# The script would have aborted on error, so getting here means we've won. +exit 0 --- testsuite/rsync.fns 4 Feb 2004 07:32:48 -0000 1.59 -+++ testsuite/rsync.fns 13 May 2004 18:54:05 -0000 ++++ testsuite/rsync.fns 15 May 2004 20:13:13 -0000 @@ -51,7 +51,7 @@ printmsg() { diff --git a/dir-times.diff b/dir-times.diff index 7b296d5..ce9c48a 100644 --- a/dir-times.diff +++ b/dir-times.diff @@ -65,8 +65,8 @@ - if (set_modtime(fname,file->modtime) != 0 && - !S_ISDIR(st->st_mode)) { + if (set_modtime(fname,file->modtime) != 0) { - rprintf(FERROR, "failed to set times on %s: %s\n", - full_fname(fname), strerror(errno)); + rsyserr(FERROR, errno, "failed to set times on %s", + full_fname(fname)); return 0; --- rsync.yo 7 May 2004 00:18:37 -0000 1.169 +++ rsync.yo 13 May 2004 18:59:47 -0000 diff --git a/early-chmod.diff b/early-chmod.diff index 30f023f..62203ab 100644 --- a/early-chmod.diff +++ b/early-chmod.diff @@ -1,5 +1,5 @@ ---- rsync.c 13 May 2004 18:51:22 -0000 1.138 -+++ rsync.c 13 May 2004 19:01:10 -0000 +--- rsync.c 15 May 2004 19:31:10 -0000 1.139 ++++ rsync.c 15 May 2004 20:17:41 -0000 @@ -236,6 +236,9 @@ void finish_transfer(char *fname, char * if (make_backups && !make_backup(fname)) return; @@ -12,7 +12,7 @@ if (ret < 0) { @@ -243,7 +246,8 @@ void finish_transfer(char *fname, char * ret == -2 ? "copy" : "rename", - full_fname(fnametmp), fname, strerror(errno)); + full_fname(fnametmp), fname); do_unlink(fnametmp); - } else { + } else if (ret == 1) { @@ -20,8 +20,8 @@ set_perms(fname, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME); } ---- t_stub.c 22 Apr 2004 09:58:11 -0000 1.7 -+++ t_stub.c 13 May 2004 19:01:10 -0000 +--- t_stub.c 15 May 2004 19:31:05 -0000 1.8 ++++ t_stub.c 15 May 2004 20:17:41 -0000 @@ -26,6 +26,7 @@ * functions, so that module test harnesses can run standalone. **/ @@ -30,8 +30,8 @@ int modify_window = 0; int module_id = -1; struct exclude_list_struct server_exclude_list; ---- util.c 8 May 2004 20:03:39 -0000 1.142 -+++ util.c 13 May 2004 19:01:10 -0000 +--- util.c 15 May 2004 19:31:10 -0000 1.143 ++++ util.c 15 May 2004 20:17:41 -0000 @@ -28,6 +28,7 @@ #include "rsync.h" @@ -40,7 +40,7 @@ extern struct exclude_list_struct server_exclude_list; int sanitize_paths = 0; -@@ -263,6 +264,8 @@ int copy_file(char *source, char *dest, +@@ -261,6 +262,8 @@ int copy_file(char *source, char *dest, return -1; } @@ -48,8 +48,8 @@ + mode |= S_IWUSR; ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode); if (ofd == -1) { - rprintf(FERROR,"open %s: %s\n", -@@ -364,8 +367,8 @@ int robust_unlink(char *fname) + rsyserr(FERROR, errno, "open %s", full_fname(dest)); +@@ -359,8 +362,8 @@ int robust_unlink(char *fname) #endif } @@ -60,7 +60,7 @@ int robust_rename(char *from, char *to, int mode) { int tries = 4; -@@ -382,10 +385,12 @@ int robust_rename(char *from, char *to, +@@ -377,10 +380,12 @@ int robust_rename(char *from, char *to, break; #endif case EXDEV: diff --git a/fsync.diff b/fsync.diff index 61142ea..d0ec598 100644 --- a/fsync.diff +++ b/fsync.diff @@ -2,7 +2,7 @@ This patch from Sami Farin lets you specify --fsync if you want fsync() to be called on every file we write. --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 19:01:45 -0000 ++++ options.c 15 May 2004 20:20:27 -0000 @@ -37,6 +37,7 @@ int make_backups = 0; **/ int whole_file = -1; @@ -37,8 +37,8 @@ to be called on every file we write. if (compare_dest && am_sender) { /* the server only needs this option if it is not the sender, ---- receiver.c 13 May 2004 07:08:22 -0000 1.77 -+++ receiver.c 13 May 2004 19:01:46 -0000 +--- receiver.c 15 May 2004 19:31:10 -0000 1.78 ++++ receiver.c 15 May 2004 20:20:27 -0000 @@ -46,6 +46,7 @@ extern int module_id; extern int ignore_errors; extern int orig_umask; @@ -47,21 +47,21 @@ to be called on every file we write. static void delete_one(char *fn, int is_dir) { -@@ -265,6 +266,12 @@ static int receive_data(int f_in,struct +@@ -266,6 +267,12 @@ static int receive_data(int f_in,struct if (fd != -1 && offset > 0 && sparse_end(fd) != 0) { - rprintf(FERROR, "write failed on %s: %s\n", -+ full_fname(fname), strerror(errno)); + rsyserr(FERROR, errno, "write failed on %s", ++ full_fname(fname)); + exit_cleanup(RERR_FILEIO); + } + + if (do_fsync && (fd != -1) && (fsync(fd) != 0)) { -+ rprintf(FERROR, "fsync failed on %s: %s\n", - full_fname(fname), strerror(errno)); ++ rsyserr(FERROR, errno, "fsync failed on %s", + full_fname(fname)); exit_cleanup(RERR_FILEIO); } ---- util.c 8 May 2004 20:03:39 -0000 1.142 -+++ util.c 13 May 2004 19:01:46 -0000 +--- util.c 15 May 2004 19:31:10 -0000 1.143 ++++ util.c 15 May 2004 20:20:28 -0000 @@ -29,6 +29,7 @@ extern int verbose; @@ -70,16 +70,16 @@ to be called on every file we write. int sanitize_paths = 0; -@@ -296,6 +297,12 @@ int copy_file(char *source, char *dest, +@@ -291,6 +292,12 @@ int copy_file(char *source, char *dest, if (close(ofd) < 0) { - rprintf(FERROR, "close failed on %s: %s\n", -+ full_fname(dest), strerror(errno)); + rsyserr(FERROR, errno, "close failed on %s", ++ full_fname(dest)); + return -1; + } + + if (do_fsync && fsync(ofd) < 0) { -+ rprintf(FERROR, "fsync failed on %s: %s\n", - full_fname(dest), strerror(errno)); ++ rsyserr(FERROR, errno, "fsync failed on %s", + full_fname(dest)); return -1; } diff --git a/fuzzy.diff b/fuzzy.diff index 75fe2c9..951c62d 100644 --- a/fuzzy.diff +++ b/fuzzy.diff @@ -12,8 +12,8 @@ test suite, but otherwise UNTESTED.] -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. ---- Makefile.in 2 May 2004 17:04:14 -0000 1.100 -+++ Makefile.in 13 May 2004 19:15:31 -0000 +--- Makefile.in 15 May 2004 00:48:11 -0000 1.101 ++++ Makefile.in 15 May 2004 20:47:12 -0000 @@ -32,7 +32,7 @@ ZLIBOBJ=zlib/deflate.o zlib/infblock.o z zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \ zlib/zutil.o zlib/adler32.o @@ -23,8 +23,8 @@ test suite, but otherwise UNTESTED.] OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \ fileio.o batch.o clientname.o OBJS3=progress.o pipe.o ---- generator.c 13 May 2004 06:55:01 -0000 1.82 -+++ generator.c 13 May 2004 19:15:31 -0000 +--- generator.c 15 May 2004 19:31:10 -0000 1.83 ++++ generator.c 15 May 2004 20:47:12 -0000 @@ -51,6 +51,7 @@ extern int list_only; extern int only_existing; extern int orig_umask; @@ -33,7 +33,7 @@ test suite, but otherwise UNTESTED.] /* choose whether to skip a particular file */ -@@ -256,7 +257,62 @@ static void generate_and_send_sums(struc +@@ -256,7 +257,61 @@ static void generate_and_send_sums(struc } } @@ -42,7 +42,7 @@ test suite, but otherwise UNTESTED.] + STRUCT_STAT *st) +{ + int fd = -1; - ++ + if (statret == 0) { + if (S_ISREG(st->st_mode)) { + if (update_only @@ -57,8 +57,8 @@ test suite, but otherwise UNTESTED.] + } + fd = do_open(fname, O_RDONLY, 0); + if (fd == -1) { -+ rprintf(FERROR, "failed to open %s, continuing : %s\n", -+ full_fname(fname), strerror(errno)); ++ rsyserr(FERROR, errno, "failed to open %s, continuing", ++ full_fname(fname)); + return -1; + } + return fd; @@ -79,15 +79,14 @@ test suite, but otherwise UNTESTED.] + + if (fd == -1 && compare_dest != NULL) + fd = open_alternate_base_comparedir(fname); -+ + + if (fd == -1 && fuzzy) + fd = open_alternate_base_fuzzy(fname); + + /* Update stat to understand size */ + if (fd != -1) { + if (do_fstat(fd, st) != 0) { -+ rprintf(FERROR, "fstat %s : %s\n", -+ full_fname(fname), strerror(errno)); ++ rsyserr(FERROR, errno, "fstat %s", full_fname(fname)); + } + } + @@ -96,7 +95,7 @@ test suite, but otherwise UNTESTED.] /** * Acts on file number @p i from @p flist, whose name is @p fname. -@@ -272,8 +328,6 @@ void recv_generator(char *fname, struct +@@ -272,8 +327,6 @@ void recv_generator(char *fname, struct STRUCT_STAT st; struct map_struct *mapbuf; int statret; @@ -105,7 +104,7 @@ test suite, but otherwise UNTESTED.] if (list_only) return; -@@ -398,108 +452,38 @@ void recv_generator(char *fname, struct +@@ -400,107 +453,39 @@ void recv_generator(char *fname, struct } #endif @@ -132,9 +131,8 @@ test suite, but otherwise UNTESTED.] - else if (link_dest && !dry_run) { - if (do_link(fnamecmpbuf, fname) != 0) { - if (verbose > 0) { -- rprintf(FINFO,"link %s => %s : %s\n", -- fnamecmpbuf, fname, -- strerror(errno)); +- rsyserr(FINFO, errno, "link %s => %s", +- fnamecmpbuf, fname); - } - } - fnamecmp = fnamecmpbuf; @@ -153,12 +151,12 @@ test suite, but otherwise UNTESTED.] - } else if (verbose > 1) { + /* Failed to stat for some reason besides "not found". */ + if (statret == -1 && errno != ENOENT) { -+ if (verbose > 1) - rprintf(FERROR, -- "recv_generator: failed to open %s: %s\n", -+ "recv_generator failed to stat %s: %s\n", - full_fname(fname), strerror(errno)); -- } ++ if (verbose > 1) { + rsyserr(FERROR, errno, +- "recv_generator: failed to open %s", ++ "recv_generator failed to stat %s", + full_fname(fname)); + } return; } @@ -172,14 +170,14 @@ test suite, but otherwise UNTESTED.] - return; - write_int(f_out,i); - if (!dry_run) write_sum_head(f_out, NULL); -+ if ((fd = open_base_file(file, fname, statret, &st)) == -2) - return; +- return; - } - - if (opt_ignore_existing && fnamecmp == fname) { - if (verbose > 1) - rprintf(FINFO,"%s exists\n",fname); -- return; ++ if ((fd = open_base_file(file, fname, statret, &st)) == -2) + return; - } - if (update_only && cmp_modtime(st.st_mtime,file->modtime)>0 && fnamecmp == fname) { @@ -212,8 +210,8 @@ test suite, but otherwise UNTESTED.] - fd = do_open(fnamecmp, O_RDONLY, 0); - if (fd == -1) { -- rprintf(FERROR, "failed to open %s, continuing: %s\n", -- full_fname(fnamecmp), strerror(errno)); +- rsyserr(FERROR, errno, "failed to open %s, continuing", +- full_fname(fnamecmp)); - /* pretend the file didn't exist */ + /* the file didn't exist, or we can pretend it doesn't */ if (preserve_hard_links && hard_link_check(file, HL_SKIP)) @@ -234,7 +232,7 @@ test suite, but otherwise UNTESTED.] return; } -@@ -509,7 +493,7 @@ void recv_generator(char *fname, struct +@@ -510,7 +495,7 @@ void recv_generator(char *fname, struct mapbuf = NULL; if (verbose > 3) { @@ -244,7 +242,7 @@ test suite, but otherwise UNTESTED.] } --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 19:15:32 -0000 ++++ options.c 15 May 2004 20:47:13 -0000 @@ -91,6 +91,7 @@ int ignore_errors = 0; int modify_window = 0; int blocking_io = -1; @@ -279,8 +277,8 @@ test suite, but otherwise UNTESTED.] *argc = ac; return; ---- receiver.c 13 May 2004 07:08:22 -0000 1.77 -+++ receiver.c 13 May 2004 19:15:32 -0000 +--- receiver.c 15 May 2004 19:31:10 -0000 1.78 ++++ receiver.c 15 May 2004 20:47:13 -0000 @@ -46,6 +46,7 @@ extern int module_id; extern int ignore_errors; extern int orig_umask; @@ -289,7 +287,7 @@ test suite, but otherwise UNTESTED.] static void delete_one(char *fn, int is_dir) { -@@ -293,8 +294,6 @@ int recv_files(int f_in,struct file_list +@@ -294,8 +295,6 @@ int recv_files(int f_in,struct file_list char *fname, fbuf[MAXPATHLEN]; char template[MAXPATHLEN]; char fnametmp[MAXPATHLEN]; @@ -298,7 +296,7 @@ test suite, but otherwise UNTESTED.] struct map_struct *mapbuf; int i; struct file_struct *file; -@@ -357,35 +356,31 @@ int recv_files(int f_in,struct file_list +@@ -358,35 +357,31 @@ int recv_files(int f_in,struct file_list if (verbose > 2) rprintf(FINFO,"recv_files(%s)\n",fname); @@ -322,9 +320,9 @@ test suite, but otherwise UNTESTED.] + fd1 = open_alternate_base_fuzzy(fname); if (fd1 != -1 && do_fstat(fd1,&st) != 0) { - rprintf(FERROR, "fstat %s failed: %s\n", -- full_fname(fnamecmp), strerror(errno)); -+ full_fname(fname), strerror(errno)); + rsyserr(FERROR, errno, "fstat %s failed", +- full_fname(fnamecmp)); ++ full_fname(fname)); receive_data(f_in,NULL,-1,NULL,file->length); close(fd1); continue; @@ -343,7 +341,7 @@ test suite, but otherwise UNTESTED.] receive_data(f_in, NULL, -1, NULL, file->length); close(fd1); continue; -@@ -406,8 +401,10 @@ int recv_files(int f_in,struct file_list +@@ -407,8 +402,10 @@ int recv_files(int f_in,struct file_list if (fd1 != -1 && st.st_size > 0) { mapbuf = map_file(fd1,st.st_size); diff --git a/inplace.diff b/inplace.diff index ba8e3ed..a8cdb6c 100644 --- a/inplace.diff +++ b/inplace.diff @@ -1,7 +1,7 @@ Patch from Mark Curtis to implement the --inplace option. --- match.c 13 May 2004 06:46:20 -0000 1.61 -+++ match.c 13 May 2004 19:02:25 -0000 ++++ match.c 15 May 2004 20:23:18 -0000 @@ -22,6 +22,7 @@ extern int verbose; extern int am_server; @@ -22,7 +22,7 @@ Patch from Mark Curtis to implement the --inplace option. if (verbose > 3) --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 19:02:25 -0000 ++++ options.c 15 May 2004 20:23:19 -0000 @@ -91,6 +91,7 @@ int ignore_errors = 0; int modify_window = 0; int blocking_io = -1; @@ -67,8 +67,8 @@ Patch from Mark Curtis to implement the --inplace option. if (tmpdir) { args[ac++] = "--temp-dir"; ---- receiver.c 13 May 2004 07:08:22 -0000 1.77 -+++ receiver.c 13 May 2004 19:02:25 -0000 +--- receiver.c 15 May 2004 19:31:10 -0000 1.78 ++++ receiver.c 15 May 2004 20:23:19 -0000 @@ -46,6 +46,7 @@ extern int module_id; extern int ignore_errors; extern int orig_umask; @@ -77,18 +77,18 @@ Patch from Mark Curtis to implement the --inplace option. static void delete_one(char *fn, int is_dir) { -@@ -250,16 +251,28 @@ static int receive_data(int f_in,struct +@@ -251,16 +252,28 @@ static int receive_data(int f_in,struct sum_update(map,len); } - if (fd != -1 && write_file(fd,map,len) != (int) len) { -- rprintf(FERROR, "write failed on %s: %s\n", -- full_fname(fname), strerror(errno)); +- rsyserr(FERROR, errno, "write failed on %s", +- full_fname(fname)); - exit_cleanup(RERR_FILEIO); + if (!inplace || offset != offset2) { + if (fd != -1 && write_file(fd,map,len) != (int) len) { -+ rprintf(FERROR, "write failed on %s: %s\n", -+ full_fname(fname), strerror(errno)); ++ rsyserr(FERROR, errno, "write failed on %s", ++ full_fname(fname)); + exit_cleanup(RERR_FILEIO); + } + } else { @@ -110,7 +110,7 @@ Patch from Mark Curtis to implement the --inplace option. if (do_progress) end_progress(total_size); -@@ -411,37 +424,50 @@ int recv_files(int f_in,struct file_list +@@ -412,37 +425,50 @@ int recv_files(int f_in,struct file_list } else mapbuf = NULL; @@ -123,8 +123,8 @@ Patch from Mark Curtis to implement the --inplace option. + if (inplace) { + fd2 = do_open(fnamecmp, O_WRONLY|O_CREAT, 0); + if (fd2 == -1) { -+ rprintf(FERROR, "open %s failed: %s\n", -+ full_fname(fnametmp), strerror(errno)); ++ rsyserr(FERROR, errno, "open %s failed", ++ full_fname(fnametmp)); + receive_data(f_in,mapbuf,-1,NULL,file->length); + if (mapbuf) unmap_file(mapbuf); + if (fd1 != -1) close(fd1); @@ -163,8 +163,8 @@ Patch from Mark Curtis to implement the --inplace option. fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); - } - if (fd2 == -1) { -- rprintf(FERROR, "mkstemp %s failed: %s\n", -- full_fname(fnametmp), strerror(errno)); +- rsyserr(FERROR, errno, "mkstemp %s failed", +- full_fname(fnametmp)); - receive_data(f_in,mapbuf,-1,NULL,file->length); - if (mapbuf) unmap_file(mapbuf); - if (fd1 != -1) close(fd1); @@ -179,8 +179,8 @@ Patch from Mark Curtis to implement the --inplace option. + fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); + } + if (fd2 == -1) { -+ rprintf(FERROR, "mkstemp %s failed: %s\n", -+ full_fname(fnametmp), strerror(errno)); ++ rsyserr(FERROR, errno, "mkstemp %s failed", ++ full_fname(fnametmp)); + receive_data(f_in,mapbuf,-1,NULL,file->length); + if (mapbuf) unmap_file(mapbuf); + if (fd1 != -1) close(fd1); @@ -189,8 +189,8 @@ Patch from Mark Curtis to implement the --inplace option. } cleanup_set(fnametmp, fname, file, mapbuf, fd1, fd2); ---- rsync.c 13 May 2004 18:51:22 -0000 1.138 -+++ rsync.c 13 May 2004 19:02:25 -0000 +--- rsync.c 15 May 2004 19:31:10 -0000 1.139 ++++ rsync.c 15 May 2004 20:23:19 -0000 @@ -31,6 +31,7 @@ extern int am_generator; extern int preserve_uid; extern int preserve_gid; @@ -212,7 +212,7 @@ Patch from Mark Curtis to implement the --inplace option. /* move tmp file over real file */ ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS); --- rsync.yo 7 May 2004 00:18:37 -0000 1.169 -+++ rsync.yo 13 May 2004 19:02:26 -0000 ++++ rsync.yo 15 May 2004 20:23:20 -0000 @@ -289,6 +289,7 @@ verb( --backup-dir make backups into this directory --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir) diff --git a/link-by-hash.diff b/link-by-hash.diff index 56327cd..daffd6f 100644 --- a/link-by-hash.diff +++ b/link-by-hash.diff @@ -11,8 +11,8 @@ will only store one copy of the unique contents of each file, regardless of the file's name. ---- Makefile.in 2 May 2004 17:04:14 -0000 1.100 -+++ Makefile.in 13 May 2004 19:04:49 -0000 +--- Makefile.in 15 May 2004 00:48:11 -0000 1.101 ++++ Makefile.in 15 May 2004 20:29:17 -0000 @@ -35,7 +35,7 @@ OBJS1=rsync.o generator.o receiver.o cle main.o checksum.o match.o syscall.o log.o backup.o OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \ @@ -23,8 +23,8 @@ the file's name. popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \ popt/popthelp.o popt/poptparse.o --- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ hashlink.c 13 May 2004 19:04:49 -0000 -@@ -0,0 +1,351 @@ ++++ hashlink.c 15 May 2004 20:29:17 -0000 +@@ -0,0 +1,342 @@ +/* + Copyright (C) Cronosys, LLC 2004 + @@ -115,8 +115,7 @@ the file's name. + /* Build a list of potential candidates and open + * them. */ + if ((d = opendir(hashname)) == NULL) { -+ rprintf(FERROR,"opendir \"%s\": %s\n", -+ hashname, strerror(errno)); ++ rsyserr(FERROR, errno, "opendir \"%s\"", hashname); + free(hashname); + return NULL; + } @@ -135,8 +134,7 @@ the file's name. + asprintf(&hashfile->name,"%s/%s",hashname, + di->d_name); + if (do_stat(hashfile->name,&st) == -1) { -+ rprintf(FERROR,"%s: %s", hashfile->name, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "%s: %s", hashfile->name); + kill_hashfile(hashfile); + continue; + } @@ -147,8 +145,7 @@ the file's name. + hashfile->nlink = st.st_nlink; + hashfile->fd = open(hashfile->name,O_RDONLY|O_BINARY); + if (hashfile->fd == -1) { -+ rprintf(FERROR,"%s: %s\n", hashfile->name, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "%s", hashfile->name); + kill_hashfile(hashfile); + continue; + } @@ -217,7 +214,7 @@ the file's name. + } + + if (amt == -1) { -+ rprintf(FERROR,"%s",strerror(errno)); ++ rsyserr(FERROR, errno, "%s"); + kill_hashfiles(files); + return NULL; + } @@ -269,8 +266,7 @@ the file's name. + dirname = strdup(hashname); + *strrchr(dirname,'/') = 0; + if (do_mkdir(dirname, 0755) == -1 && errno != EEXIST) { -+ rprintf(FERROR, "mkdir %s: %s\n", dirname, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "mkdir %s", dirname); + free(hashname); + free(dirname); + return robust_rename(fnametmp,fname,0644); @@ -278,8 +274,7 @@ the file's name. + free(dirname); + + if (do_mkdir(hashname, 0755) == -1 && errno != EEXIST) { -+ rprintf(FERROR, "mkdir %s: %s\n", hashname, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "mkdir %s", hashname); + free(hashname); + return robust_rename(fnametmp,fname,0644); + } @@ -293,7 +288,7 @@ the file's name. + int fd; + + if (do_stat(fnametmp,&st) == -1) { -+ rprintf(FERROR,"%s: %s\n",fname,strerror(errno)); ++ rsyserr(FERROR, errno, "%s", fname); + return -1; + } + hashfiles = find_hashfiles(hashname, st.st_size, &last_fnbr); @@ -306,8 +301,7 @@ the file's name. + + /* Search for one identical to us. */ + if ((fd = open(fnametmp,O_RDONLY|O_BINARY)) == -1) { -+ rprintf(FERROR,"%s: %s\n",fnametmp, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "%s", fnametmp); + kill_hashfiles(hashfiles); + return -1; + } @@ -341,9 +335,8 @@ the file's name. + rprintf(FINFO, "(5) linkname = %s\n", linkname); + rprintf(FINFO,"link-by-hash: max link count exceeded, starting new file \"%s\".\n", linkname); + } else { -+ rprintf(FERROR,"link \"%s\" -> %s: %s\n", -+ linkname,full_fname(fname), -+ strerror(errno)); ++ rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"", ++ linkname, full_fname(fname)); + robust_unlink(fname); + rc = robust_rename(fnametmp,fname,0644); + } @@ -358,15 +351,13 @@ the file's name. + + rc = robust_rename(fnametmp,fname,0644); + if (rc != 0) { -+ rprintf(FERROR,"rename \"%s\" -> \"%s\": %s\n", -+ full_fname(fnametmp),full_fname(fname), -+ strerror(errno)); ++ rsyserr(FERROR, errno, "rename \"%s\" -> \"%s\"", ++ full_fname(fnametmp), full_fname(fname)); + } + rc = do_link(fname,linkname); + if (rc != 0) { -+ rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n", -+ full_fname(fname),linkname, -+ strerror(errno)); ++ rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"", ++ full_fname(fname), linkname); + } + } + @@ -377,7 +368,7 @@ the file's name. + +#endif --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 19:04:49 -0000 ++++ options.c 15 May 2004 20:29:17 -0000 @@ -121,6 +121,7 @@ char *log_format = NULL; char *password_file = NULL; char *rsync_path = RSYNC_PATH; @@ -443,8 +434,8 @@ the file's name. } if (files_from && (!am_sender || remote_filesfrom_file)) { ---- receiver.c 13 May 2004 07:08:22 -0000 1.77 -+++ receiver.c 13 May 2004 19:04:49 -0000 +--- receiver.c 15 May 2004 19:31:10 -0000 1.78 ++++ receiver.c 15 May 2004 20:29:17 -0000 @@ -46,6 +46,7 @@ extern int module_id; extern int ignore_errors; extern int orig_umask; @@ -453,7 +444,7 @@ the file's name. static void delete_one(char *fn, int is_dir) { -@@ -191,10 +192,11 @@ static int get_tmpname(char *fnametmp, c +@@ -192,10 +193,11 @@ static int get_tmpname(char *fnametmp, c static int receive_data(int f_in,struct map_struct *mapbuf,int fd,char *fname, @@ -466,7 +457,7 @@ the file's name. unsigned int len; OFF_T offset = 0; OFF_T offset2; -@@ -204,7 +206,9 @@ static int receive_data(int f_in,struct +@@ -205,7 +207,9 @@ static int receive_data(int f_in,struct char *map=NULL; read_sum_head(f_in, &sum); @@ -477,7 +468,7 @@ the file's name. sum_init(); while ((i = recv_token(f_in, &data)) != 0) { -@@ -221,6 +225,8 @@ static int receive_data(int f_in,struct +@@ -222,6 +226,8 @@ static int receive_data(int f_in,struct cleanup_got_literal = 1; sum_update(data,i); @@ -485,8 +476,8 @@ the file's name. + mdfour_update(&mdfour_data,data,i); if (fd != -1 && write_file(fd,data,i) != i) { - rprintf(FERROR, "write failed on %s: %s\n", -@@ -248,6 +254,8 @@ static int receive_data(int f_in,struct + rsyserr(FERROR, errno, "write failed on %s", +@@ -249,6 +255,8 @@ static int receive_data(int f_in,struct see_token(map, len); sum_update(map,len); @@ -495,7 +486,7 @@ the file's name. } if (fd != -1 && write_file(fd,map,len) != (int) len) { -@@ -270,6 +278,8 @@ static int receive_data(int f_in,struct +@@ -271,6 +279,8 @@ static int receive_data(int f_in,struct } sum_end(file_sum1); @@ -504,16 +495,16 @@ the file's name. read_buf(f_in,file_sum2,MD4_SUM_LENGTH); if (verbose > 2) { -@@ -373,7 +383,7 @@ int recv_files(int f_in,struct file_list +@@ -374,7 +384,7 @@ int recv_files(int f_in,struct file_list if (fd1 != -1 && do_fstat(fd1,&st) != 0) { - rprintf(FERROR, "fstat %s failed: %s\n", - full_fname(fnamecmp), strerror(errno)); + rsyserr(FERROR, errno, "fstat %s failed", + full_fname(fnamecmp)); - receive_data(f_in,NULL,-1,NULL,file->length); + receive_data(f_in,NULL,-1,NULL,file->length,NULL); close(fd1); continue; } -@@ -386,7 +396,7 @@ int recv_files(int f_in,struct file_list +@@ -387,7 +397,7 @@ int recv_files(int f_in,struct file_list */ rprintf(FERROR,"recv_files: %s is a directory\n", full_fname(fnamecmp)); @@ -522,16 +513,16 @@ the file's name. close(fd1); continue; } -@@ -438,7 +448,7 @@ int recv_files(int f_in,struct file_list +@@ -439,7 +449,7 @@ int recv_files(int f_in,struct file_list if (fd2 == -1) { - rprintf(FERROR, "mkstemp %s failed: %s\n", - full_fname(fnametmp), strerror(errno)); + rsyserr(FERROR, errno, "mkstemp %s failed", + full_fname(fnametmp)); - receive_data(f_in,mapbuf,-1,NULL,file->length); + receive_data(f_in,mapbuf,-1,NULL,file->length,NULL); if (mapbuf) unmap_file(mapbuf); if (fd1 != -1) close(fd1); continue; -@@ -451,7 +461,12 @@ int recv_files(int f_in,struct file_list +@@ -452,7 +462,12 @@ int recv_files(int f_in,struct file_list } /* recv file data */ @@ -545,8 +536,8 @@ the file's name. log_recv(file, &initial_stats); ---- rsync.c 13 May 2004 18:51:22 -0000 1.138 -+++ rsync.c 13 May 2004 19:04:49 -0000 +--- rsync.c 15 May 2004 19:31:10 -0000 1.139 ++++ rsync.c 15 May 2004 20:29:17 -0000 @@ -31,6 +31,7 @@ extern int am_generator; extern int preserve_uid; extern int preserve_gid; @@ -568,10 +559,10 @@ the file's name. +#endif + ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS); if (ret < 0) { - rprintf(FERROR, "%s %s -> \"%s\": %s\n", + rsyserr(FERROR, errno, "%s %s -> \"%s\"", ret == -2 ? "copy" : "rename", --- rsync.h 13 May 2004 18:51:22 -0000 1.203 -+++ rsync.h 13 May 2004 19:04:50 -0000 ++++ rsync.h 15 May 2004 20:29:18 -0000 @@ -521,6 +521,14 @@ struct stats { int current_file_index; }; diff --git a/remove-sent-files.diff b/remove-sent-files.diff index 9eaf7a0..03cd8ae 100644 --- a/remove-sent-files.diff +++ b/remove-sent-files.diff @@ -4,8 +4,8 @@ command before "make": make proto ---- io.c 8 May 2004 18:03:43 -0000 1.120 -+++ io.c 13 May 2004 18:57:54 -0000 +--- io.c 15 May 2004 19:31:10 -0000 1.121 ++++ io.c 15 May 2004 20:15:14 -0000 @@ -222,6 +222,14 @@ static void read_msg_fd(void) read_loop(fd, buf, 4); redo_list_add(IVAL(buf,0)); @@ -21,7 +21,7 @@ command before "make": case MSG_INFO: case MSG_ERROR: case MSG_LOG: -@@ -637,6 +645,16 @@ static int read_unbuffered(int fd, char +@@ -635,6 +643,16 @@ static int read_unbuffered(int fd, char } read_loop(fd, buffer, remaining); bufferIdx = 0; @@ -38,8 +38,8 @@ command before "make": break; case MSG_INFO: case MSG_ERROR: ---- main.c 10 Feb 2004 03:54:47 -0000 1.192 -+++ main.c 13 May 2004 18:57:54 -0000 +--- main.c 15 May 2004 19:31:10 -0000 1.194 ++++ main.c 15 May 2004 20:15:15 -0000 @@ -42,6 +42,7 @@ extern int list_only; extern int local_server; extern int log_got_error; @@ -48,7 +48,7 @@ command before "make": extern int orig_umask; extern int preserve_hard_links; extern int protocol_version; -@@ -567,6 +568,8 @@ void start_server(int f_in, int f_out, i +@@ -566,6 +567,8 @@ void start_server(int f_in, int f_out, i io_start_multiplex_out(f_out); if (am_sender) { @@ -57,7 +57,7 @@ command before "make": if (!read_batch) { recv_exclude_list(f_in); if (cvs_exclude) -@@ -632,6 +635,9 @@ int client_run(int f_in, int f_out, pid_ +@@ -631,6 +634,9 @@ int client_run(int f_in, int f_out, pid_ io_flush(FULL_FLUSH); exit_cleanup(status); } @@ -65,10 +65,10 @@ command before "make": + if (need_messages_from_generator) + io_start_multiplex_out(f_out); - if (argc == 0) { + if (argc == 0) list_only = 1; --- options.c 6 May 2004 21:08:01 -0000 1.148 -+++ options.c 13 May 2004 18:57:55 -0000 ++++ options.c 15 May 2004 20:15:15 -0000 @@ -84,6 +84,7 @@ int copy_unsafe_links = 0; int size_only = 0; int bwlimit = 0; @@ -134,8 +134,8 @@ command before "make": *argc = ac; return; ---- receiver.c 13 May 2004 07:08:22 -0000 1.77 -+++ receiver.c 13 May 2004 18:57:55 -0000 +--- receiver.c 15 May 2004 19:31:10 -0000 1.78 ++++ receiver.c 15 May 2004 20:15:15 -0000 @@ -46,6 +46,7 @@ extern int module_id; extern int ignore_errors; extern int orig_umask; @@ -144,7 +144,7 @@ command before "make": static void delete_one(char *fn, int is_dir) { -@@ -293,7 +294,7 @@ int recv_files(int f_in,struct file_list +@@ -294,7 +295,7 @@ int recv_files(int f_in,struct file_list char *fname, fbuf[MAXPATHLEN]; char template[MAXPATHLEN]; char fnametmp[MAXPATHLEN]; @@ -153,7 +153,7 @@ command before "make": char fnamecmpbuf[MAXPATHLEN]; struct map_struct *mapbuf; int i; -@@ -475,16 +476,20 @@ int recv_files(int f_in,struct file_list +@@ -476,16 +477,20 @@ int recv_files(int f_in,struct file_list cleanup_disable(); @@ -179,7 +179,7 @@ command before "make": } } --- rsync.h 13 May 2004 18:51:22 -0000 1.203 -+++ rsync.h 13 May 2004 18:57:55 -0000 ++++ rsync.h 15 May 2004 20:15:15 -0000 @@ -60,6 +60,7 @@ #define FLAG_TOP_DIR (1<<0) #define FLAG_HLINK_EOL (1<<1) /* generator only */ @@ -197,7 +197,7 @@ command before "make": MSG_REDO=4, /* reprocess indicated flist index */ MSG_ERROR=FERROR, MSG_INFO=FINFO, MSG_LOG=FLOG, /* remote logging */ --- rsync.yo 7 May 2004 00:18:37 -0000 1.169 -+++ rsync.yo 13 May 2004 18:57:56 -0000 ++++ rsync.yo 15 May 2004 20:15:16 -0000 @@ -312,6 +312,7 @@ verb( --delete delete files that don't exist on sender --delete-excluded also delete excluded files on receiver @@ -218,8 +218,8 @@ command before "make": dit(bf(--ignore-errors)) Tells --delete to go ahead and delete files even when there are I/O errors. ---- sender.c 11 May 2004 19:53:16 -0000 1.39 -+++ sender.c 13 May 2004 18:57:56 -0000 +--- sender.c 15 May 2004 19:31:10 -0000 1.40 ++++ sender.c 15 May 2004 20:15:16 -0000 @@ -27,6 +27,7 @@ extern int dry_run; extern int am_server; extern int am_daemon; @@ -267,7 +267,7 @@ command before "make": while (1) { unsigned int offset; -@@ -299,6 +324,9 @@ void send_files(struct file_list *flist, +@@ -300,6 +325,9 @@ void send_files(struct file_list *flist, if (verbose > 2) rprintf(FINFO, "sender finished %s\n", fname); diff --git a/write-only.diff b/write-only.diff index cb617f1..70f54c7 100644 --- a/write-only.diff +++ b/write-only.diff @@ -12,7 +12,7 @@ allowed to download any files (my primary concern). --- loadparm.c 4 Feb 2004 07:31:29 -0000 1.50 -+++ loadparm.c 22 Apr 2004 23:49:29 -0000 ++++ loadparm.c 15 May 2004 20:50:11 -0000 @@ -119,6 +119,7 @@ typedef struct char *comment; char *lock_file; @@ -45,9 +45,9 @@ allowed to download any files (my primary concern). FN_LOCAL_BOOL(lp_list, list) FN_LOCAL_BOOL(lp_use_chroot, use_chroot) FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging) ---- main.c 10 Feb 2004 03:54:47 -0000 1.192 -+++ main.c 22 Apr 2004 23:49:29 -0000 -@@ -370,6 +370,12 @@ static void do_server_sender(int f_in, i +--- main.c 15 May 2004 19:31:10 -0000 1.194 ++++ main.c 15 May 2004 20:50:11 -0000 +@@ -369,6 +369,12 @@ static void do_server_sender(int f_in, i (long)getpid()); } @@ -58,5 +58,5 @@ allowed to download any files (my primary concern). + } + if (!relative_paths && !push_dir(dir)) { - rprintf(FERROR, "push_dir %s failed: %s (3)\n", - full_fname(dir), strerror(errno)); + rsyserr(FERROR, errno, "push_dir#3 %s failed", + full_fname(dir)); -- 2.34.1