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
---- orig/cleanup.c 2004-07-02 18:11:26
+--- orig/cleanup.c 2004-07-20 21:36:07
+++ cleanup.c 2004-07-03 20:22:18
-@@ -141,8 +141,12 @@ void _exit_cleanup(int code, const char
+@@ -138,8 +138,12 @@ void _exit_cleanup(int code, const char
code = RERR_VANISHED;
}
if (verbose > 2) {
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): about to call exit(%d)\n",
---- orig/clientserver.c 2004-07-15 02:21:10
+--- orig/clientserver.c 2004-07-17 15:20:05
+++ clientserver.c 2004-07-03 20:22:18
@@ -316,6 +316,9 @@ static int rsync_module(int f_in, int f_
exclude_path_prefix = NULL;
{
int i;
for (i = 0; rerr_names[i].name; i++) {
---- orig/main.c 2004-07-15 17:02:03
+--- orig/main.c 2004-07-19 17:14:44
+++ main.c 2004-07-03 20:22:18
@@ -134,6 +134,9 @@ static void report(int f)
if (f == -1 || !am_sender)
return;
}
---- orig/receiver.c 2004-07-16 20:07:22
-+++ receiver.c 2004-07-03 20:22:18
-@@ -490,7 +490,9 @@ int recv_files(int f_in, struct file_lis
- recv_ok = receive_data(f_in,mapbuf,fd2,fname,file->length);
+--- orig/receiver.c 2004-07-20 21:36:07
++++ receiver.c 2004-07-20 21:47:47
+@@ -512,6 +512,9 @@ int recv_files(int f_in, struct file_lis
+ fname, fd2, file->length);
log_recv(file, &initial_stats);
--
+#ifdef HAVE_LIBODBC
+ db_log_transfer(file, &initial_stats, "receive");
+#endif
- if (mapbuf)
- unmap_file(mapbuf);
+
if (fd1 != -1)
---- orig/sender.c 2004-07-16 20:07:23
+ close(fd1);
+--- orig/sender.c 2004-07-20 21:36:08
+++ sender.c 2004-07-15 02:37:48
-@@ -231,6 +231,9 @@ void send_files(struct file_list *flist,
+@@ -230,6 +230,9 @@ void send_files(struct file_list *flist,
match_sums(f_out, s, mbuf, st.st_size);
log_send(file, &initial_stats);
+ if (isdigit(*arg))
+ inherit_exclude_levels = atoi(arg);
+ else if (*arg == '.') {
-+ if (!arg[1])
++ if (!*++arg)
+ inherit_exclude_levels = 0;
-+ else if (arg[1] == '.') {
-+ inherit_exclude_levels = 0;
-+ arg--;
-+ do {
++ else if (*arg == '.') {
++ inherit_exclude_levels = 1;
++ arg++;
++ while (strncmp(arg, "/..", 3) == 0) {
+ inherit_exclude_levels++;
+ arg += 3;
-+ } while (strncmp(arg, "/..", 3) == 0);
++ }
+ if (*arg)
+ inherit_exclude_levels = -1;
+ }
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-07-16 20:07:22
+--- orig/options.c 2004-07-20 21:36:07
+++ options.c 2004-07-03 20:18:13
@@ -38,6 +38,7 @@ int make_backups = 0;
**/
if (compare_dest && 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-07-16 20:07:22
+--- orig/receiver.c 2004-07-20 21:36:07
+++ receiver.c 2004-07-16 20:13:31
@@ -35,6 +35,7 @@ extern int preserve_hard_links;
extern int preserve_perms;
extern char *tmpdir;
extern char *compare_dest;
extern int make_backups;
-@@ -289,6 +290,12 @@ static int receive_data(int f_in,struct
+@@ -304,6 +305,12 @@ static int receive_data(int f_in, char *
exit_cleanup(RERR_FILEIO);
}
+
sum_end(file_sum1);
- read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
+ if (mapbuf)
--- orig/util.c 2004-06-09 21:54:47
+++ util.c 2004-07-03 20:18:13
@@ -32,6 +32,7 @@ extern int dry_run;
Be sure to run "make proto" before "make".
--- orig/generator.c 2004-07-17 15:50:09
-+++ generator.c 2004-07-03 20:09:05
++++ generator.c 2004-07-20 21:49:24
@@ -41,6 +41,7 @@ extern int ignore_times;
extern int size_only;
extern int io_timeout;
extern int always_checksum;
extern char *compare_dest;
extern int link_dest;
-@@ -241,6 +242,94 @@ static void generate_and_send_sums(struc
+@@ -248,6 +249,94 @@ static void generate_and_send_sums(int f
}
/*
* Acts on file number @p i from @p flist, whose name is @p fname.
-@@ -256,7 +345,7 @@ static void recv_generator(char *fname,
+@@ -262,7 +351,7 @@ static void recv_generator(char *fname,
+ {
int fd = -1;
STRUCT_STAT st;
- struct map_struct *mapbuf = NULL;
- int statret;
+ int statret, fuzzy_file = 0;
char *fnamecmp;
char fnamecmpbuf[MAXPATHLEN];
-@@ -436,6 +525,14 @@ static void recv_generator(char *fname,
+@@ -442,6 +531,14 @@ static void recv_generator(char *fname,
} else
*fnamecmpbuf = '\0';
if (statret == -1) {
if (preserve_hard_links && hard_link_check(file, HL_SKIP))
return;
-@@ -473,7 +570,7 @@ static void recv_generator(char *fname,
+@@ -479,7 +576,7 @@ static void recv_generator(char *fname,
return;
}
if (preserve_hard_links)
init_hard_links(flist);
---- orig/options.c 2004-07-16 20:07:22
+--- orig/options.c 2004-07-20 21:36:07
+++ options.c 2004-07-16 20:14:12
@@ -85,6 +85,7 @@ int safe_symlinks = 0;
int copy_unsafe_links = 0;
*argc = ac;
return;
---- orig/receiver.c 2004-07-17 21:27:55
+--- orig/receiver.c 2004-07-19 16:44:39
+++ receiver.c 2004-07-03 20:09:05
@@ -37,7 +37,6 @@ extern int preserve_perms;
extern int cvs_exclude;
extern int make_backups;
extern int do_progress;
extern char *backup_dir;
---- orig/rsync.yo 2004-07-19 08:27:29
+--- orig/rsync.yo 2004-07-20 21:36:08
+++ rsync.yo 2004-07-03 19:27:25
@@ -326,6 +326,7 @@ verb(
-T --temp-dir=DIR create temporary files in directory DIR
You must run "make proto" before compiling.
---- orig/generator.c 2004-07-17 16:30:20
+--- orig/generator.c 2004-07-20 21:36:07
+++ generator.c 2004-07-17 15:50:09
-@@ -251,11 +251,11 @@ static void generate_and_send_sums(struc
+@@ -258,9 +258,9 @@ static void generate_and_send_sums(int f
* out. It might be wrong.
*/
static void recv_generator(char *fname, struct file_struct *file, int i,
- int fd;
+ int fd = -1;
STRUCT_STAT st;
-- struct map_struct *mapbuf;
-+ struct map_struct *mapbuf = NULL;
int statret;
char *fnamecmp;
- char fnamecmpbuf[MAXPATHLEN];
-@@ -398,9 +398,6 @@ static void recv_generator(char *fname,
+@@ -404,9 +404,6 @@ static void recv_generator(char *fname,
}
#endif
if (preserve_hard_links && hard_link_check(file, HL_CHECK_MASTER))
return;
-@@ -418,8 +415,10 @@ static void recv_generator(char *fname,
+@@ -424,8 +421,10 @@ static void recv_generator(char *fname,
statret = link_stat(fnamecmpbuf, &st, 0);
if (!S_ISREG(st.st_mode))
statret = -1;
#if HAVE_LINK
else if (link_dest && !dry_run) {
if (do_link(fnamecmpbuf, fname) != 0) {
-@@ -427,22 +426,22 @@ static void recv_generator(char *fname,
+@@ -433,22 +432,22 @@ static void recv_generator(char *fname,
rsyserr(FINFO, errno, "link %s => %s",
fnamecmpbuf, fname);
}
rsyserr(FERROR, errno,
"recv_generator: failed to open %s",
full_fname(fname));
-@@ -451,26 +450,23 @@ static void recv_generator(char *fname,
+@@ -457,26 +456,23 @@ static void recv_generator(char *fname,
}
if (!S_ISREG(st.st_mode)) {
&& cmp_modtime(st.st_mtime, file->modtime) > 0) {
if (verbose > 1)
rprintf(FINFO,"%s is newer\n",fname);
-@@ -478,21 +474,17 @@ static void recv_generator(char *fname,
+@@ -484,21 +480,17 @@ static void recv_generator(char *fname,
}
if (skip_file(fname, file, &st)) {
/* open the file */
fd = do_open(fnamecmp, O_RDONLY, 0);
-@@ -503,15 +495,12 @@ static void recv_generator(char *fname,
+@@ -509,9 +501,8 @@ static void recv_generator(char *fname,
/* pretend the file didn't exist */
if (preserve_hard_links && hard_link_check(file, HL_SKIP))
return;
+ goto notify_others;
}
- if (st.st_size > 0)
- mapbuf = map_file(fd,st.st_size);
-- else
-- mapbuf = NULL;
-
if (verbose > 3) {
- rprintf(FINFO,"gen mapped %s of size %.0f\n", fnamecmp,
-@@ -521,16 +510,43 @@ static void recv_generator(char *fname,
+@@ -522,14 +513,41 @@ static void recv_generator(char *fname,
if (verbose > 2)
rprintf(FINFO, "generating and sending sums for %d\n", i);
- write_int(f_out,i);
-- generate_and_send_sums(mapbuf, st.st_size, f_out);
+- generate_and_send_sums(fd, st.st_size, f_out);
+notify_others:
+ if (f_nameout >= 0) {
+ uchar lenbuf[3], *lb = lenbuf;
+ }
- close(fd);
-- if (mapbuf)
-- unmap_file(mapbuf);
+ if (read_batch)
+ return;
+
+ write_int(f_out, i);
+ if (statret == 0) {
-+ generate_and_send_sums(mapbuf, st.st_size, f_out);
++ generate_and_send_sums(fd, st.st_size, f_out);
+
+ close(fd);
-+ if (mapbuf)
-+ unmap_file(mapbuf);
+ } else if (!dry_run)
+ write_sum_head(f_out, NULL);
}
{
int i;
int phase = 0;
-@@ -571,7 +587,7 @@ void generate_files(int f_out, struct fi
+@@ -570,7 +588,7 @@ void generate_files(int f_out, struct fi
}
recv_generator(local_name ? local_name : f_name_to(file, fbuf),
}
phase++;
-@@ -582,13 +598,15 @@ void generate_files(int f_out, struct fi
+@@ -581,13 +599,15 @@ void generate_files(int f_out, struct fi
rprintf(FINFO,"generate_files phase=%d\n",phase);
write_int(f_out, -1);
}
phase++;
-@@ -596,6 +614,8 @@ void generate_files(int f_out, struct fi
+@@ -595,6 +615,8 @@ void generate_files(int f_out, struct fi
rprintf(FINFO,"generate_files phase=%d\n",phase);
write_int(f_out, -1);
if (preserve_hard_links)
do_hard_links();
-@@ -607,7 +627,7 @@ void generate_files(int f_out, struct fi
+@@ -606,7 +628,7 @@ void generate_files(int f_out, struct fi
if (!file->basename || !S_ISDIR(file->mode))
continue;
recv_generator(local_name ? local_name : f_name(file),
get_redo_num(); /* Read final MSG_DONE and any prior messages. */
report(-1);
---- orig/receiver.c 2004-07-19 17:06:10
+--- orig/receiver.c 2004-07-20 21:36:07
+++ receiver.c 2004-07-19 16:44:39
@@ -28,6 +28,7 @@ extern int max_delete;
extern int csum_length;
extern int am_server;
extern int relative_paths;
extern int keep_dirlinks;
-@@ -303,6 +304,30 @@ static int receive_data(int f_in,struct
+@@ -318,6 +319,30 @@ static int receive_data(int f_in, char *
}
+
static void discard_receive_data(int f_in, OFF_T length)
{
- receive_data(f_in, NULL, -1, NULL, length);
-@@ -313,8 +338,10 @@ static void discard_receive_data(int f_i
+ receive_data(f_in, NULL, -1, 0, NULL, -1, length);
+@@ -328,8 +353,10 @@ static void discard_receive_data(int f_i
* main routine for receiver process.
*
* Receiver process runs on the same host as the generator process. */
int fd1,fd2;
STRUCT_STAT st;
char *fname, fbuf[MAXPATHLEN];
-@@ -341,6 +368,17 @@ int recv_files(int f_in, struct file_lis
+@@ -355,6 +382,17 @@ int recv_files(int f_in, struct file_lis
i = read_int(f_in);
if (i == -1) {
if (phase)
break;
-@@ -383,7 +421,26 @@ int recv_files(int f_in, struct file_lis
+@@ -397,7 +435,26 @@ int recv_files(int f_in, struct file_lis
if (verbose > 2)
rprintf(FINFO,"recv_files(%s)\n",fname);
if (server_exclude_list.head
&& check_exclude(&server_exclude_list, fname,
-@@ -400,14 +457,6 @@ int recv_files(int f_in, struct file_lis
+@@ -414,14 +471,6 @@ int recv_files(int f_in, struct file_lis
/* open the file */
fd1 = do_open(fnamecmp, O_RDONLY, 0);
+}
+
+#endif
---- orig/options.c 2004-07-16 20:07:22
+--- orig/options.c 2004-07-20 21:36:07
+++ options.c 2004-07-03 20:20:15
@@ -125,6 +125,7 @@ char *log_format = NULL;
char *password_file = NULL;
if (files_from && (!am_sender || remote_filesfrom_file)) {
if (remote_filesfrom_file) {
args[ac++] = "--files-from";
---- orig/receiver.c 2004-07-19 17:06:10
-+++ receiver.c 2004-07-19 17:07:31
+--- orig/receiver.c 2004-07-20 21:36:07
++++ receiver.c 2004-07-20 21:44:05
@@ -37,6 +37,7 @@ extern int cvs_exclude;
extern int io_error;
extern char *tmpdir;
extern int make_backups;
extern int do_progress;
extern char *backup_dir;
-@@ -200,10 +201,11 @@ static int get_tmpname(char *fnametmp, c
+@@ -200,12 +201,13 @@ static int get_tmpname(char *fnametmp, c
- static int receive_data(int f_in,struct map_struct *mapbuf,int fd,char *fname,
-- OFF_T total_size)
-+ OFF_T total_size,char *md4)
+ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+- char *fname, int fd, OFF_T total_size)
++ char *fname, int fd, OFF_T total_size, char *md4)
{
- int i;
+ static char file_sum1[MD4_SUM_LENGTH];
+ static char file_sum2[MD4_SUM_LENGTH];
+ struct map_struct *mapbuf;
struct sum_struct sum;
+ struct mdfour mdfour_data;
unsigned int len;
OFF_T offset = 0;
OFF_T offset2;
-@@ -214,6 +216,9 @@ static int receive_data(int f_in,struct
-
- read_sum_head(f_in, &sum);
+@@ -224,6 +226,9 @@ static int receive_data(int f_in, char *
+ } else
+ mapbuf = NULL;
+ if (md4)
+ mdfour_begin(&mdfour_data);
sum_init(checksum_seed);
while ((i = recv_token(f_in, &data)) != 0) {
-@@ -230,6 +235,8 @@ static int receive_data(int f_in,struct
+@@ -240,6 +245,8 @@ static int receive_data(int f_in, char *
cleanup_got_literal = 1;
sum_update(data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
rsyserr(FERROR, errno, "write failed on %s",
-@@ -257,6 +264,8 @@ static int receive_data(int f_in,struct
+@@ -267,6 +274,8 @@ static int receive_data(int f_in, char *
see_token(map, len);
sum_update(map,len);
}
if (!inplace || offset != offset2) {
-@@ -293,6 +302,8 @@ static int receive_data(int f_in,struct
+@@ -305,6 +314,8 @@ static int receive_data(int f_in, char *
}
sum_end(file_sum1);
+ if (md4)
+ mdfour_result(&mdfour_data, (unsigned char*)md4);
- read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
- if (verbose > 2)
-@@ -305,7 +316,7 @@ static int receive_data(int f_in,struct
+ if (mapbuf)
+ unmap_file(mapbuf);
+@@ -320,7 +331,7 @@ static int receive_data(int f_in, char *
static void discard_receive_data(int f_in, OFF_T length)
{
-- receive_data(f_in, NULL, -1, NULL, length);
-+ receive_data(f_in, NULL, -1, NULL, length, NULL);
+- receive_data(f_in, NULL, -1, 0, NULL, -1, length);
++ receive_data(f_in, NULL, -1, 0, NULL, -1, length, NULL);
}
-@@ -510,7 +521,11 @@ int recv_files(int f_in, struct file_lis
+@@ -508,8 +519,12 @@ int recv_files(int f_in, struct file_lis
rprintf(FINFO, "%s\n", fname);
/* 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);
+#endif
-+ recv_ok = receive_data(f_in,mapbuf,fd2,fname,file->length,file->u.sum);
+ recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
+- fname, fd2, file->length);
++ fname, fd2, file->length, file->u.sum);
log_recv(file, &initial_stats);
ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
if (ret < 0) {
rsyserr(FERROR, errno, "%s %s -> \"%s\"",
---- orig/rsync.h 2004-07-16 20:07:23
+--- orig/rsync.h 2004-07-20 21:36:08
+++ rsync.h 2004-07-03 20:20:15
-@@ -524,6 +524,14 @@ struct stats {
+@@ -522,6 +522,14 @@ struct stats {
int current_file_index;
};
---- orig/generator.c 2004-07-16 19:35:29
+--- orig/generator.c 2004-07-17 16:30:20
+++ generator.c 2004-07-03 20:20:46
@@ -39,6 +39,7 @@ extern int opt_ignore_existing;
extern int csum_length;
+ return;
}
- if (read_batch)
+ if (preserve_links && S_ISLNK(file->mode)) {
--- orig/options.c 2004-07-16 20:07:22
+++ options.c 2004-07-15 02:34:44
@@ -90,6 +90,7 @@ int delete_after = 0;
if (io_timeout) {
if (asprintf(&arg, "--timeout=%d", io_timeout) < 0)
goto oom;
---- orig/rsync.yo 2004-07-16 20:07:23
+--- orig/rsync.yo 2004-07-19 08:27:29
+++ rsync.yo 2004-07-03 20:20:46
@@ -316,6 +316,7 @@ verb(
--delete-after receiver deletes after transfer, not before
--partial keep partially transferred files
--force force deletion of dirs even if not empty
--numeric-ids don't map uid/gid values by user/group name
-@@ -589,6 +590,11 @@ dit(bf(--max-delete=NUM)) This tells rsy
+@@ -592,6 +593,11 @@ dit(bf(--max-delete=NUM)) This tells rsy
files or directories. This is useful when mirroring very large trees
to prevent disasters.
make proto
---- orig/io.c 2004-07-17 15:20:05
+--- orig/io.c 2004-07-20 21:36:07
+++ io.c 2004-07-03 20:17:10
@@ -239,6 +239,14 @@ static void read_msg_fd(void)
read_loop(fd, buf, 4);
case MSG_INFO:
case MSG_ERROR:
if (remaining >= sizeof line) {
---- orig/main.c 2004-07-17 15:20:05
+--- orig/main.c 2004-07-19 17:14:44
+++ main.c 2004-07-15 02:29:03
@@ -42,6 +42,7 @@ extern int list_only;
extern int local_server;
if (argc == 0)
list_only = 1;
---- orig/options.c 2004-07-16 20:07:22
+--- orig/options.c 2004-07-20 21:36:07
+++ options.c 2004-07-16 20:09:54
@@ -87,8 +87,10 @@ int size_only = 0;
int bwlimit = 0;
*argc = ac;
return;
---- orig/receiver.c 2004-07-16 20:07:22
+--- orig/receiver.c 2004-07-20 21:36:07
+++ receiver.c 2004-07-16 20:09:48
@@ -43,6 +43,7 @@ extern char *backup_dir;
extern char *backup_suffix;
extern int module_id;
extern int ignore_errors;
extern int orig_umask;
-@@ -311,7 +312,7 @@ int recv_files(int f_in, struct file_lis
+@@ -335,7 +336,7 @@ int recv_files(int f_in, struct file_lis
char *fname, fbuf[MAXPATHLEN];
char template[MAXPATHLEN];
char fnametmp[MAXPATHLEN];
- char *fnamecmp;
+ char *fnamecmp, numbuf[4];
char fnamecmpbuf[MAXPATHLEN];
- struct map_struct *mapbuf;
struct file_struct *file;
-@@ -508,16 +509,20 @@ int recv_files(int f_in, struct file_lis
+ struct stats initial_stats;
+@@ -528,16 +529,20 @@ int recv_files(int f_in, struct file_lis
cleanup_disable();
}
}
}
---- orig/rsync.h 2004-07-16 20:07:23
+--- orig/rsync.h 2004-07-20 21:36:08
+++ rsync.h 2004-07-03 20:17:10
@@ -60,6 +60,7 @@
#define FLAG_TOP_DIR (1<<0)
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-07-16 20:07:23
+--- orig/rsync.yo 2004-07-20 21:36:08
+++ rsync.yo 2004-07-03 20:17:10
@@ -314,6 +314,7 @@ verb(
--delete delete files that don't exist on sender
--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
-@@ -615,6 +616,11 @@ receiving side before transferring files
+@@ -618,6 +619,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(--ignore-errors)) Tells --delete to go ahead and delete files
even when there are I/O errors.
---- orig/sender.c 2004-07-16 20:07:23
+--- orig/sender.c 2004-07-20 21:36:08
+++ sender.c 2004-07-16 20:10:19
@@ -26,6 +26,7 @@ extern int io_error;
extern int dry_run;
while (1) {
unsigned int offset;
-@@ -247,6 +272,9 @@ void send_files(struct file_list *flist,
+@@ -246,6 +271,9 @@ void send_files(struct file_list *flist,
if (verbose > 2)
rprintf(FINFO, "sender finished %s\n", fname);