./configure
make
-based-on: 3b8f8192227b14e708bf535072485e50f4362270
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
# Programs we must have to run the test cases
CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
-@@ -108,7 +108,7 @@ getgroups$(EXEEXT): getgroups.o
+@@ -111,7 +111,7 @@ getgroups$(EXEEXT): getgroups.o
getfsdev$(EXEEXT): getfsdev.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
-@@ -42,9 +42,11 @@ extern int checksum_seed;
+@@ -41,9 +41,11 @@ extern int checksum_seed;
extern int basis_dir_cnt;
extern int prune_empty_dirs;
extern int protocol_version;
extern int preserve_acls;
extern int preserve_xattrs;
extern int need_messages_from_generator;
-@@ -62,7 +64,7 @@ extern char *iconv_opt;
+@@ -61,7 +63,7 @@ extern char *iconv_opt;
#endif
/* These index values are for the file-list's extra-attribute array. */
int receiver_symlink_times = 0; /* receiver can set the time on a symlink */
int sender_symlink_iconv = 0; /* sender should convert symlink content */
-@@ -139,6 +141,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -138,6 +140,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
-@@ -574,7 +574,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
+@@ -589,7 +589,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
- strerror putenv iconv_open locale_charset nl_langinfo getxattr \
+ seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
- initgroups utimensat)
+ initgroups utimensat chflags)
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -51,6 +51,7 @@ extern int preserve_links;
+@@ -50,6 +50,7 @@ extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
extern int preserve_specials;
+extern int preserve_fileflags;
+ extern int delete_during;
extern int missing_args;
extern int uid_ndx;
- extern int gid_ndx;
-@@ -407,6 +408,9 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -408,6 +409,9 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
{
static time_t modtime;
static mode_t mode;
#ifdef SUPPORT_HARD_LINKS
static int64 dev;
#endif
-@@ -450,6 +454,14 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -451,6 +455,14 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
xflags |= XMIT_SAME_MODE;
else
mode = file->mode;
if (preserve_devices && IS_DEVICE(mode)) {
if (protocol_version < 28) {
-@@ -591,6 +603,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -592,6 +604,10 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
write_varint(f, F_MOD_NSEC(file));
if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -678,6 +694,9 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
+@@ -679,6 +695,9 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
{
static int64 modtime;
static mode_t mode;
#ifdef SUPPORT_HARD_LINKS
static int64 dev;
#endif
-@@ -823,6 +842,10 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
+@@ -824,6 +843,10 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
if (chmod_modes && !S_ISLNK(mode) && mode)
mode = tweak_mode(mode, chmod_modes);
if (preserve_uid && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
-@@ -974,6 +997,10 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
+@@ -975,6 +998,10 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
}
#endif
file->mode = mode;
if (preserve_uid)
F_OWNER(file) = uid;
if (preserve_gid) {
-@@ -1371,6 +1398,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1372,6 +1399,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
}
#endif
file->mode = st.st_mode;
extern int uid_ndx;
extern int gid_ndx;
extern int delete_mode;
-@@ -407,6 +409,11 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -405,6 +407,11 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
&& ((sxp->st.st_mode & 0111 ? 1 : 0) ^ (file->mode & 0111 ? 1 : 0)))
return 0;
if (am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file))
return 0;
-@@ -472,6 +479,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -470,6 +477,11 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
&& sxp->st.st_gid != (gid_t)F_GROUP(file))
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
if (!ACL_READY(*sxp))
-@@ -1266,6 +1278,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1264,6 +1276,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
file->mode = dest_mode(file->mode, sx.st.st_mode,
dflt_perms, statret == 0);
}
if (statret != 0 && basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
itemizing, code);
-@@ -1306,10 +1322,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1304,10 +1320,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
/* We need to ensure that the dirs in the transfer have writable
* permissions during the time we are putting files within them.
* This is then fixed after the transfer is done. */
rsyserr(FERROR_XFER, errno,
"failed to modify permissions on %s",
full_fname(fname));
-@@ -1344,6 +1365,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1342,6 +1363,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
exists);
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
-@@ -1918,13 +1943,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -1919,13 +1944,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
continue;
fname = f_name(file, NULL);
- if (!(file->mode & S_IWUSR))
+ if (fix_dir_perms)
- do_chmod(fname, file->mode);
+ do_chmod(fname, file->mode, 0);
if (need_retouch_dir_times) {
+#endif
if (counter >= loopchk_limit) {
if (allowed_lull)
- maybe_send_keepalive();
+ maybe_send_keepalive(time(NULL), True);
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -715,7 +715,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
+@@ -733,7 +733,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
{"ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 1, 0, 0 },
{"no-ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 },
-@@ -2401,6 +2427,9 @@ void server_options(char **args, int *argc_p)
+@@ -2435,6 +2461,9 @@ void server_options(char **args, int *argc_p)
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) {
if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0)
goto oom;
-@@ -2488,6 +2517,16 @@ void server_options(char **args, int *argc_p)
+@@ -2522,6 +2551,16 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--delete-excluded";
if (force_delete)
args[ac++] = "--force";
extern int preserve_executability;
extern int preserve_times;
extern int am_root;
-@@ -428,6 +429,39 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
+@@ -445,6 +446,39 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
return new_mode;
}
int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
const char *fnamecmp, int flags)
{
-@@ -476,7 +510,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -493,7 +527,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
flags |= ATTRS_SKIP_MTIME;
if (!(flags & ATTRS_SKIP_MTIME)
&& cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
if (ret < 0) {
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
full_fname(fname));
-@@ -512,7 +546,8 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -529,7 +563,8 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
if (am_root >= 0) {
if (do_lchown(fname,
change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid,
/* We shouldn't have attempted to change uid
* or gid unless have the privilege. */
rsyserr(FERROR_XFER, errno, "%s %s failed",
-@@ -546,7 +581,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -563,7 +598,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
#ifdef HAVE_CHMOD
if (!BITS_EQUAL(sxp->st.st_mode, new_mode, CHMOD_BITS)) {
if (ret < 0) {
rsyserr(FERROR_XFER, errno,
"failed to set permissions on %s",
-@@ -558,6 +593,19 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -575,6 +610,19 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
}
#endif
if (INFO_GTE(NAME, 2) && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -622,7 +670,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -639,7 +687,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
/* move tmp file over real file */
if (DEBUG_GTE(RECV, 1))
-@@ -641,6 +690,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -658,6 +707,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
/* These flags are used in the live flist data. */
-@@ -158,6 +159,7 @@
+@@ -160,6 +161,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -184,6 +186,7 @@
+@@ -186,6 +188,7 @@
#define ITEM_REPORT_GROUP (1<<6)
#define ITEM_REPORT_ACL (1<<7)
#define ITEM_REPORT_XATTR (1<<8)
#define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
#define ITEM_XNAME_FOLLOWS (1<<12)
#define ITEM_IS_NEW (1<<13)
-@@ -490,6 +493,28 @@ typedef unsigned int size_t;
+@@ -494,6 +497,28 @@ typedef unsigned int size_t;
#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. */
-@@ -660,6 +685,7 @@ extern int file_extra_cnt;
+@@ -664,6 +689,7 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -701,6 +727,11 @@ extern int xattrs_ndx;
+@@ -705,6 +731,11 @@ 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
bf(--recursive) option was also enabled.
dit(bf(--max-delete=NUM)) This tells rsync not to delete more than NUM
-@@ -1874,7 +1903,7 @@ with older versions of rsync, but that also turns on the output of other
+@@ -1889,7 +1918,7 @@ with older versions of rsync, but that also turns on the output of other
verbose messages).
The "%i" escape has a cryptic output that is 11 letters long. The general
type of update being done, bf(X) is replaced by the file-type, and the
other letters represent attributes that may be output if they are being
modified.
-@@ -1930,7 +1959,7 @@ quote(itemization(
+@@ -1945,7 +1974,7 @@ 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).