--- batch.c 15 May 2004 19:31:10 -0000 1.32
-+++ batch.c 18 May 2004 09:26:41 -0000
++++ batch.c 21 May 2004 08:47:28 -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",
(double) fptr[i]->length);
rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
--- flist.c 16 May 2004 23:54:12 -0000 1.224
-+++ flist.c 18 May 2004 09:26:42 -0000
++++ flist.c 21 May 2004 08:47:28 -0000
@@ -57,6 +57,7 @@ extern int relative_paths;
extern int implied_dirs;
extern int copy_links;
file->mode = st.st_mode;
file->uid = st.st_uid;
--- generator.c 18 May 2004 08:50:17 -0000 1.85
-+++ generator.c 18 May 2004 09:26:42 -0000
++++ generator.c 21 May 2004 08:47:28 -0000
@@ -100,7 +100,7 @@ static int skip_file(char *fname, struct
return 0;
}
rprintf(FINFO,"%s is newer\n",fname);
return;
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 18 May 2004 09:26:42 -0000
++++ options.c 21 May 2004 08:47:28 -0000
@@ -46,6 +46,7 @@ int preserve_devices = 0;
int preserve_uid = 0;
int preserve_gid = 0;
if (preserve_perms)
argstr[x++] = 'p';
if (recurse)
---- rsync.c 15 May 2004 19:31:10 -0000 1.139
-+++ rsync.c 18 May 2004 09:26:42 -0000
+--- rsync.c 21 May 2004 08:43:03 -0000 1.140
++++ rsync.c 21 May 2004 08:47:29 -0000
@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
extern int am_root;
extern int am_sender;
extern int am_generator;
-@@ -140,17 +141,31 @@ int set_perms(char *fname,struct file_st
-
- if (!preserve_times || S_ISLNK(st->st_mode))
+@@ -143,17 +144,31 @@ int set_perms(char *fname,struct file_st
+ if (!preserve_times || S_ISLNK(st->st_mode)
+ || (make_backups && !backup_dir && S_ISDIR(st->st_mode)))
flags |= PERMS_SKIP_MTIME;
- if (!(flags & PERMS_SKIP_MTIME)
- && cmp_modtime(st->st_mtime, file->modtime) != 0) {
change_uid = am_root && preserve_uid && st->st_uid != file->uid;
--- rsync.h 16 May 2004 07:28:24 -0000 1.204
-+++ rsync.h 18 May 2004 09:26:43 -0000
++++ rsync.h 21 May 2004 08:47:29 -0000
@@ -54,6 +54,7 @@
#define XMIT_HAS_IDEV_DATA (1<<9)
#define XMIT_SAME_DEV (1<<10)
gid_t gid;
mode_t mode;
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 18 May 2004 09:26:43 -0000
++++ rsync.yo 21 May 2004 08:47:29 -0000
@@ -299,6 +299,7 @@ verb(
-g, --group preserve group
-D, --devices preserve devices (root only)
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-W, --whole-file copy whole files, no incremental checks
-@@ -545,6 +546,11 @@ modified cannot be effective; in other w
- cause the next transfer to behave as if it used -I, and all files will have
+@@ -546,6 +547,11 @@ cause the next transfer to behave as if
their checksums compared and show up in log messages even if they haven't
changed.
-+
+
+dit(bf(-A, --copy-atimes)) This tells rsync to transfer access times
+along with the files and update them on the remote system. Note that
+reading the source file may update the atime and hence repeated rsync
+copies with --copy-atimes may copy files unnecessarily.
-
++
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 15 May 2004 19:09:42 -0000 1.20
-+++ tls.c 18 May 2004 09:26:44 -0000
++++ tls.c 21 May 2004 08:47:30 -0000
@@ -39,6 +39,7 @@
return 0;
}
---- util.c 15 May 2004 19:31:10 -0000 1.143
-+++ util.c 18 May 2004 09:26:44 -0000
-@@ -124,32 +124,40 @@ void overflow(char *str)
+--- util.c 21 May 2004 08:40:25 -0000 1.144
++++ util.c 21 May 2004 08:47:30 -0000
+@@ -127,31 +127,39 @@ void overflow(char *str)
-int set_modtime(char *fname, time_t modtime)
+int set_times(char *fname, time_t modtime, time_t atime)
{
- extern int dry_run;
if (dry_run)
return 0;
-int cmp_modtime(time_t file1, time_t file2)
+int cmp_time(time_t file1, time_t file2)
{
- extern int modify_window;
-
+ if (file2 > file1) {
+ if (file2 - file1 <= modify_window)
--- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ testsuite/copy-atimes.test 18 May 2004 09:26:44 -0000
++++ testsuite/copy-atimes.test 21 May 2004 08:47:30 -0000
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+# The script would have aborted on error, so getting here means we've won.
+exit 0
--- testsuite/rsync.fns 18 May 2004 00:41:55 -0000 1.60
-+++ testsuite/rsync.fns 18 May 2004 09:26:44 -0000
++++ testsuite/rsync.fns 21 May 2004 08:47:30 -0000
@@ -50,7 +50,7 @@ printmsg() {
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 18 May 2004 09:48:58 -0000
++++ options.c 21 May 2004 08:54:54 -0000
@@ -46,6 +46,7 @@ int preserve_devices = 0;
int preserve_uid = 0;
int preserve_gid = 0;
if (preserve_perms)
argstr[x++] = 'p';
if (recurse)
---- rsync.c 15 May 2004 19:31:10 -0000 1.139
-+++ rsync.c 18 May 2004 09:48:58 -0000
+--- rsync.c 21 May 2004 08:43:03 -0000 1.140
++++ rsync.c 21 May 2004 08:54:54 -0000
@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
extern int am_root;
extern int am_sender;
extern int am_generator;
-@@ -138,14 +139,16 @@ int set_perms(char *fname,struct file_st
+@@ -140,15 +141,16 @@ int set_perms(char *fname,struct file_st
st = &st2;
}
-- if (!preserve_times || S_ISLNK(st->st_mode))
+- if (!preserve_times || S_ISLNK(st->st_mode)
+- || (make_backups && !backup_dir && S_ISDIR(st->st_mode)))
- flags |= PERMS_SKIP_MTIME;
+ if (S_ISDIR(st->st_mode)) {
-+ if (!preserve_dir_times)
++ if (!preserve_dir_times || (make_backups && !backup_dir))
+ flags |= PERMS_SKIP_MTIME;
+ } else {
+ if (!preserve_times || S_ISLNK(st->st_mode))
full_fname(fname));
return 0;
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 18 May 2004 09:48:58 -0000
++++ rsync.yo 21 May 2004 08:54:54 -0000
@@ -298,7 +298,8 @@ verb(
-o, --owner preserve owner (root only)
-g, --group preserve group
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-W, --whole-file copy whole files, no incremental checks
-@@ -538,13 +539,22 @@ dit(bf(-D, --devices)) This option cause
+@@ -538,14 +539,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.
cause the next transfer to behave as if it used -I, and all files will have
their checksums compared and show up in log messages even if they haven't
changed.
-+
+
+dit(bf(-d, --dir-times)) This tells rsync to preserve the modification
+times of directories transferred to the remote system. On a modern
+rsync, these are left unpreserved by default to avoid causing problems
+Note: when sending files to an older rsync, the --times option will
+imply --dir-times (if the option causes an error on the receiving
+system, omit it and use --times to preserve all file/directory times).
-
++
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.
+
--- testsuite/chgrp.test 18 May 2004 00:41:35 -0000 1.11
-+++ testsuite/chgrp.test 18 May 2004 09:48:58 -0000
++++ testsuite/chgrp.test 21 May 2004 08:54:54 -0000
@@ -26,7 +26,7 @@ do
done
sleep 2
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/chown.test 18 May 2004 00:41:35 -0000 1.5
-+++ testsuite/chown.test 18 May 2004 09:48:58 -0000
++++ testsuite/chown.test 21 May 2004 08:54:55 -0000
@@ -28,7 +28,7 @@ chown 5001 "$name2" || test_skipped "Can
chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/daemon-gzip-download.test 18 May 2004 00:41:51 -0000 1.7
-+++ testsuite/daemon-gzip-download.test 18 May 2004 09:48:58 -0000
++++ testsuite/daemon-gzip-download.test 21 May 2004 08:54:55 -0000
@@ -29,9 +29,9 @@ export RSYNC_CONNECT_PROG
hands_setup
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/daemon-gzip-upload.test 18 May 2004 00:41:51 -0000 1.7
-+++ testsuite/daemon-gzip-upload.test 18 May 2004 09:48:58 -0000
++++ testsuite/daemon-gzip-upload.test 21 May 2004 08:54:55 -0000
@@ -23,9 +23,9 @@ export RSYNC_CONNECT_PROG
hands_setup
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/devices.test 18 May 2004 00:41:35 -0000 1.8
-+++ testsuite/devices.test 18 May 2004 09:48:58 -0000
++++ testsuite/devices.test 21 May 2004 08:54:55 -0000
@@ -29,7 +29,7 @@ mknod "$fromdir/block" b 42 69 || test_s
mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root"
mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root"
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/duplicates.test 18 May 2004 00:41:35 -0000 1.10
-+++ testsuite/duplicates.test 18 May 2004 09:48:59 -0000
++++ testsuite/duplicates.test 21 May 2004 08:54:55 -0000
@@ -33,7 +33,7 @@ ln -s "$name1" "$name2" || fail "can't c
outfile="$scratchdir/rsync.out"
# Make sure each file was only copied once...
--- testsuite/exclude.test 18 May 2004 00:41:38 -0000 1.6
-+++ testsuite/exclude.test 18 May 2004 09:48:59 -0000
++++ testsuite/exclude.test 21 May 2004 08:54:55 -0000
@@ -63,7 +63,7 @@ EOF
# Create the chk dir with what we expect to be excluded
# The script would have aborted on error, so getting here means we've won.
--- testsuite/hands.test 18 May 2004 00:41:46 -0000 1.13
-+++ testsuite/hands.test 18 May 2004 09:48:59 -0000
++++ testsuite/hands.test 21 May 2004 08:54:55 -0000
@@ -11,19 +11,19 @@ hands_setup
# Main script starts here
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/hardlinks.test 18 May 2004 00:41:40 -0000 1.5
-+++ testsuite/hardlinks.test 18 May 2004 09:48:59 -0000
++++ testsuite/hardlinks.test 21 May 2004 08:54:55 -0000
@@ -31,7 +31,7 @@ ln "$name1" "$name2" || fail "Can't crea
ln "$name2" "$name3" || fail "Can't create hardlink"
cp "$name2" "$name4" || fail "Can't copy file"
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/longdir.test 18 May 2004 09:47:42 -0000 1.11
-+++ testsuite/longdir.test 18 May 2004 09:48:59 -0000
++++ testsuite/longdir.test 21 May 2004 08:54:55 -0000
@@ -18,7 +18,7 @@ makepath "$longdir" || test_skipped "una
touch "$longdir/1" || test_skipped "unable to create files in long directory"
date > "$longdir/1"
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/merge.test 18 May 2004 00:41:38 -0000 1.6
-+++ testsuite/merge.test 18 May 2004 09:48:59 -0000
++++ testsuite/merge.test 21 May 2004 08:54:55 -0000
@@ -40,9 +40,9 @@ cp -p "$from2dir"/sub1/uno "$from3dir"/s
cp -p "$from3dir"/sub2/subby "$chkdir"/sub2
# The script would have aborted on error, so getting here means we've won.
exit 0
--- testsuite/ssh-basic.test 18 May 2004 00:41:46 -0000 1.7
-+++ testsuite/ssh-basic.test 18 May 2004 09:48:59 -0000
++++ testsuite/ssh-basic.test 21 May 2004 08:54:55 -0000
@@ -28,7 +28,7 @@ fi
# nothing to do.
hands_setup
-runtest "ssh: renamed file" 'checkit "$RSYNC --delete -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
+runtest "ssh: renamed file" 'checkit "$RSYNC --delete -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
--- testsuite/unsafe-links.test 18 May 2004 00:41:43 -0000 1.7
-+++ testsuite/unsafe-links.test 18 May 2004 09:48:59 -0000
++++ testsuite/unsafe-links.test 21 May 2004 08:54:55 -0000
@@ -35,33 +35,33 @@ ln -s ../../unsafe/unsafefile "from/safe
set -x
---- 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 *
+--- rsync.c 21 May 2004 08:43:03 -0000 1.140
++++ rsync.c 21 May 2004 08:58:01 -0000
+@@ -239,6 +239,9 @@ void finish_transfer(char *fname, char *
if (make_backups && !make_backup(fname))
return;
/* move tmp file over real file */
ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
if (ret < 0) {
-@@ -243,7 +246,8 @@ void finish_transfer(char *fname, char *
+@@ -246,7 +249,8 @@ void finish_transfer(char *fname, char *
ret == -2 ? "copy" : "rename",
full_fname(fnametmp), fname);
do_unlink(fnametmp);
ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
}
--- t_stub.c 15 May 2004 19:31:05 -0000 1.8
-+++ t_stub.c 15 May 2004 20:17:41 -0000
++++ t_stub.c 21 May 2004 08:58:01 -0000
@@ -26,6 +26,7 @@
* functions, so that module test harnesses can run standalone.
**/
int modify_window = 0;
int module_id = -1;
struct exclude_list_struct server_exclude_list;
---- 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"
+--- util.c 21 May 2004 08:40:25 -0000 1.144
++++ util.c 21 May 2004 08:58:01 -0000
+@@ -29,6 +29,7 @@
extern int verbose;
+ extern int dry_run;
+extern int am_root;
+ extern int module_id;
+ extern int modify_window;
extern struct exclude_list_struct server_exclude_list;
-
- int sanitize_paths = 0;
-@@ -261,6 +262,8 @@ int copy_file(char *source, char *dest,
+@@ -263,6 +264,8 @@ int copy_file(char *source, char *dest,
return -1;
}
ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
if (ofd == -1) {
rsyserr(FERROR, errno, "open %s", full_fname(dest));
-@@ -359,8 +362,8 @@ int robust_unlink(char *fname)
+@@ -361,8 +364,8 @@ int robust_unlink(char *fname)
#endif
}
int robust_rename(char *from, char *to, int mode)
{
int tries = 4;
-@@ -377,10 +380,12 @@ int robust_rename(char *from, char *to,
+@@ -379,10 +382,12 @@ int robust_rename(char *from, char *to,
break;
#endif
case EXDEV:
to be called on every file we write.
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 15 May 2004 20:20:27 -0000
++++ options.c 21 May 2004 08:59:11 -0000
@@ -37,6 +37,7 @@ int make_backups = 0;
**/
int whole_file = -1;
{"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 },
-@@ -943,6 +946,9 @@ void server_options(char **args,int *arg
- args[ac++] = "--temp-dir";
+@@ -944,6 +947,9 @@ void server_options(char **args,int *arg
args[ac++] = tmpdir;
}
-+
+
+ if (do_fsync && am_sender)
+ args[ac++] = "--fsync";
-
++
if (compare_dest && am_sender) {
/* the server only needs this option if it is not the sender,
---- 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;
+ * and it may be an older version that doesn't know this
+--- receiver.c 21 May 2004 08:27:04 -0000 1.79
++++ receiver.c 21 May 2004 08:59:11 -0000
+@@ -47,6 +47,7 @@ extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+ extern int checksum_seed;
+extern int do_fsync;
static void delete_one(char *fn, int is_dir)
{
-@@ -266,6 +267,12 @@ static int receive_data(int f_in,struct
+@@ -271,6 +272,12 @@ static int receive_data(int f_in,struct
+ exit_cleanup(RERR_FILEIO);
+ }
- if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
- rsyserr(FERROR, errno, "write failed on %s",
++ if (do_fsync && (fd != -1) && (fsync(fd) != 0)) {
++ rsyserr(FERROR, errno, "fsync failed on %s",
+ full_fname(fname));
+ exit_cleanup(RERR_FILEIO);
+ }
+
-+ if (do_fsync && (fd != -1) && (fsync(fd) != 0)) {
-+ rsyserr(FERROR, errno, "fsync failed on %s",
- full_fname(fname));
- exit_cleanup(RERR_FILEIO);
- }
---- util.c 15 May 2004 19:31:10 -0000 1.143
-+++ util.c 15 May 2004 20:20:28 -0000
-@@ -29,6 +29,7 @@
+ sum_end(file_sum1);
- extern int verbose;
+ read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
+--- util.c 21 May 2004 08:40:25 -0000 1.144
++++ util.c 21 May 2004 08:59:11 -0000
+@@ -32,6 +32,7 @@ extern int dry_run;
+ extern int module_id;
+ extern int modify_window;
extern struct exclude_list_struct server_exclude_list;
+extern int do_fsync;
int sanitize_paths = 0;
-@@ -291,6 +292,12 @@ int copy_file(char *source, char *dest,
+@@ -297,6 +298,12 @@ int copy_file(char *source, char *dest,
+ return -1;
+ }
- if (close(ofd) < 0) {
- rsyserr(FERROR, errno, "close failed on %s",
++ if (do_fsync && fsync(ofd) < 0) {
++ rsyserr(FERROR, errno, "fsync failed on %s",
+ full_fname(dest));
+ return -1;
+ }
+
-+ if (do_fsync && fsync(ofd) < 0) {
-+ rsyserr(FERROR, errno, "fsync failed on %s",
- full_fname(dest));
- return -1;
- }
+ return 0;
+ }
+
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
--- Makefile.in 15 May 2004 00:48:11 -0000 1.101
-+++ Makefile.in 15 May 2004 20:47:12 -0000
++++ Makefile.in 21 May 2004 09:10:37 -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
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 15 May 2004 19:31:10 -0000 1.83
-+++ generator.c 15 May 2004 20:47:12 -0000
+--- generator.c 18 May 2004 08:50:17 -0000 1.85
++++ generator.c 21 May 2004 09:10:37 -0000
@@ -51,6 +51,7 @@ extern int list_only;
extern int only_existing;
extern int orig_umask;
extern int safe_symlinks;
+extern int fuzzy;
+ extern struct exclude_list_struct server_exclude_list;
- /* choose whether to skip a particular file */
-@@ -256,7 +257,61 @@ static void generate_and_send_sums(struc
+@@ -258,7 +259,61 @@ static void generate_and_send_sums(struc
}
}
+
+ if (fd == -1 && compare_dest != NULL)
+ fd = open_alternate_base_comparedir(fname);
-
++
+ if (fd == -1 && fuzzy)
+ fd = open_alternate_base_fuzzy(fname);
+
+ rsyserr(FERROR, errno, "fstat %s", full_fname(fname));
+ }
+ }
-+
+
+ return fd;
+}
/**
* Acts on file number @p i from @p flist, whose name is @p fname.
-@@ -272,8 +327,6 @@ void recv_generator(char *fname, struct
+@@ -274,8 +329,6 @@ void recv_generator(char *fname, struct
STRUCT_STAT st;
struct map_struct *mapbuf;
int statret;
if (list_only)
return;
-@@ -400,107 +453,39 @@ void recv_generator(char *fname, struct
+@@ -413,107 +466,39 @@ void recv_generator(char *fname, struct
}
#endif
- if (opt_ignore_existing && fnamecmp == fname) {
- if (verbose > 1)
- rprintf(FINFO,"%s exists\n",fname);
-+ if ((fd = open_base_file(file, fname, statret, &st)) == -2)
- return;
+- return;
- }
-
+-
- if (update_only && cmp_modtime(st.st_mtime,file->modtime)>0 && fnamecmp == fname) {
- if (verbose > 1)
- rprintf(FINFO,"%s is newer\n",fname);
- return;
-+ if ((disable_deltas_p() || dry_run) && fd != -1) {
-+ close(fd);
-+ fd = -1;
- }
-
+- }
+-
- if (skip_file(fname, file, &st)) {
- if (fnamecmp == fname)
- set_perms(fname, file, &st, PERMS_REPORT);
-
- if (dry_run) {
- write_int(f_out,i);
-- return;
++ if ((fd = open_base_file(file, fname, statret, &st)) == -2)
+ return;
- }
--
+
- if (disable_deltas_p()) {
- write_int(f_out,i);
- write_sum_head(f_out, NULL);
- return;
-- }
--
++ if ((disable_deltas_p() || dry_run) && fd != -1) {
++ close(fd);
++ fd = -1;
+ }
+
- /* open the file */
- fd = do_open(fnamecmp, O_RDONLY, 0);
-
return;
}
-@@ -510,7 +495,7 @@ void recv_generator(char *fname, struct
+@@ -523,7 +508,7 @@ void recv_generator(char *fname, struct
mapbuf = NULL;
if (verbose > 3) {
}
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 15 May 2004 20:47:13 -0000
++++ options.c 21 May 2004 09:10:37 -0000
@@ -91,6 +91,7 @@ int ignore_errors = 0;
int modify_window = 0;
int blocking_io = -1;
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
#ifdef INET6
{"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 },
-@@ -964,6 +967,9 @@ void server_options(char **args,int *arg
- args[ac++] = "--from0";
+@@ -965,6 +968,9 @@ void server_options(char **args,int *arg
}
}
-+
+
+ if (fuzzy && am_sender)
+ args[ac++] = "--fuzzy";
-
++
*argc = ac;
return;
---- 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;
+
+--- receiver.c 21 May 2004 08:27:04 -0000 1.79
++++ receiver.c 21 May 2004 09:10:37 -0000
+@@ -47,6 +47,7 @@ extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+ extern int checksum_seed;
+extern int fuzzy;
static void delete_one(char *fn, int is_dir)
{
-@@ -294,8 +295,6 @@ int recv_files(int f_in,struct file_list
+@@ -295,8 +296,6 @@ int recv_files(int f_in,struct file_list
char *fname, fbuf[MAXPATHLEN];
char template[MAXPATHLEN];
char fnametmp[MAXPATHLEN];
struct map_struct *mapbuf;
int i;
struct file_struct *file;
-@@ -358,35 +357,31 @@ int recv_files(int f_in,struct file_list
+@@ -359,35 +358,31 @@ int recv_files(int f_in,struct file_list
if (verbose > 2)
rprintf(FINFO,"recv_files(%s)\n",fname);
receive_data(f_in, NULL, -1, NULL, file->length);
close(fd1);
continue;
-@@ -407,8 +402,10 @@ int recv_files(int f_in,struct file_list
+@@ -408,8 +403,10 @@ int recv_files(int f_in,struct file_list
if (fd1 != -1 && st.st_size > 0) {
mapbuf = map_file(fd1,st.st_size);
Patch from Mark Curtis to implement the --inplace option.
---- match.c 13 May 2004 06:46:20 -0000 1.61
-+++ match.c 15 May 2004 20:23:18 -0000
-@@ -22,6 +22,7 @@
- extern int verbose;
+--- match.c 21 May 2004 08:27:04 -0000 1.62
++++ match.c 21 May 2004 09:03:09 -0000
+@@ -23,6 +23,7 @@ extern int verbose;
extern int am_server;
extern int do_progress;
+ extern int checksum_seed;
+extern int inplace;
typedef unsigned short tag;
-@@ -197,6 +198,10 @@ static void hash_search(int f,struct sum
- /* also make sure the two blocks are the same length */
- l = MIN((OFF_T)s->blength, len-offset);
+@@ -200,6 +201,10 @@ static void hash_search(int f,struct sum
if (l != s->sums[i].len)
-+ continue;
-+
-+ /* if inplace, make sure the offset is greater than where we are */
-+ if (inplace && offset > s->sums[i].offset)
continue;
++ /* if inplace, make sure the offset is greater than where we are */
++ if (inplace && offset > s->sums[i].offset)
++ continue;
++
if (verbose > 3)
+ rprintf(FINFO,"potential match at %.0f target=%.0f %.0f sum=%08x\n",
+ (double)offset,(double)j,(double)i,sum);
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 15 May 2004 20:23:19 -0000
++++ options.c 21 May 2004 09:03:09 -0000
@@ -91,6 +91,7 @@ int ignore_errors = 0;
int modify_window = 0;
int blocking_io = -1;
if (files_from) {
char *colon;
if (*argc != 2 && !(am_server && am_sender && *argc == 1)) {
-@@ -938,6 +944,9 @@ void server_options(char **args,int *arg
-
+@@ -939,6 +945,9 @@ void server_options(char **args,int *arg
if (opt_ignore_existing && am_sender)
args[ac++] = "--ignore-existing";
-+
+
+ if (inplace)
+ args[ac++] = "--inplace";
-
++
if (tmpdir) {
args[ac++] = "--temp-dir";
---- 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;
+ args[ac++] = tmpdir;
+--- receiver.c 21 May 2004 08:27:04 -0000 1.79
++++ receiver.c 21 May 2004 09:03:09 -0000
+@@ -47,6 +47,7 @@ extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+ extern int checksum_seed;
+extern int inplace;
static void delete_one(char *fn, int is_dir)
{
-@@ -251,16 +252,28 @@ static int receive_data(int f_in,struct
+@@ -252,16 +253,28 @@ static int receive_data(int f_in,struct
sum_update(map,len);
}
if (do_progress)
end_progress(total_size);
-@@ -412,37 +425,50 @@ int recv_files(int f_in,struct file_list
+@@ -413,37 +426,50 @@ int recv_files(int f_in,struct file_list
} else
mapbuf = NULL;
}
cleanup_set(fnametmp, fname, file, mapbuf, fd1, fd2);
---- 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;
+--- rsync.c 21 May 2004 08:43:03 -0000 1.140
++++ rsync.c 21 May 2004 09:03:09 -0000
+@@ -34,6 +34,7 @@ extern int force_delete;
+ extern int recurse;
extern int make_backups;
+ extern char *backup_dir;
+extern int inplace;
/*
-@@ -235,6 +236,11 @@ void finish_transfer(char *fname, char *
-
+@@ -239,6 +240,11 @@ void finish_transfer(char *fname, char *
if (make_backups && !make_backup(fname))
return;
-+
+
+ if (inplace) {
+ set_perms(fname,file,NULL,0);
+ return;
+ }
-
++
/* move tmp file over real file */
ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
+ if (ret < 0) {
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 15 May 2004 20:23:20 -0000
++++ rsync.yo 21 May 2004 09:03:10 -0000
@@ -289,6 +289,7 @@ verb(
--backup-dir make backups into this directory
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
-l, --links copy symlinks as symlinks
-L, --copy-links copy the referent of all symlinks
--copy-unsafe-links copy the referent of "unsafe" symlinks
-@@ -477,6 +478,17 @@ is on the objects. In other words, if t
- symlink where the destination has a file, the transfer would occur
+@@ -478,6 +479,17 @@ symlink where the destination has a file
regardless of the timestamps. This might change in the future (feel
free to comment on this on the mailing list if you have an opinion).
-+
+
+dit(bf(--inplace)) This causes rsync not to create a new copy of the file
+and then move it into place. Instead rsync will overwrite the existing
+file, meaning that the rsync algorithm can't extract the full ammount of
+
+WARNING: If the transfer is interrupted, you will have an inconsistent file
+and the transfer should be run again.
-
++
dit(bf(-l, --links)) When symlinks are encountered, recreate the
symlink on the destination.
+
--- Makefile.in 15 May 2004 00:48:11 -0000 1.101
-+++ Makefile.in 15 May 2004 20:29:17 -0000
++++ Makefile.in 21 May 2004 09:07:58 -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 \
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 15 May 2004 20:29:17 -0000
++++ hashlink.c 21 May 2004 09:07:59 -0000
@@ -0,0 +1,342 @@
+/*
+ Copyright (C) Cronosys, LLC 2004
+
+#endif
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 15 May 2004 20:29:17 -0000
++++ options.c 21 May 2004 09:07:59 -0000
@@ -121,6 +121,7 @@ char *log_format = NULL;
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
default:
/* A large opt value means that set_refuse_options()
* turned this option off (opt-BASE is its index). */
-@@ -951,6 +967,11 @@ void server_options(char **args,int *arg
- */
- args[ac++] = link_dest ? "--link-dest" : "--compare-dest";
+@@ -953,6 +969,11 @@ void server_options(char **args,int *arg
args[ac++] = compare_dest;
-+ }
-+
+ }
+
+ if (link_by_hash_dir && am_sender) {
+ args[ac++] = "--link-by-hash";
+ args[ac++] = link_by_hash_dir;
- }
-
++ }
++
if (files_from && (!am_sender || remote_filesfrom_file)) {
---- 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;
+ if (remote_filesfrom_file) {
+ args[ac++] = "--files-from";
+--- receiver.c 21 May 2004 08:27:04 -0000 1.79
++++ receiver.c 21 May 2004 09:07:59 -0000
+@@ -47,6 +47,7 @@ extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+ extern int checksum_seed;
+extern char *link_by_hash_dir;
static void delete_one(char *fn, int is_dir)
{
-@@ -192,10 +193,11 @@ static int get_tmpname(char *fnametmp, c
+@@ -193,10 +194,11 @@ static int get_tmpname(char *fnametmp, c
static int receive_data(int f_in,struct map_struct *mapbuf,int fd,char *fname,
unsigned int len;
OFF_T offset = 0;
OFF_T offset2;
-@@ -205,7 +207,9 @@ static int receive_data(int f_in,struct
- char *map=NULL;
+@@ -207,6 +209,9 @@ static int receive_data(int f_in,struct
read_sum_head(f_in, &sum);
--
+
+ if (md4)
+ mdfour_begin(&mdfour_data);
-+
- sum_init();
++
+ sum_init(checksum_seed);
while ((i = recv_token(f_in, &data)) != 0) {
-@@ -222,6 +226,8 @@ static int receive_data(int f_in,struct
+@@ -223,6 +228,8 @@ static int receive_data(int f_in,struct
cleanup_got_literal = 1;
sum_update(data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
rsyserr(FERROR, errno, "write failed on %s",
-@@ -249,6 +255,8 @@ static int receive_data(int f_in,struct
+@@ -250,6 +257,8 @@ static int receive_data(int f_in,struct
see_token(map, len);
sum_update(map,len);
}
if (fd != -1 && write_file(fd,map,len) != (int) len) {
-@@ -271,6 +279,8 @@ static int receive_data(int f_in,struct
+@@ -272,6 +281,8 @@ static int receive_data(int f_in,struct
}
sum_end(file_sum1);
read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2) {
-@@ -374,7 +384,7 @@ int recv_files(int f_in,struct file_list
+@@ -375,7 +386,7 @@ int recv_files(int f_in,struct file_list
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
rsyserr(FERROR, errno, "fstat %s failed",
full_fname(fnamecmp));
close(fd1);
continue;
}
-@@ -387,7 +397,7 @@ int recv_files(int f_in,struct file_list
+@@ -388,7 +399,7 @@ int recv_files(int f_in,struct file_list
*/
rprintf(FERROR,"recv_files: %s is a directory\n",
full_fname(fnamecmp));
close(fd1);
continue;
}
-@@ -439,7 +449,7 @@ int recv_files(int f_in,struct file_list
+@@ -440,7 +451,7 @@ int recv_files(int f_in,struct file_list
if (fd2 == -1) {
rsyserr(FERROR, errno, "mkstemp %s failed",
full_fname(fnametmp));
if (mapbuf) unmap_file(mapbuf);
if (fd1 != -1) close(fd1);
continue;
-@@ -452,7 +462,12 @@ int recv_files(int f_in,struct file_list
+@@ -453,7 +464,11 @@ int recv_files(int f_in,struct file_list
}
/* recv file data */
- recv_ok = receive_data(f_in,mapbuf,fd2,fname,file->length);
+#ifdef HAVE_LINK
-+ if (link_by_hash_dir) {
-+ file->u.sum = (char*)malloc (MD4_SUM_LENGTH);
-+ }
++ if (link_by_hash_dir)
++ file->u.sum = (char*)malloc(MD4_SUM_LENGTH);
+#endif
+ recv_ok = receive_data(f_in,mapbuf,fd2,fname,file->length,file->u.sum);
log_recv(file, &initial_stats);
---- 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;
+--- rsync.c 21 May 2004 08:43:03 -0000 1.140
++++ rsync.c 21 May 2004 09:07:59 -0000
+@@ -34,6 +34,7 @@ extern int force_delete;
+ extern int recurse;
extern int make_backups;
+ extern char *backup_dir;
+extern char *link_by_hash_dir;
/*
-@@ -236,8 +237,12 @@ void finish_transfer(char *fname, char *
+@@ -239,8 +240,12 @@ void finish_transfer(char *fname, char *
if (make_backups && !make_backup(fname))
return;
- ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
+#ifdef HAVE_LINK
+ if (link_by_hash_dir)
-+ ret = link_by_hash(fnametmp,fname,file);
++ ret = link_by_hash(fnametmp, fname, file);
+ else
+#endif
+ ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
if (ret < 0) {
rsyserr(FERROR, errno, "%s %s -> \"%s\"",
ret == -2 ? "copy" : "rename",
---- rsync.h 13 May 2004 18:51:22 -0000 1.203
-+++ rsync.h 15 May 2004 20:29:18 -0000
-@@ -521,6 +521,14 @@ struct stats {
+--- rsync.h 16 May 2004 07:28:24 -0000 1.204
++++ rsync.h 21 May 2004 09:07:59 -0000
+@@ -522,6 +522,14 @@ struct stats {
int current_file_index;
};
--- io.c 15 May 2004 19:31:10 -0000 1.121
-+++ io.c 15 May 2004 20:15:14 -0000
++++ io.c 21 May 2004 08:50:06 -0000
@@ -222,6 +222,14 @@ static void read_msg_fd(void)
read_loop(fd, buf, 4);
redo_list_add(IVAL(buf,0));
case MSG_INFO:
case MSG_ERROR:
case MSG_LOG:
-@@ -635,6 +643,16 @@ static int read_unbuffered(int fd, char
- }
+@@ -636,6 +644,16 @@ static int read_unbuffered(int fd, char
read_loop(fd, buffer, remaining);
bufferIdx = 0;
-+ break;
+ break;
+ case MSG_SUCCESS:
+ if (remaining != 4) {
+ rprintf(FERROR, "invalid multi-message %d:%ld\n",
+ read_loop(fd, line, remaining);
+ successful_send(IVAL(line, 0));
+ remaining = 0;
- break;
++ break;
case MSG_INFO:
case MSG_ERROR:
---- main.c 15 May 2004 19:31:10 -0000 1.194
-+++ main.c 15 May 2004 20:15:15 -0000
+ if (remaining >= sizeof line) {
+--- main.c 19 May 2004 22:19:19 -0000 1.195
++++ main.c 21 May 2004 08:50:07 -0000
@@ -42,6 +42,7 @@ extern int list_only;
extern int local_server;
extern int log_got_error;
extern int orig_umask;
extern int preserve_hard_links;
extern int protocol_version;
-@@ -566,6 +567,8 @@ void start_server(int f_in, int f_out, i
+@@ -572,6 +573,8 @@ void start_server(int f_in, int f_out, i
io_start_multiplex_out(f_out);
if (am_sender) {
if (!read_batch) {
recv_exclude_list(f_in);
if (cvs_exclude)
-@@ -631,6 +634,9 @@ int client_run(int f_in, int f_out, pid_
- io_flush(FULL_FLUSH);
+@@ -638,6 +641,9 @@ int client_run(int f_in, int f_out, pid_
exit_cleanup(status);
}
-+
+
+ if (need_messages_from_generator)
+ io_start_multiplex_out(f_out);
-
++
if (argc == 0)
list_only = 1;
+
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 15 May 2004 20:15:15 -0000
++++ options.c 21 May 2004 08:50:07 -0000
@@ -84,6 +84,7 @@ int copy_unsafe_links = 0;
int size_only = 0;
int bwlimit = 0;
case OPT_EXCLUDE:
add_exclude(&exclude_list, poptGetOptArg(pc), 0);
break;
-@@ -964,6 +973,9 @@ void server_options(char **args,int *arg
- args[ac++] = "--from0";
+@@ -965,6 +974,9 @@ void server_options(char **args,int *arg
}
}
-+
+
+ if (delete_sent_files)
+ args[ac++] = "--delete-sent-files";
-
++
*argc = ac;
return;
---- 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;
+
+--- receiver.c 21 May 2004 08:27:04 -0000 1.79
++++ receiver.c 21 May 2004 08:50:07 -0000
+@@ -47,6 +47,7 @@ extern int ignore_errors;
extern int orig_umask;
extern int keep_partial;
+ extern int checksum_seed;
+extern int delete_sent_files;
static void delete_one(char *fn, int is_dir)
{
-@@ -294,7 +295,7 @@ int recv_files(int f_in,struct file_list
+@@ -295,7 +296,7 @@ int recv_files(int f_in,struct file_list
char *fname, fbuf[MAXPATHLEN];
char template[MAXPATHLEN];
char fnametmp[MAXPATHLEN];
char fnamecmpbuf[MAXPATHLEN];
struct map_struct *mapbuf;
int i;
-@@ -476,16 +477,20 @@ int recv_files(int f_in,struct file_list
+@@ -477,16 +478,20 @@ int recv_files(int f_in,struct file_list
cleanup_disable();
}
}
}
---- rsync.h 13 May 2004 18:51:22 -0000 1.203
-+++ rsync.h 15 May 2004 20:15:15 -0000
+--- rsync.h 16 May 2004 07:28:24 -0000 1.204
++++ rsync.h 21 May 2004 08:50:07 -0000
@@ -60,6 +60,7 @@
#define FLAG_TOP_DIR (1<<0)
#define FLAG_HLINK_EOL (1<<1) /* generator only */
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 15 May 2004 20:15:16 -0000
++++ rsync.yo 21 May 2004 08:50:08 -0000
@@ -312,6 +312,7 @@ verb(
--delete delete files that don't exist on sender
--delete-excluded also delete excluded files on receiver
--ignore-errors delete even if there are I/O errors
--max-delete=NUM don't delete more than NUM files
--partial keep partially transferred files
-@@ -596,6 +597,11 @@ dit(bf(--delete-after)) By default rsync
- receiving side before transferring files to try to ensure that there is
+@@ -597,6 +598,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.
-+
+
+dit(bf(--delete-sent-files)) This tells rsync to remove the source files
+on the sending side that are successfully transferred to the receiving
+side. Directories are not removed, nor are files that are identical on
+both systems.
-
++
dit(bf(--ignore-errors)) Tells --delete to go ahead and delete files
even when there are I/O errors.
+
--- sender.c 15 May 2004 19:31:10 -0000 1.40
-+++ sender.c 15 May 2004 20:15:16 -0000
++++ sender.c 21 May 2004 08:50:08 -0000
@@ -27,6 +27,7 @@ extern int dry_run;
extern int am_server;
extern int am_daemon;