extern struct stats stats;
@@ -87,6 +88,8 @@ static int64 tmp_dev, tmp_ino;
#endif
- static char tmp_sum[MD4_SUM_LENGTH];
+ static char tmp_sum[MAX_DIGEST_LEN];
+struct file_list the_fattr_list;
+
- static char empty_sum[MD4_SUM_LENGTH];
+ static char empty_sum[MAX_DIGEST_LEN];
static int flist_count_offset; /* for --delete --progress */
-@@ -271,6 +274,45 @@ static mode_t from_wire_mode(int mode)
+@@ -273,6 +276,45 @@ static mode_t from_wire_mode(int mode)
return mode;
}
static void send_directory(int f, struct file_list *flist, int ndx,
char *fbuf, int len, int flags);
-@@ -1765,6 +1807,25 @@ struct file_list *recv_file_list(int f)
+@@ -1767,6 +1809,25 @@ struct file_list *recv_file_list(int f)
clean_flist(flist, relative_paths, 1);
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -859,6 +860,15 @@ static struct file_struct *recv_file_ent
+@@ -882,6 +883,15 @@ static struct file_struct *recv_file_ent
memcpy(bp, F_SUM(first), checksum_len);
} else
read_buf(f, bp, checksum_len);
@@ -599,6 +601,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
- char sum[MD4_SUM_LENGTH];
+ char sum[MAX_DIGEST_LEN];
+ if (pre_checksum && fnamecmp_type == FNAMECMP_FNAME)
+ return !(file->flags & FLAG_SUM_DIFFERS);
file_checksum(fn, sum, st->st_size);
--- old/options.c
+++ new/options.c
-@@ -45,6 +45,7 @@ int append_mode = 0;
+@@ -44,6 +44,7 @@ int append_mode = 0;
int keep_dirlinks = 0;
int copy_dirlinks = 0;
int copy_links = 0;
+int do_fsync = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
- int preserve_perms = 0;
-@@ -336,6 +337,7 @@ void usage(enum logcode F)
+ int preserve_acls = 0;
+@@ -345,6 +346,7 @@ void usage(enum logcode F)
rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
rprintf(F," --delay-updates put all updated files into place at transfer's end\n");
rprintf(F," -m, --prune-empty-dirs prune empty directory chains from the file-list\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
-@@ -523,6 +525,7 @@ static struct poptOption long_options[]
+@@ -539,6 +541,7 @@ static struct poptOption long_options[]
{"only-write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 },
{"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
{"from0", '0', POPT_ARG_NONE, &eol_nulls, 0, 0, 0},
{"numeric-ids", 0, POPT_ARG_NONE, &numeric_ids, 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
-@@ -1743,6 +1746,9 @@ void server_options(char **args,int *arg
+@@ -1777,6 +1780,9 @@ void server_options(char **args,int *arg
args[ac++] = tmpdir;
}
* and it may be an older version that doesn't know this
--- old/receiver.c
+++ new/receiver.c
-@@ -38,6 +38,7 @@ extern int protocol_version;
+@@ -37,6 +37,7 @@ extern int protocol_version;
extern int relative_paths;
extern int preserve_hard_links;
extern int preserve_perms;
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
-@@ -258,6 +259,12 @@ static int receive_data(int f_in, char *
+@@ -257,6 +258,12 @@ static int receive_data(int f_in, char *
exit_cleanup(RERR_FILEIO);
}
+ exit_cleanup(RERR_FILEIO);
+ }
+
- sum_end(file_sum1);
+ sum_len = sum_end(file_sum1);
if (mapbuf)
--- old/t_stub.c
+++ new/t_stub.c
-@@ -22,6 +22,7 @@
+@@ -21,6 +21,7 @@
#include "rsync.h"
int relative_paths = 0;
--- old/util.c
+++ new/util.c
-@@ -26,6 +26,7 @@
+@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
extern int module_id;
extern int modify_window;
extern int relative_paths;
extern int human_readable;
-@@ -316,6 +317,12 @@ int copy_file(const char *source, const
+@@ -315,6 +316,12 @@ int copy_file(const char *source, const
return -1;
}
extern char curr_dir[MAXPATHLEN];
-@@ -724,7 +725,7 @@ static struct file_struct *recv_file_ent
+@@ -747,7 +748,7 @@ static struct file_struct *recv_file_ent
extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN;
#endif
+#endif
--- old/options.c
+++ new/options.c
-@@ -144,6 +144,7 @@ char *backup_suffix = NULL;
+@@ -145,6 +145,7 @@ char *backup_suffix = NULL;
char *tmpdir = NULL;
char *partial_dir = NULL;
char *basis_dir[MAX_BASIS_DIRS+1];
char *config_file = NULL;
char *shell_cmd = NULL;
char *logfile_name = NULL;
-@@ -354,6 +355,7 @@ void usage(enum logcode F)
+@@ -355,6 +356,7 @@ void usage(enum logcode F)
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\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," -z, --compress compress file data during the transfer\n");
rprintf(F," --compress-level=NUM explicitly set compression level\n");
rprintf(F," -C, --cvs-exclude auto-ignore files the same way CVS does\n");
-@@ -403,7 +405,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -404,7 +406,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -508,6 +510,7 @@ static struct poptOption long_options[]
+@@ -513,6 +515,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", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 },
-@@ -1122,6 +1125,21 @@ int parse_arguments(int *argc, const cha
+@@ -1127,6 +1130,21 @@ int parse_arguments(int *argc, const cha
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1784,6 +1802,11 @@ void server_options(char **args,int *arg
+@@ -1789,6 +1807,11 @@ void server_options(char **args,int *arg
}
}
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)
+- const char *fname, int fd, OFF_T total_size)
+ const char *fname, int fd, OFF_T total_size,
+ const char *md4)
{
- static char file_sum1[MD4_SUM_LENGTH];
- static char file_sum2[MD4_SUM_LENGTH];
+ static char file_sum1[MAX_DIGEST_LEN];
+ static char file_sum2[MAX_DIGEST_LEN];
struct map_struct *mapbuf;
struct sum_struct sum;
-+ struct mdfour mdfour_data;
- int32 len;
++ md_context mdfour_data;
+ int32 len, sum_len;
OFF_T offset = 0;
OFF_T offset2;
@@ -148,6 +150,9 @@ static int receive_data(int f_in, char *
@@ -258,6 +267,8 @@ static int receive_data(int f_in, char *
}
- sum_end(file_sum1);
+ sum_len = sum_end(file_sum1);
+ if (md4)
-+ mdfour_result(&mdfour_data, (unsigned char*)md4);
++ mdfour_result(&mdfour_data, (uchar*)md4);
if (mapbuf)
unmap_file(mapbuf);
ret == -2 ? "copy" : "rename",
--- old/rsync.h
+++ new/rsync.h
-@@ -758,6 +758,14 @@ struct stats {
+@@ -756,6 +756,14 @@ struct stats {
int current_file_index;
};
@@ -28,13 +28,13 @@ VERSION=@VERSION@
HEADERS=byteorder.h config.h errcode.h proto.h rsync.h smb_acls.h lib/pool_alloc.h
- LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
+ LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
- lib/permstring.o lib/pool_alloc.o lib/sysacls.o @LIBOBJS@
+ lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattr.o @LIBOBJS@
ZLIBOBJ=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
--- old/compat.c
+++ new/compat.c
-@@ -64,6 +64,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -65,6 +65,8 @@ void setup_protocol(int f_out,int f_in)
preserve_gid = ++file_extra_cnt;
if (preserve_acls && !am_sender)
preserve_acls = ++file_extra_cnt;
if (!read_batch)
--- old/configure.in
+++ new/configure.in
-@@ -881,6 +881,40 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
+@@ -891,6 +891,40 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
esac
fi
--- old/flist.c
+++ new/flist.c
-@@ -42,6 +42,7 @@ extern int one_file_system;
+@@ -43,6 +43,7 @@ extern int one_file_system;
extern int copy_dirlinks;
extern int keep_dirlinks;
extern int preserve_acls;
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -864,6 +865,10 @@ static struct file_struct *recv_file_ent
+@@ -888,6 +889,10 @@ static struct file_struct *recv_file_ent
if (preserve_acls && !S_ISLNK(mode))
receive_acl(file, f);
#endif
if (S_ISREG(mode) || S_ISLNK(mode))
stats.total_size += file_length;
-@@ -1136,7 +1141,7 @@ static struct file_struct *send_file_nam
+@@ -1160,7 +1165,7 @@ static struct file_struct *send_file_nam
int flags, int filter_flags)
{
struct file_struct *file;
statx sx;
#endif
-@@ -1155,6 +1160,13 @@ static struct file_struct *send_file_nam
+@@ -1179,6 +1184,13 @@ static struct file_struct *send_file_nam
return NULL;
}
#endif
maybe_emit_filelist_progress(flist->count + flist_count_offset);
-@@ -1168,6 +1180,10 @@ static struct file_struct *send_file_nam
+@@ -1192,6 +1204,10 @@ static struct file_struct *send_file_nam
free_acl(&sx);
}
#endif
int preserve_perms = 0;
int preserve_executability = 0;
int preserve_devices = 0;
-@@ -200,6 +201,7 @@ static void print_rsync_version(enum log
+@@ -201,6 +202,7 @@ static void print_rsync_version(enum log
char const *have_inplace = "no ";
char const *hardlinks = "no ";
char const *acls = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
-@@ -219,7 +221,9 @@ static void print_rsync_version(enum log
+@@ -220,7 +222,9 @@ static void print_rsync_version(enum log
#ifdef SUPPORT_ACLS
acls = "";
#endif
#ifdef SUPPORT_LINKS
links = "";
#endif
-@@ -238,8 +242,8 @@ static void print_rsync_version(enum log
+@@ -239,8 +243,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -285,7 +289,7 @@ void usage(enum logcode F)
+@@ -286,7 +290,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
rprintf(F," -R, --relative use relative path names\n");
-@@ -310,6 +314,9 @@ void usage(enum logcode F)
+@@ -311,6 +315,9 @@ void usage(enum logcode F)
#ifdef SUPPORT_ACLS
rprintf(F," -A, --acls preserve ACLs (implies --perms)\n");
#endif
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
-@@ -433,6 +440,9 @@ static struct poptOption long_options[]
+@@ -438,6 +445,9 @@ static struct poptOption long_options[]
{"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
{"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
{"no-A", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
-@@ -1121,6 +1131,17 @@ int parse_arguments(int *argc, const cha
+@@ -1126,6 +1136,17 @@ int parse_arguments(int *argc, const cha
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
-@@ -1585,6 +1606,10 @@ void server_options(char **args,int *arg
+@@ -1590,6 +1611,10 @@ void server_options(char **args,int *arg
if (preserve_acls)
argstr[x++] = 'A';
#endif
* will enable owner-writability using chmod, if necessary.
--- old/rsync.h
+++ new/rsync.h
-@@ -551,6 +551,10 @@ struct idev_node {
+@@ -549,6 +549,10 @@ struct idev_node {
#define ACLS_NEED_MASK 1
#endif
#define GID_NONE ((gid_t)-1)
union file_extras {
-@@ -571,6 +575,7 @@ extern int file_extra_cnt;
+@@ -569,6 +573,7 @@ extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
#define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
#define EXTRA_LEN (sizeof (union file_extras))
-@@ -604,6 +609,7 @@ extern int preserve_acls;
+@@ -602,6 +607,7 @@ extern int preserve_acls;
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
/* These items are per-entry optional and mutally exclusive: */
#define F_HL_GNUM(f) OPT_EXTRA(f, LEN64_BUMP(f))->num
-@@ -795,6 +801,9 @@ typedef struct {
+@@ -793,6 +799,9 @@ typedef struct {
struct rsync_acl *acc_acl; /* access ACL */
struct rsync_acl *def_acl; /* default ACL */
#endif