if (S_ISDIR(file->mode))
--- old/compat.c
+++ new/compat.c
-@@ -147,13 +147,6 @@ void setup_protocol(int f_out,int f_in)
- protocol_version);
- exit_cleanup(RERR_PROTOCOL);
- }
+@@ -145,13 +145,6 @@ void setup_protocol(int f_out,int f_in)
+ }
+
+ if (protocol_version < 30) {
- if (preserve_acls && !local_server) {
- rprintf(FERROR,
- "--acls requires protocol 30 or higher"
--- old/compat.c
+++ new/compat.c
-@@ -43,6 +43,7 @@ extern int prune_empty_dirs;
+@@ -44,6 +44,7 @@ extern int prune_empty_dirs;
extern int protocol_version;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
extern int preserve_hard_links;
-@@ -57,7 +58,7 @@ extern char *dest_option;
+@@ -58,7 +59,7 @@ extern char *dest_option;
extern struct filter_list_struct filter_list;
/* These index values are for the file-list's extra-attribute array. */
/* The server makes sure that if either side only supports a pre-release
* version of a protocol, that both sides must speak a compatible version
-@@ -98,6 +99,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -99,6 +100,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -442,6 +447,13 @@ static void send_file_entry(int f, struc
- flags |= XMIT_SAME_TIME;
+@@ -446,6 +451,13 @@ static void send_file_entry(int f, struc
+ xflags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
+ if (atimes_ndx && !S_ISDIR(mode)) {
+ time_t file_atime = F_ATIME(file);
+ if (file_atime == atime)
-+ flags |= XMIT_SAME_ATIME;
++ xflags |= XMIT_SAME_ATIME;
+ else
+ atime = file_atime;
+ }
#ifdef SUPPORT_HARD_LINKS
if (tmp_dev != 0) {
-@@ -513,6 +525,8 @@ static void send_file_entry(int f, struc
+@@ -517,6 +529,8 @@ static void send_file_entry(int f, struc
}
- if (!(flags & XMIT_SAME_MODE))
+ if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
-+ if (atimes_ndx && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
++ if (atimes_ndx && !S_ISDIR(mode) && !(xflags & XMIT_SAME_ATIME))
+ write_varlong(f, atime, 4);
- if (uid_ndx && !(flags & XMIT_SAME_UID)) {
+ if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -599,7 +613,7 @@ static void send_file_entry(int f, struc
+@@ -603,7 +617,7 @@ static void send_file_entry(int f, struc
static struct file_struct *recv_file_entry(struct file_list *flist,
int xflags, int f)
{
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -735,6 +749,16 @@ static struct file_struct *recv_file_ent
+@@ -739,6 +753,16 @@ static struct file_struct *recv_file_ent
}
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
-@@ -863,6 +887,8 @@ static struct file_struct *recv_file_ent
+@@ -867,6 +891,8 @@ static struct file_struct *recv_file_ent
F_GROUP(file) = gid;
file->flags |= gid_flags;
}
#ifdef ICONV_OPTION
if (ic_ndx)
F_NDX(file) = flist->used + flist->ndx_start;
-@@ -1181,6 +1207,8 @@ struct file_struct *make_file(const char
+@@ -1191,6 +1217,8 @@ struct file_struct *make_file(const char
F_OWNER(file) = st.st_uid;
if (gid_ndx)
F_GROUP(file) = st.st_gid;
if (preserve_hard_links && F_IS_HLINKED(file))
finish_hard_link(file, fname, &sxp->st, itemizing, code, j);
if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
-@@ -1766,7 +1772,7 @@ static void touch_up_dirs(struct file_li
+@@ -1775,7 +1781,7 @@ static void touch_up_dirs(struct file_li
if (!(file->mode & S_IWUSR))
do_chmod(fname, file->mode);
if (need_retouch_dir_times)
c[11] = '\0';
--- old/options.c
+++ new/options.c
-@@ -56,6 +56,7 @@ int preserve_uid = 0;
+@@ -57,6 +57,7 @@ int preserve_uid = 0;
int preserve_gid = 0;
int preserve_times = 0;
int omit_dir_times = 0;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -337,6 +338,7 @@ void usage(enum logcode F)
+@@ -338,6 +339,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -471,6 +473,9 @@ static struct poptOption long_options[]
+@@ -473,6 +475,9 @@ static struct poptOption long_options[]
{"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 },
{"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
-@@ -1668,6 +1673,8 @@ void server_options(char **args,int *arg
+@@ -1675,6 +1680,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
--- old/rsync.h
+++ new/rsync.h
-@@ -56,6 +56,7 @@
+@@ -57,6 +57,7 @@
#define XMIT_RDEV_MINOR_8_pre30 (1<<11) /* protocols 28 - 29 */
#define XMIT_GROUP_NAME_FOLLOWS (1<<11) /* protocols 30 - NOW */
- #define XMIT_HLINK_FIRST (1<<12) /* protocols 30 - NOW */
+ #define XMIT_HLINK_FIRST (1<<12) /* protocols 30 - NOW (HLINKED files only) */
+#define XMIT_SAME_ATIME (1<<13) /* protocols ?? - NOW */
/* These flags are used in the live flist data. */
-@@ -143,6 +144,7 @@
+@@ -144,6 +145,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -582,6 +584,7 @@ struct file_struct {
+@@ -583,6 +585,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -619,6 +622,7 @@ extern int xattrs_ndx;
+@@ -620,6 +623,7 @@ extern int xattrs_ndx;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
#define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
#define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
-@@ -338,6 +338,7 @@ to the detailed description below for a
+@@ -353,6 +353,7 @@ to the detailed description below for a
-D same as --devices --specials
-t, --times preserve modification times
-O, --omit-dir-times omit directories from --times
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -916,6 +917,12 @@ it is preserving modification times (see
+@@ -930,6 +931,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
dit(bf(--super)) This tells the receiving side to attempt super-user
activities even if the receiving rsync wasn't run by the super-user. These
activities include: preserving users via the bf(--owner) option, preserving
-@@ -1546,8 +1553,10 @@ quote(itemization(
+@@ -1592,8 +1599,10 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
int push_pathname(const char *dir, int len)
{
if (dir == pathname)
-@@ -973,34 +1280,24 @@ static struct file_struct *recv_file_ent
+@@ -980,34 +1287,24 @@ static struct file_struct *recv_file_ent
return file;
}
char *bp;
if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) {
-@@ -1076,6 +1373,8 @@ struct file_struct *make_file(const char
+@@ -1086,6 +1383,8 @@ struct file_struct *make_file(const char
if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
if (ignore_perishable)
non_perishable_cnt++;
return NULL;
}
-@@ -1114,9 +1413,16 @@ struct file_struct *make_file(const char
+@@ -1124,9 +1423,16 @@ struct file_struct *make_file(const char
memcpy(lastdir, thisname, len);
lastdir[len] = '\0';
lastdir_len = len;
basename_len = strlen(basename) + 1; /* count the '\0' */
#ifdef SUPPORT_LINKS
-@@ -1192,11 +1498,44 @@ struct file_struct *make_file(const char
+@@ -1202,11 +1508,44 @@ struct file_struct *make_file(const char
}
#endif
/* This code is only used by the receiver when it is building
* a list of files for a delete pass. */
if (keep_dirlinks && linkname_len && flist) {
-@@ -1482,6 +1821,9 @@ static void send_directory(int f, struct
+@@ -1499,6 +1838,9 @@ static void send_directory(int f, struct
closedir(d);
if (f >= 0 && recurse && !divert_dirs) {
int i, end = flist->used - 1;
/* send_if_directory() bumps flist->used, so use "end". */
-@@ -1925,7 +2267,11 @@ struct file_list *send_file_list(int f,
+@@ -1942,7 +2284,11 @@ struct file_list *send_file_list(int f,
* file-list to check if this is a 1-file xfer. */
send_extra_file_list(f, 1);
}
return flist;
}
-@@ -2218,7 +2564,7 @@ void flist_free(struct file_list *flist)
+@@ -2235,7 +2581,7 @@ void flist_free(struct file_list *flist)
if (!flist->prev || !flist_cnt)
pool_destroy(flist->file_pool);
if (flist->sorted && flist->sorted != flist->files)
--- old/loadparm.c
+++ new/loadparm.c
-@@ -149,6 +149,7 @@ typedef struct
+@@ -152,6 +152,7 @@ typedef struct
int syslog_facility;
int timeout;
BOOL fake_super;
BOOL ignore_errors;
BOOL ignore_nonreadable;
-@@ -197,6 +198,7 @@ static service sDefault =
+@@ -200,6 +201,7 @@ static service sDefault =
/* syslog_facility; */ LOG_DAEMON,
/* timeout; */ 0,
/* fake_super; */ False,
/* ignore_errors; */ False,
/* ignore_nonreadable; */ False,
-@@ -313,6 +315,7 @@ static struct parm_struct parm_table[] =
+@@ -316,6 +318,7 @@ static struct parm_struct parm_table[] =
{"lock file", P_STRING, P_LOCAL, &sDefault.lock_file, NULL,0},
{"log file", P_STRING, P_LOCAL, &sDefault.log_file, NULL,0},
{"log format", P_STRING, P_LOCAL, &sDefault.log_format, NULL,0},
{"max connections", P_INTEGER,P_LOCAL, &sDefault.max_connections, NULL,0},
{"max verbosity", P_INTEGER,P_LOCAL, &sDefault.max_verbosity, NULL,0},
{"name", P_STRING, P_LOCAL, &sDefault.name, NULL,0},
-@@ -418,6 +421,7 @@ FN_LOCAL_BOOL(lp_fake_super, fake_super)
+@@ -421,6 +424,7 @@ FN_LOCAL_BOOL(lp_fake_super, fake_super)
FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
FN_LOCAL_BOOL(lp_list, list)
int ignore_non_existing = 0;
int need_messages_from_generator = 0;
+int checksum_updating = 0;
- int max_delete = -1;
+ int max_delete = INT_MIN;
OFF_T max_size = 0;
OFF_T min_size = 0;
-@@ -302,6 +303,7 @@ void usage(enum logcode F)
+@@ -303,6 +304,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," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -542,6 +544,7 @@ static struct poptOption long_options[]
+@@ -544,6 +546,7 @@ static struct poptOption long_options[]
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
-@@ -1899,7 +1902,9 @@ void server_options(char **args,int *arg
+@@ -1913,7 +1916,9 @@ void server_options(char **args,int *arg
args[ac++] = basis_dir[i];
}
}
args[ac++] = "--append";
--- old/rsync.h
+++ new/rsync.h
-@@ -591,6 +591,7 @@ extern int xattrs_ndx;
+@@ -592,6 +592,7 @@ extern int xattrs_ndx;
#define DEV_EXTRA_CNT 2
#define DIRNODE_EXTRA_CNT 3
#define SUM_EXTRA_CNT ((MAX_DIGEST_LEN + EXTRA_LEN - 1) / EXTRA_LEN)
#define REQ_EXTRA(f,ndx) ((union file_extras*)(f) - (ndx))
#define OPT_EXTRA(f,bump) ((union file_extras*)(f) - file_extra_cnt - 1 - (bump))
-@@ -1076,6 +1077,12 @@ isDigit(const char *ptr)
+@@ -1077,6 +1078,12 @@ isDigit(const char *ptr)
}
static inline int
return isprint(*(unsigned char *)ptr);
--- old/rsync.yo
+++ new/rsync.yo
-@@ -307,6 +307,7 @@ to the detailed description below for a
+@@ -322,6 +322,7 @@ to the detailed description below for a
-q, --quiet suppress non-error messages
--no-motd suppress daemon-mode MOTD (see caveat)
-c, --checksum skip based on checksum, not mod-time & size
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-@@ -502,9 +503,9 @@ uses a "quick check" that (by default) c
+@@ -518,9 +519,9 @@ uses a "quick check" that (by default) c
of last modification match between the sender and receiver. This option
changes this to compare a 128-bit MD4 checksum for each file that has a
matching size. Generating the checksums means that both sides will expend
The sending side generates its checksums while it is doing the file-system
scan that builds the list of the available files. The receiver generates
-@@ -512,12 +513,42 @@ its checksums when it is scanning for ch
+@@ -528,12 +529,42 @@ its checksums when it is scanning for ch
file that has the same size as the corresponding sender's file: files with
either a changed size or a changed checksum are selected for transfer.
--- old/compat.c
+++ new/compat.c
-@@ -49,6 +49,7 @@ extern int preserve_hard_links;
+@@ -50,6 +50,7 @@ extern int preserve_hard_links;
extern int need_messages_from_generator;
extern int delete_mode, delete_before, delete_during, delete_after;
extern int delete_excluded;
extern int make_backups;
extern char *shell_cmd; /* contains VER.SUB string if client is a pre-release */
extern char *backup_dir, *backup_suffix;
-@@ -209,7 +210,7 @@ void setup_protocol(int f_out,int f_in)
- } else if (protocol_version >= 30) {
+@@ -204,7 +205,7 @@ void setup_protocol(int f_out,int f_in)
if (recurse && allow_inc_recurse && !preserve_hard_links
&& !delete_before && !delete_after && !delay_updates
-- && !prune_empty_dirs && !use_qsort)
-+ && !prune_empty_dirs && !use_qsort && !detect_renamed)
+ && (!relative_paths || implied_dirs) && !use_qsort
+- && !prune_empty_dirs)
++ && !prune_empty_dirs && !detect_renamed)
inc_recurse = 1;
need_messages_from_generator = 1;
}
static void send_directory(int f, struct file_list *flist,
char *fbuf, int len, int flags);
-@@ -1912,6 +1954,25 @@ struct file_list *send_file_list(int f,
+@@ -1929,6 +1971,25 @@ struct file_list *send_file_list(int f,
if (verbose > 2)
rprintf(FINFO, "send_file_list done\n");
static int phase = 0;
static int dflt_perms;
-@@ -1289,8 +1435,12 @@ static void recv_generator(char *fname,
+@@ -1298,8 +1444,12 @@ static void recv_generator(char *fname,
}
}
else if (delete_during && f_out != -1 && !phase && dry_run < 2
goto cleanup;
}
-@@ -1562,8 +1712,14 @@ static void recv_generator(char *fname,
+@@ -1571,8 +1721,14 @@ static void recv_generator(char *fname,
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
goto cleanup;
#endif
rsyserr(FERROR, stat_errno, "recv_generator: failed to stat %s",
full_fname(fname));
goto cleanup;
-@@ -1876,6 +2032,12 @@ void generate_files(int f_out, const cha
+@@ -1885,6 +2041,12 @@ void generate_files(int f_out, const cha
if (verbose > 2)
rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
if (delete_before && !solo_file && cur_flist->used > 0)
do_delete_pass();
if (delete_during == 2) {
-@@ -1886,7 +2048,7 @@ void generate_files(int f_out, const cha
+@@ -1895,7 +2057,7 @@ void generate_files(int f_out, const cha
}
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1917,7 +2079,7 @@ void generate_files(int f_out, const cha
+@@ -1926,7 +2088,7 @@ void generate_files(int f_out, const cha
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
}
}
}
-@@ -1970,7 +2132,21 @@ void generate_files(int f_out, const cha
+@@ -1979,7 +2141,21 @@ void generate_files(int f_out, const cha
} while ((cur_flist = cur_flist->next) != NULL);
if (delete_during)
rprintf(FINFO, "generate_files phase=%d\n", phase);
--- old/options.c
+++ new/options.c
-@@ -79,6 +79,7 @@ int am_generator = 0;
+@@ -80,6 +80,7 @@ int am_generator = 0;
int am_starting_up = 1;
int relative_paths = -1;
int implied_dirs = 1;
{"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 },
-@@ -1491,7 +1494,7 @@ int parse_arguments(int *argc, const cha
+@@ -1495,7 +1498,7 @@ int parse_arguments(int *argc, const cha
inplace = 1;
}
partial_dir = tmp_partialdir;
if (inplace) {
-@@ -1500,6 +1503,7 @@ int parse_arguments(int *argc, const cha
+@@ -1504,6 +1507,7 @@ int parse_arguments(int *argc, const cha
snprintf(err_buf, sizeof err_buf,
"--%s cannot be used with --%s\n",
append_mode ? "append" : "inplace",
delay_updates ? "delay-updates" : "partial-dir");
return 0;
}
-@@ -1842,6 +1846,8 @@ void server_options(char **args,int *arg
+@@ -1844,6 +1848,8 @@ void server_options(char **args,int *arg
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0)
--- old/rsync.yo
+++ new/rsync.yo
-@@ -373,6 +373,7 @@ to the detailed description below for a
+@@ -388,6 +388,7 @@ to the detailed description below for a
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
--compare-dest=DIR also compare received files relative to DIR
--copy-dest=DIR ... and include copies of unchanged files
--link-dest=DIR hardlink to files in DIR when unchanged
-@@ -1361,6 +1362,15 @@ Note that the use of the bf(--delete) op
+@@ -1376,6 +1377,15 @@ Note that the use of the bf(--delete) op
fuzzy-match files, so either use bf(--delete-after) or specify some
filename exclusions if you need to prevent this.
--- old/compat.c
+++ new/compat.c
-@@ -43,6 +43,7 @@ extern int prune_empty_dirs;
+@@ -44,6 +44,7 @@ extern int prune_empty_dirs;
extern int protocol_version;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
extern int preserve_hard_links;
-@@ -57,7 +58,7 @@ extern char *dest_option;
+@@ -58,7 +59,7 @@ extern char *dest_option;
extern struct filter_list_struct filter_list;
/* These index values are for the file-list's extra-attribute array. */
/* The server makes sure that if either side only supports a pre-release
* version of a protocol, that both sides must speak a compatible version
-@@ -98,6 +99,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -99,6 +100,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
static dev_t rdev;
static uint32 rdev_major;
@@ -396,6 +400,12 @@ static void send_file_entry(int f, struc
- flags |= XMIT_SAME_MODE;
+ xflags |= XMIT_SAME_MODE;
else
mode = file->mode;
+#ifdef SUPPORT_FLAGS
+ if (F_FFLAGS(file) == fileflags)
-+ flags |= XMIT_SAME_FLAGS;
++ xflags |= XMIT_SAME_FLAGS;
+ else
+ fileflags = F_FFLAGS(file);
+#endif
- if ((preserve_devices && IS_DEVICE(mode))
- || (preserve_specials && IS_SPECIAL(mode))) {
- if (protocol_version < 28) {
-@@ -513,6 +523,10 @@ static void send_file_entry(int f, struc
+
+ if (protocol_version >= 30 && S_ISDIR(mode) && !(file->flags & FLAG_XFER_DIR))
+ xflags |= XMIT_NON_XFER_DIR;
+@@ -517,6 +527,10 @@ static void send_file_entry(int f, struc
}
- if (!(flags & XMIT_SAME_MODE))
+ if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
+#ifdef SUPPORT_FLAGS
-+ if (fileflags_ndx && !(flags & XMIT_SAME_FLAGS))
++ if (fileflags_ndx && !(xflags & XMIT_SAME_FLAGS))
+ write_int(f, (int)fileflags);
+#endif
- if (uid_ndx && !(flags & XMIT_SAME_UID)) {
+ if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -601,6 +615,9 @@ static struct file_struct *recv_file_ent
+@@ -605,6 +619,9 @@ static struct file_struct *recv_file_ent
{
static int64 modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -735,9 +752,12 @@ static struct file_struct *recv_file_ent
+@@ -739,9 +756,12 @@ static struct file_struct *recv_file_ent
}
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
-@@ -857,6 +877,10 @@ static struct file_struct *recv_file_ent
+@@ -861,6 +881,10 @@ static struct file_struct *recv_file_ent
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
}
file->mode = mode;
if (uid_ndx)
F_OWNER(file) = uid;
if (gid_ndx) {
-@@ -1178,6 +1202,10 @@ struct file_struct *make_file(const char
+@@ -1187,6 +1211,10 @@ struct file_struct *make_file(const char
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
}
file->mode = st.st_mode;
if (gid_ndx)
--- old/generator.c
+++ new/generator.c
-@@ -115,6 +115,14 @@ static int dir_tweaking;
- static int need_retouch_dir_times;
+@@ -116,6 +116,14 @@ static int need_retouch_dir_times;
+ static int need_retouch_dir_perms;
static const char *solo_file = NULL;
+#ifdef SUPPORT_FLAGS
/* For calling delete_item() and delete_dir_contents(). */
#define DEL_RECURSE (1<<1) /* recurse */
#define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */
-@@ -130,7 +138,6 @@ enum delret {
+@@ -131,7 +139,6 @@ enum delret {
/* Forward declaration for delete_item(). */
static enum delret delete_dir_contents(char *fname, int flags);
static int is_backup_file(char *fn)
{
int k = strlen(fn) - backup_suffix_len;
-@@ -143,17 +150,20 @@ static int is_backup_file(char *fn)
+@@ -144,17 +151,20 @@ static int is_backup_file(char *fn)
* Note that fbuf must point to a MAXPATHLEN buffer if the mode indicates it's
* a directory! (The buffer is used for recursion, but returned unchanged.)
*/
if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) {
ignore_perishable = 1;
/* If DEL_RECURSE is not set, this just reports emptiness. */
-@@ -265,7 +275,7 @@ static enum delret delete_dir_contents(c
+@@ -266,7 +276,7 @@ static enum delret delete_dir_contents(c
if (S_ISDIR(fp->mode)
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
ret = DR_NOT_EMPTY;
ret = DR_NOT_EMPTY;
}
-@@ -321,8 +331,9 @@ static int remember_delete(struct file_s
+@@ -322,8 +332,9 @@ static int remember_delete(struct file_s
while (1) {
len = snprintf(deldelay_buf + deldelay_cnt,
if ((deldelay_cnt += len) <= deldelay_size)
break;
if (deldelay_fd < 0 && !start_delete_delay_temp())
-@@ -335,7 +346,7 @@ static int remember_delete(struct file_s
+@@ -336,7 +347,7 @@ static int remember_delete(struct file_s
return 1;
}
{
static int read_pos = 0;
int j, len, mode;
-@@ -377,7 +388,7 @@ static int read_delay_line(char *buf)
+@@ -378,7 +389,7 @@ static int read_delay_line(char *buf)
bp = deldelay_buf + read_pos;
invalid_data:
rprintf(FERROR, "ERROR: invalid data in delete-delay file.\n");
return -1;
-@@ -400,15 +411,15 @@ static int read_delay_line(char *buf)
+@@ -401,15 +412,15 @@ static int read_delay_line(char *buf)
static void do_delayed_deletions(char *delbuf)
{
if (deldelay_fd >= 0)
close(deldelay_fd);
}
-@@ -475,7 +486,7 @@ static void delete_in_dir(char *fbuf, st
+@@ -476,7 +487,7 @@ static void delete_in_dir(char *fbuf, st
if (!remember_delete(fp, delbuf))
break;
} else
}
}
-@@ -1213,7 +1224,7 @@ static void recv_generator(char *fname,
+@@ -1220,7 +1231,7 @@ static void recv_generator(char *fname,
* we need to delete it. If it doesn't exist, then
* (perhaps recursively) create it. */
if (statret == 0 && !S_ISDIR(sx.st.st_mode)) {
- if (delete_item(fname, sx.st.st_mode, "directory", del_opts) != 0)
+ if (delete_item(fname, sx.st.st_mode, FF_STAT(sx.st), "directory", del_opts) != 0)
- return;
+ goto skipping_dir_contents;
statret = -1;
}
-@@ -1326,7 +1337,7 @@ static void recv_generator(char *fname,
+@@ -1352,7 +1363,7 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
goto cleanup;
} else if (basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
-@@ -1403,7 +1414,7 @@ static void recv_generator(char *fname,
+@@ -1429,7 +1440,7 @@ static void recv_generator(char *fname,
goto return_with_success;
goto cleanup;
}
goto cleanup;
} else if (basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
-@@ -1492,7 +1503,7 @@ static void recv_generator(char *fname,
+@@ -1518,7 +1529,7 @@ static void recv_generator(char *fname,
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
stat_errno = ENOENT;
--- old/options.c
+++ new/options.c
-@@ -49,6 +49,7 @@ int preserve_hard_links = 0;
+@@ -50,6 +50,7 @@ int preserve_hard_links = 0;
int preserve_acls = 0;
int preserve_xattrs = 0;
int preserve_perms = 0;
int preserve_executability = 0;
int preserve_devices = 0;
int preserve_specials = 0;
-@@ -213,6 +214,7 @@ static void print_rsync_version(enum log
+@@ -214,6 +215,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -242,6 +244,9 @@ static void print_rsync_version(enum log
+@@ -243,6 +245,9 @@ static void print_rsync_version(enum log
#ifdef ICONV_OPTION
iconv = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -255,8 +260,8 @@ static void print_rsync_version(enum log
+@@ -256,8 +261,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());
-@@ -322,6 +327,7 @@ void usage(enum logcode F)
+@@ -323,6 +328,7 @@ void usage(enum logcode F)
rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
rprintf(F," -H, --hard-links preserve hard links\n");
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
#ifdef SUPPORT_ACLS
-@@ -461,6 +467,8 @@ static struct poptOption long_options[]
+@@ -463,6 +469,8 @@ static struct poptOption long_options[]
{"perms", 'p', POPT_ARG_VAL, &preserve_perms, 1, 0, 0 },
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
{"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
{"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
-@@ -1252,6 +1260,15 @@ int parse_arguments(int *argc, const cha
+@@ -1254,6 +1262,15 @@ int parse_arguments(int *argc, const cha
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1731,6 +1748,9 @@ void server_options(char **args,int *arg
+@@ -1738,6 +1755,9 @@ void server_options(char **args,int *arg
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
static const char *default_charset(void)
{
#if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET
-@@ -269,6 +280,41 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -268,6 +279,41 @@ mode_t dest_mode(mode_t flist_mode, mode
return new_mode;
}
int set_file_attrs(const char *fname, struct file_struct *file, statx *sxp,
const char *fnamecmp, int flags)
{
-@@ -397,6 +443,15 @@ int set_file_attrs(const char *fname, st
+@@ -396,6 +442,15 @@ int set_file_attrs(const char *fname, st
}
#endif
if (verbose > 1 && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -456,6 +511,9 @@ void finish_transfer(const char *fname,
+@@ -455,6 +510,9 @@ void finish_transfer(const char *fname,
set_file_attrs(fnametmp, file, NULL, fnamecmp,
ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
-@@ -470,6 +528,9 @@ void finish_transfer(const char *fname,
+@@ -469,6 +527,9 @@ void finish_transfer(const char *fname,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
/* The file was copied, so tweak the perms of the copied file. If it
--- old/rsync.h
+++ new/rsync.h
-@@ -56,6 +56,7 @@
+@@ -57,6 +57,7 @@
#define XMIT_RDEV_MINOR_8_pre30 (1<<11) /* protocols 28 - 29 */
#define XMIT_GROUP_NAME_FOLLOWS (1<<11) /* protocols 30 - NOW */
- #define XMIT_HLINK_FIRST (1<<12) /* protocols 30 - NOW */
+ #define XMIT_HLINK_FIRST (1<<12) /* protocols 30 - NOW (HLINKED files only) */
+#define XMIT_SAME_FLAGS (1<<14) /* protocols ?? - NOW */
/* These flags are used in the live flist data. */
-@@ -405,6 +406,10 @@ enum msgcode {
+@@ -406,6 +407,10 @@ enum msgcode {
#endif
#endif
/* Find a variable that is either exactly 32-bits or longer.
* If some code depends on 32-bit truncation, it will need to
* take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -582,6 +587,7 @@ struct file_struct {
+@@ -583,6 +588,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -616,6 +622,7 @@ extern int xattrs_ndx;
+@@ -620,6 +626,7 @@ extern int xattrs_ndx;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
#define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
#define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
-@@ -327,6 +327,7 @@ to the detailed description below for a
+@@ -342,6 +342,7 @@ to the detailed description below for a
-K, --keep-dirlinks treat symlinked dir on receiver as dir
-H, --hard-links preserve hard links
-p, --perms preserve permissions
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p)
-@@ -526,7 +527,9 @@ specified, in which case bf(-r) is not i
+@@ -542,7 +543,9 @@ specified, in which case bf(-r) is not i
Note that bf(-a) bf(does not preserve hardlinks), because
finding multiply-linked files is expensive. You must separately
dit(--no-OPTION) You may turn off one or more implied options by prefixing
the option name with "no-". Not all options may be prefixed with a "no-":
-@@ -851,6 +854,13 @@ extended attributes to be the same as th
- only if the remote machine's rsync supports this option also. This is
- a non-standard option.
+@@ -865,6 +868,13 @@ dit(bf(-X, --xattrs)) This option causes
+ extended attributes to be the same as the local ones. This will work
+ only if the remote machine's rsync also supports this option.
+dit(bf(--flags)) This option causes rsync to update the change file flags
+to be the same as the source file, if your OS supports the bf(chflags)(2)
int ignore_non_existing = 0;
int need_messages_from_generator = 0;
+time_t stop_at_utime = 0;
- int max_delete = -1;
+ int max_delete = INT_MIN;
OFF_T max_size = 0;
OFF_T min_size = 0;
-@@ -405,6 +406,8 @@ void usage(enum logcode F)
+@@ -407,6 +408,8 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --bwlimit=KBPS limit I/O bandwidth; KBytes per second\n");
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
-@@ -429,7 +432,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -431,7 +434,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[] = {
-@@ -584,6 +587,8 @@ static struct poptOption long_options[]
+@@ -587,6 +590,8 @@ static struct poptOption long_options[]
{"no-numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -1196,6 +1201,36 @@ int parse_arguments(int *argc, const cha
+@@ -1198,6 +1203,36 @@ int parse_arguments(int *argc, const cha
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1802,6 +1837,15 @@ void server_options(char **args,int *arg
+@@ -1796,6 +1831,15 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
args[ac++] = backup_dir;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -404,6 +404,8 @@ to the detailed description below for a
+@@ -420,6 +420,8 @@ to the detailed description below for a
--password-file=FILE read daemon-access password from FILE
--list-only list the files instead of copying them
--bwlimit=KBPS limit I/O bandwidth; KBytes per second
--write-batch=FILE write a batched update to FILE
--only-write-batch=FILE like --write-batch but w/o updating dest
--read-batch=FILE read a batched update from FILE
-@@ -1839,6 +1841,19 @@ transfer was too fast, it will wait befo
+@@ -1892,6 +1894,19 @@ transfer was too fast, it will wait befo
result is an average transfer rate equaling the specified limit. A value
of zero specifies no limit.
section for details, and also the bf(--only-write-batch) option.
--- old/util.c
+++ new/util.c
-@@ -120,6 +120,133 @@ NORETURN void overflow_exit(const char *
+@@ -121,6 +121,133 @@ NORETURN void overflow_exit(const char *
exit_cleanup(RERR_MALLOC);
}
--- old/compat.c
+++ new/compat.c
-@@ -147,13 +147,6 @@ void setup_protocol(int f_out,int f_in)
- protocol_version);
- exit_cleanup(RERR_PROTOCOL);
- }
+@@ -144,16 +144,6 @@ void setup_protocol(int f_out,int f_in)
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+- if (protocol_version < 30) {
- if (preserve_xattrs && !local_server) {
- rprintf(FERROR,
- "--xattrs requires protocol 30 or higher"
- protocol_version);
- exit_cleanup(RERR_PROTOCOL);
- }
- }
-
+- }
+-
if (delete_mode && !(delete_before+delete_during+delete_after)) {
+ if (protocol_version < 30)
+ delete_before = 1;
--- old/xattrs.c
+++ new/xattrs.c
@@ -20,6 +20,7 @@
#include "lib/sysxattrs.h"
#ifdef SUPPORT_XATTRS
-@@ -31,6 +32,7 @@ extern int am_generator;
- extern int read_only;
+@@ -32,6 +33,7 @@ extern int read_only;
extern int list_only;
+ extern int preserve_xattrs;
extern int checksum_seed;
+extern int protocol_version;
#define RSYNC_XAL_INITIAL 5
#define RSYNC_XAL_LIST_INITIAL 100
-@@ -231,7 +233,7 @@ static int rsync_xal_get(const char *fna
+@@ -232,7 +234,7 @@ static int rsync_xal_get(const char *fna
if (!(ptr = get_xattr_data(fname, name, &datum_len, 0)))
return -1;
/* For large datums, we store a flag and a checksum. */
name_offset = 1 + MAX_DIGEST_LEN;
sum_init(checksum_seed);
-@@ -295,7 +297,7 @@ static int find_matching_xattr(item_list
+@@ -296,7 +298,7 @@ static int find_matching_xattr(item_list
|| rxas1[j].datum_len != rxas2[j].datum_len
|| strcmp(rxas1[j].name, rxas2[j].name))
break;
if (memcmp(rxas1[j].datum + 1,
rxas2[j].datum + 1,
MAX_DIGEST_LEN) != 0)
-@@ -332,34 +334,43 @@ int send_xattr(statx *sxp, int f)
+@@ -333,34 +335,43 @@ int send_xattr(statx *sxp, int f)
{
int ndx = find_matching_xattr(sxp->xattr);
write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN);
else
write_buf(f, rxa->datum, rxa->datum_len);
-@@ -409,7 +420,7 @@ int xattr_diff(struct file_struct *file,
+@@ -410,7 +421,7 @@ int xattr_diff(struct file_struct *file,
cmp = rec_cnt ? strcmp(snd_rxa->name, rec_rxa->name) : -1;
if (cmp > 0)
same = 0;
same = cmp == 0 && snd_rxa->datum_len == rec_rxa->datum_len
&& memcmp(snd_rxa->datum + 1, rec_rxa->datum + 1,
MAX_DIGEST_LEN) == 0;
-@@ -452,6 +463,9 @@ void send_xattr_request(const char *fnam
+@@ -453,6 +464,9 @@ void send_xattr_request(const char *fnam
int j, cnt, prior_req = -1;
rsync_xa *rxa;
lst += F_XATTR(file);
cnt = lst->count;
for (rxa = lst->items, j = 0; j < cnt; rxa++, j++) {
-@@ -523,6 +537,9 @@ void recv_xattr_request(struct file_stru
+@@ -524,6 +538,9 @@ void recv_xattr_request(struct file_stru
rsync_xa *rxa;
int rel_pos, cnt;
if (F_XATTR(file) < 0) {
rprintf(FERROR, "recv_xattr_request: internal data error!\n");
exit_cleanup(RERR_STREAMIO);
-@@ -569,7 +586,22 @@ void receive_xattr(struct file_struct *f
+@@ -570,7 +587,22 @@ void receive_xattr(struct file_struct *f
{
static item_list temp_xattr = EMPTY_ITEM_LIST;
int count;
if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) {
rprintf(FERROR, "receive_xattr: xa index %d out of"
-@@ -582,7 +614,7 @@ void receive_xattr(struct file_struct *f
+@@ -583,7 +615,7 @@ void receive_xattr(struct file_struct *f
return;
}
(void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
temp_xattr.count = 0;
}
-@@ -590,9 +622,10 @@ void receive_xattr(struct file_struct *f
+@@ -591,9 +623,10 @@ void receive_xattr(struct file_struct *f
while (count--) {
char *ptr, *name;
rsync_xa *rxa;