extern int relative_paths;
extern int implied_dirs;
extern int file_extra_cnt;
-@@ -148,6 +149,7 @@ void show_flist_stats(void)
+@@ -154,6 +155,7 @@ void show_flist_stats(void)
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
double len;
if (!F_IS_ACTIVE(f)) {
-@@ -162,14 +164,16 @@ static void list_file_entry(struct file_
+@@ -168,14 +170,16 @@ static void list_file_entry(struct file_
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
f_name(f, NULL));
}
}
-@@ -333,6 +337,7 @@ int push_flist_dir(const char *dir, int
+@@ -339,6 +343,7 @@ int push_pathname(const char *dir, int l
static void send_file_entry(int f, struct file_struct *file, int ndx)
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -400,6 +405,13 @@ static void send_file_entry(int f, struc
+@@ -434,6 +439,13 @@ static void send_file_entry(int f, struc
flags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
#ifdef SUPPORT_HARD_LINKS
if (tmp_dev != 0) {
-@@ -471,6 +483,8 @@ static void send_file_entry(int f, struc
+@@ -505,6 +517,8 @@ static void send_file_entry(int f, struc
}
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -557,7 +571,7 @@ static void send_file_entry(int f, struc
+@@ -591,7 +605,7 @@ static void send_file_entry(int f, struc
static struct file_struct *recv_file_entry(struct file_list *flist,
int flags, int f)
{
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -666,6 +680,16 @@ static struct file_struct *recv_file_ent
+@@ -725,6 +739,16 @@ static struct file_struct *recv_file_ent
}
if (!(flags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
-@@ -790,6 +814,8 @@ static struct file_struct *recv_file_ent
+@@ -850,6 +874,8 @@ static struct file_struct *recv_file_ent
F_OWNER(file) = uid;
if (preserve_gid)
F_GROUP(file) = gid;
+ if (preserve_atimes)
+ F_ATIME(file) = (time_t)atime;
-
- if (basename != thisname) {
- file->dirname = lastdir;
-@@ -1099,6 +1125,8 @@ struct file_struct *make_file(const char
+ #ifdef ICONV_OPTION
+ if (ic_ndx)
+ F_NDX(file) = flist->count + flist->ndx_start;
+@@ -1163,6 +1189,8 @@ struct file_struct *make_file(const char
F_OWNER(file) = st.st_uid;
if (preserve_gid)
F_GROUP(file) = st.st_gid;
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
-@@ -561,6 +562,9 @@ void itemize(const char *fnamecmp, struc
+@@ -563,6 +564,9 @@ void itemize(const char *fnamecmp, struc
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
|| (keep_time && cmp_time(file->modtime, sxp->st.st_mtime) != 0))
iflags |= ITEM_REPORT_TIME;
if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
if (preserve_uid && am_root && F_UID(file) != sxp->st.st_uid)
-@@ -878,6 +882,8 @@ static int try_dests_reg(struct file_str
+@@ -880,6 +884,8 @@ static int try_dests_reg(struct file_str
if (link_dest) {
if (!hard_link_one(file, fname, cmpbuf, 1))
goto try_a_copy;
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)) {
-@@ -1741,7 +1747,7 @@ static void touch_up_dirs(struct file_li
+@@ -1743,7 +1749,7 @@ static void touch_up_dirs(struct file_li
if (!(file->mode & S_IWUSR))
do_chmod(fname, file->mode);
if (need_retouch_dir_times)
else if (!(j % 200))
--- old/log.c
+++ new/log.c
-@@ -36,6 +36,7 @@ extern int msg_fd_out;
+@@ -34,6 +34,7 @@ extern int msg_fd_out;
extern int allow_8bit_chars;
extern int protocol_version;
extern int preserve_times;
extern int preserve_uid;
extern int preserve_gid;
extern int stdout_format_has_i;
-@@ -624,7 +625,8 @@ static void log_formatted(enum logcode c
+@@ -630,7 +631,8 @@ static void log_formatted(enum logcode c
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -325,8 +326,9 @@ void usage(enum logcode F)
+@@ -334,8 +335,9 @@ void usage(enum logcode F)
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -456,6 +458,9 @@ static struct poptOption long_options[]
+@@ -468,6 +470,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 },
-@@ -1617,6 +1622,8 @@ void server_options(char **args,int *arg
+@@ -1652,6 +1657,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
else if (preserve_executability && am_sender)
--- old/rsync.c
+++ new/rsync.c
-@@ -35,6 +35,7 @@ extern int preserve_acls;
+@@ -32,6 +32,7 @@ extern int preserve_acls;
extern int preserve_xattrs;
extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
extern int omit_dir_times;
extern int am_root;
-@@ -224,6 +225,7 @@ int set_file_attrs(const char *fname, st
+@@ -271,6 +272,7 @@ int set_file_attrs(const char *fname, st
int updated = 0;
statx sx2;
int change_uid, change_gid;
mode_t new_mode = file->mode;
if (!sxp) {
-@@ -261,18 +263,36 @@ int set_file_attrs(const char *fname, st
+@@ -308,18 +310,36 @@ int set_file_attrs(const char *fname, st
set_stat_xattr(fname, file);
#endif
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -573,6 +575,7 @@ struct file_struct {
+@@ -582,6 +584,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
-@@ -607,6 +610,7 @@ extern int preserve_xattrs;
+@@ -616,6 +619,7 @@ extern int preserve_xattrs;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
+#define F_ATIME(f) REQ_EXTRA(f, preserve_atimes)->unum
#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->num
#define F_XATTR(f) REQ_EXTRA(f, preserve_xattrs)->num
-
+ #define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
@@ -330,8 +330,9 @@ to the detailed description below for a
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -909,6 +910,12 @@ it is preserving modification times (see
+@@ -910,6 +911,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
-@@ -1523,7 +1530,7 @@ quote(itemization(
+@@ -1524,7 +1531,7 @@ quote(itemization(
by the file transfer.
it() A bf(t) means the modification time is different and is being updated
to the sender's value (requires bf(--times)). An alternate value of bf(T)
anytime a symlink is transferred, or when a file or device is transferred
without bf(--times).
it() A bf(p) means the permissions are different and are being updated to
-@@ -1532,8 +1539,10 @@ quote(itemization(
+@@ -1533,8 +1540,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).
+exit 0
--- old/testsuite/rsync.fns
+++ new/testsuite/rsync.fns
-@@ -184,6 +184,10 @@ checkit() {
+@@ -186,6 +186,10 @@ checkit() {
# We can just write everything to stdout/stderr, because the
# wrapper hides it unless there is a problem.
echo "Running: \"$1\""
eval "$1"
status=$?
-@@ -191,10 +195,13 @@ checkit() {
+@@ -193,10 +197,13 @@ checkit() {
failed="YES";
fi
--- old/tls.c
+++ new/tls.c
-@@ -94,6 +94,8 @@ static int stat_xattr(const char *fname,
- return 0;
- }
+@@ -98,6 +98,8 @@ static int stat_xattr(const char *fname,
+
+ #endif
+static int display_atime = 0;
+
static void failed(char const *what, char const *where)
{
fprintf(stderr, PROGRAM ": %s %s: %s\n",
-@@ -101,12 +103,29 @@ static void failed(char const *what, cha
+@@ -105,12 +107,29 @@ static void failed(char const *what, cha
exit(1);
}
char linkbuf[4096];
if (do_lstat(fname, &buf) < 0)
-@@ -141,19 +160,8 @@ static void list_file(const char *fname)
+@@ -147,19 +166,8 @@ static void list_file(const char *fname)
permstring(permbuf, buf.st_mode);
/* TODO: Perhaps escape special characters in fname? */
-@@ -164,13 +172,15 @@ static void list_file(const char *fname)
+@@ -170,13 +178,15 @@ static void list_file(const char *fname)
(long)minor(buf.st_rdev));
} else /* NB: use double for size since it might not fit in a long. */
printf("%12.0f", (double)buf.st_size);
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
+ {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
+ #ifdef SUPPORT_XATTRS
{"fake-super", 'f', POPT_ARG_VAL, &am_root, -1, 0, 0 },
- {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 },
- {0,0,0,0,0,0,0}
-@@ -182,6 +192,7 @@ static void tls_usage(int ret)
+ #endif
+@@ -190,6 +200,7 @@ static void tls_usage(int ret)
fprintf(F,"usage: " PROGRAM " [OPTIONS] FILE ...\n");
fprintf(F,"Trivial file listing program for portably checking rsync\n");
fprintf(F,"\nOptions:\n");
+ rprintf(F," -U, --atimes display access (last-used) times\n");
+ #ifdef SUPPORT_XATTRS
fprintf(F," -f, --fake-super display attributes including fake-super xattrs\n");
- fprintf(F," -h, --help show this help\n");
- exit(ret);
+ #endif
--- old/util.c
+++ new/util.c
@@ -120,7 +120,7 @@ NORETURN void overflow_exit(const char *
extern int preserve_uid;
extern int preserve_gid;
extern int relative_paths;
-@@ -354,6 +355,9 @@ static void send_file_entry(int f, struc
+@@ -340,6 +341,9 @@ static void send_file_entry(int f, struc
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -374,6 +378,12 @@ static void send_file_entry(int f, struc
+@@ -388,6 +392,12 @@ static void send_file_entry(int f, struc
flags |= XMIT_SAME_MODE;
else
mode = file->mode;
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
if (protocol_version < 28) {
-@@ -491,6 +501,10 @@ static void send_file_entry(int f, struc
+@@ -505,6 +515,10 @@ static void send_file_entry(int f, struc
}
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -579,6 +593,9 @@ static struct file_struct *recv_file_ent
+@@ -593,6 +607,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;
-@@ -686,9 +703,12 @@ static struct file_struct *recv_file_ent
+@@ -725,9 +742,12 @@ static struct file_struct *recv_file_ent
}
if (!(flags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (protocol_version < 30)
-@@ -806,6 +826,10 @@ static struct file_struct *recv_file_ent
+@@ -846,6 +866,10 @@ static struct file_struct *recv_file_ent
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
}
file->mode = mode;
if (preserve_uid)
F_OWNER(file) = uid;
if (preserve_gid)
-@@ -1115,6 +1139,10 @@ struct file_struct *make_file(const char
+@@ -1159,6 +1183,10 @@ struct file_struct *make_file(const char
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
}
file->mode = st.st_mode;
if (preserve_gid)
--- old/generator.c
+++ new/generator.c
-@@ -112,6 +112,14 @@ static int dir_tweaking;
+@@ -115,6 +115,14 @@ static int dir_tweaking;
static int need_retouch_dir_times;
static const char *solo_file = NULL;
/* 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 */
-@@ -127,7 +135,6 @@ enum delret {
+@@ -130,7 +138,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;
-@@ -140,17 +147,20 @@ static int is_backup_file(char *fn)
+@@ -143,17 +150,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. */
-@@ -262,7 +272,7 @@ static enum delret delete_dir_contents(c
+@@ -265,7 +275,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;
}
-@@ -318,8 +328,9 @@ static int remember_delete(struct file_s
+@@ -321,8 +331,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())
-@@ -332,7 +343,7 @@ static int remember_delete(struct file_s
+@@ -335,7 +346,7 @@ static int remember_delete(struct file_s
return 1;
}
{
static int read_pos = 0;
int j, len, mode;
-@@ -374,7 +385,7 @@ static int read_delay_line(char *buf)
+@@ -377,7 +388,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;
-@@ -397,15 +408,15 @@ static int read_delay_line(char *buf)
+@@ -400,15 +411,15 @@ static int read_delay_line(char *buf)
static void do_delayed_deletions(char *delbuf)
{
if (deldelay_fd >= 0)
close(deldelay_fd);
}
-@@ -473,7 +484,7 @@ static void delete_in_dir(struct file_li
+@@ -475,7 +486,7 @@ static void delete_in_dir(char *fbuf, st
if (!remember_delete(fp, delbuf))
break;
} else
}
}
-@@ -1211,7 +1222,7 @@ static void recv_generator(char *fname,
+@@ -1213,7 +1224,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)) {
return;
statret = -1;
}
-@@ -1324,7 +1335,7 @@ static void recv_generator(char *fname,
+@@ -1326,7 +1337,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,
-@@ -1401,7 +1412,7 @@ static void recv_generator(char *fname,
+@@ -1403,7 +1414,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,
-@@ -1490,7 +1501,7 @@ static void recv_generator(char *fname,
+@@ -1492,7 +1503,7 @@ static void recv_generator(char *fname,
fnamecmp_type = FNAMECMP_FNAME;
if (statret == 0 && !S_ISREG(sx.st.st_mode)) {
int preserve_executability = 0;
int preserve_devices = 0;
int preserve_specials = 0;
-@@ -206,6 +207,7 @@ static void print_rsync_version(enum log
- char const *xattrs = "no ";
+@@ -212,6 +213,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
+ char const *iconv = "no ";
char const *ipv6 = "no ";
+ char const *fileflags = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -232,6 +234,9 @@ static void print_rsync_version(enum log
- #ifdef INET6
- ipv6 = "";
+@@ -241,6 +243,9 @@ static void print_rsync_version(enum log
+ #ifdef ICONV_OPTION
+ iconv = "";
#endif
+#ifdef SUPPORT_FLAGS
+ fileflags = "";
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -245,8 +250,8 @@ static void print_rsync_version(enum log
+@@ -254,8 +259,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);
-- rprintf(f, " %sappend, %sACLs, %sxattrs\n",
-- have_inplace, acls, xattrs);
-+ rprintf(f, " %sappend, %sACLs, %sxattrs, %sfile-flags\n",
-+ have_inplace, acls, xattrs, fileflags);
+- rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv\n",
+- have_inplace, acls, xattrs, iconv);
++ rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv, %sfile-flags\n",
++ have_inplace, acls, xattrs, iconv, fileflags);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -312,6 +317,7 @@ void usage(enum logcode F)
+@@ -321,6 +326,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
-@@ -443,6 +449,8 @@ static struct poptOption long_options[]
+@@ -458,6 +464,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 },
-@@ -1189,6 +1197,15 @@ int parse_arguments(int *argc, const cha
+@@ -1236,6 +1244,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");
-@@ -1665,6 +1682,9 @@ void server_options(char **args,int *arg
+@@ -1712,6 +1729,9 @@ void server_options(char **args,int *arg
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
goto oom;
--- old/rsync.c
+++ new/rsync.c
-@@ -34,6 +34,7 @@ extern int dry_run;
+@@ -31,6 +31,7 @@ extern int dry_run;
extern int preserve_acls;
extern int preserve_xattrs;
extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
extern int omit_dir_times;
-@@ -54,6 +55,16 @@ extern int make_backups;
- extern struct file_list *cur_flist, *first_flist, *dir_flist;
- extern struct chmod_mode_struct *daemon_chmod_modes;
+@@ -61,6 +62,16 @@ iconv_t ic_send = (iconv_t)-1, ic_recv =
+ int ic_ndx;
+ #endif
+#ifdef SUPPORT_FLAGS
+#ifndef UF_NOUNLINK
+#define NOCHANGE_FLAGS (UF_IMMUTABLE|UF_APPEND|UF_NOUNLINK|SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK)
+#endif
+
- #if defined HAVE_ICONV_OPEN && defined HAVE_ICONV_H
- iconv_t ic_chck = (iconv_t)-1;
-
-@@ -218,6 +229,41 @@ mode_t dest_mode(mode_t flist_mode, mode
+ static const char *default_charset(void)
+ {
+ #if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET
+@@ -265,6 +276,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)
{
-@@ -344,6 +390,15 @@ int set_file_attrs(const char *fname, st
+@@ -395,6 +441,15 @@ int set_file_attrs(const char *fname, st
}
#endif
if (verbose > 1 && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -403,6 +458,9 @@ void finish_transfer(const char *fname,
+@@ -454,6 +509,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);
-@@ -417,6 +475,9 @@ void finish_transfer(const char *fname,
+@@ -468,6 +526,9 @@ void finish_transfer(const char *fname,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
/* These flags are used in the live flist data. */
-@@ -394,6 +395,10 @@ enum msgcode {
+@@ -403,6 +404,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. */
-@@ -573,6 +578,7 @@ struct file_struct {
+@@ -582,6 +587,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
-@@ -607,6 +613,7 @@ extern int preserve_xattrs;
+@@ -616,6 +622,7 @@ extern int preserve_xattrs;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
+#define F_FFLAGS(f) REQ_EXTRA(f, preserve_fileflags)->unum
#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->num
#define F_XATTR(f) REQ_EXTRA(f, preserve_xattrs)->num
-
+ #define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
@@ -321,6 +321,7 @@ to the detailed description below for a
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p)
-@@ -518,7 +519,9 @@ specified, in which case bf(-r) is not i
+@@ -520,7 +521,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-":
-@@ -843,6 +846,13 @@ extended attributes to be the same as th
+@@ -845,6 +848,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.
transfer. The resulting value is treated as though it was the permissions
--- old/syscall.c
+++ new/syscall.c
-@@ -152,6 +152,15 @@ int do_chmod(const char *path, mode_t mo
+@@ -162,6 +162,15 @@ int do_chmod(const char *path, mode_t mo
}
#endif
-OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
+OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@ @SSL_OBJS@
- TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o
+ TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
--- old/cleanup.c
+++ new/cleanup.c
return -1;
}
-@@ -784,6 +832,9 @@ int start_daemon(int f_in, int f_out)
+@@ -789,6 +837,9 @@ int start_daemon(int f_in, int f_out)
if (protocol_version > remote_protocol)
protocol_version = remote_protocol;
line[0] = 0;
if (!read_line(f_in, line, sizeof line - 1))
return -1;
-@@ -795,6 +846,20 @@ int start_daemon(int f_in, int f_out)
+@@ -800,6 +851,20 @@ int start_daemon(int f_in, int f_out)
return -1;
}
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -206,6 +214,7 @@ static void print_rsync_version(enum log
- char const *xattrs = "no ";
+@@ -212,6 +220,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
+ char const *iconv = "no ";
char const *ipv6 = "no ";
+ char const *ssl = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -232,6 +241,9 @@ static void print_rsync_version(enum log
- #ifdef INET6
- ipv6 = "";
+@@ -241,6 +250,9 @@ static void print_rsync_version(enum log
+ #ifdef ICONV_OPTION
+ iconv = "";
#endif
+#ifdef HAVE_OPENSSL
+ ssl = "";
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -245,8 +257,8 @@ static void print_rsync_version(enum log
+@@ -254,8 +266,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);
-- rprintf(f, " %sappend, %sACLs, %sxattrs\n",
-- have_inplace, acls, xattrs);
-+ rprintf(f, " %sappend, %sACLs, %sxattrs, %sSSL\n",
-+ have_inplace, acls, xattrs, ssl);
+- rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv\n",
+- have_inplace, acls, xattrs, iconv);
++ rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv, %sSSL\n",
++ have_inplace, acls, xattrs, iconv, ssl);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -400,6 +412,13 @@ void usage(enum logcode F)
+@@ -415,6 +427,13 @@ void usage(enum logcode F)
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
#endif
rprintf(F," --version print version number\n");
rprintf(F,"(-h) --help show this help (-h works with no other options)\n");
-@@ -413,7 +432,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -428,7 +447,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[] = {
-@@ -571,6 +590,13 @@ static struct poptOption long_options[]
+@@ -590,6 +609,13 @@ static struct poptOption long_options[]
{"checksum-seed", 0, POPT_ARG_INT, &checksum_seed, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, 0, OPT_SERVER, 0, 0 },
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER, 0, 0 },
/* All the following options switch us into daemon-mode option-parsing. */
{"config", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
{"daemon", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
-@@ -598,6 +624,13 @@ static void daemon_usage(enum logcode F)
+@@ -617,6 +643,13 @@ static void daemon_usage(enum logcode F)
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
#endif
rprintf(F," --help show this help screen\n");
rprintf(F,"\n");
-@@ -624,6 +657,13 @@ static struct poptOption long_daemon_opt
+@@ -643,6 +676,13 @@ static struct poptOption long_daemon_opt
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, &am_server, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
{"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
{"no-verbose", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"no-v", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
-@@ -883,6 +923,12 @@ int parse_arguments(int *argc, const cha
+@@ -913,6 +953,12 @@ int parse_arguments(int *argc, const cha
verbose++;
break;
default:
rprintf(FERROR,
"rsync: %s: %s (in daemon mode)\n",
-@@ -906,6 +952,17 @@ int parse_arguments(int *argc, const cha
+@@ -936,6 +982,17 @@ int parse_arguments(int *argc, const cha
exit_cleanup(RERR_SYNTAX);
}
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
am_starting_up = 0;
-@@ -1150,6 +1207,12 @@ int parse_arguments(int *argc, const cha
+@@ -1180,6 +1237,12 @@ int parse_arguments(int *argc, const cha
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1428,6 +1491,17 @@ int parse_arguments(int *argc, const cha
+@@ -1475,6 +1538,17 @@ int parse_arguments(int *argc, const cha
if (delay_updates && !partial_dir)
partial_dir = tmp_partialdir;
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -1868,10 +1942,27 @@ char *check_for_hostspec(char *s, char *
+@@ -1928,10 +2002,27 @@ char *check_for_hostspec(char *s, char *
char *p;
int not_host;
int hostlen;
#define BACKUP_SUFFIX "~"
-@@ -479,6 +480,11 @@ enum msgcode {
+@@ -488,6 +489,11 @@ enum msgcode {
# define SIZEOF_INT64 SIZEOF_OFF_T
#endif
+int preallocate_files = 0;
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
- int am_root = 0;
-@@ -206,6 +207,7 @@ static void print_rsync_version(enum log
- char const *xattrs = "no ";
+ int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
+@@ -212,6 +213,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
+ char const *iconv = "no ";
char const *ipv6 = "no ";
+ char const *preallocation = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -232,6 +234,9 @@ static void print_rsync_version(enum log
- #ifdef INET6
- ipv6 = "";
+@@ -241,6 +243,9 @@ static void print_rsync_version(enum log
+ #ifdef ICONV_OPTION
+ iconv = "";
#endif
+#ifdef SUPPORT_PREALLOCATION
+ preallocation = "";
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -245,8 +250,8 @@ static void print_rsync_version(enum log
+@@ -254,8 +259,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);
-- rprintf(f, " %sappend, %sACLs, %sxattrs\n",
-- have_inplace, acls, xattrs);
-+ rprintf(f, " %sappend, %sACLs, %sxattrs, %spreallocation\n",
-+ have_inplace, acls, xattrs, preallocation);
+- rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv\n",
+- have_inplace, acls, xattrs, iconv);
++ rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv, %spreallocation\n",
++ have_inplace, acls, xattrs, iconv, preallocation);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -329,6 +334,9 @@ void usage(enum logcode F)
- rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
- rprintf(F," --super receiver attempts super-user activities\n");
+@@ -341,6 +346,9 @@ void usage(enum logcode F)
+ rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
+ #endif
rprintf(F," -S, --sparse handle sparse files efficiently\n");
+#ifdef SUPPORT_PREALLOCATION
+ rprintf(F," --preallocate posix_fallocate dest files before writing them\n");
rprintf(F," -n, --dry-run show what would have been transferred\n");
rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
-@@ -496,6 +504,7 @@ static struct poptOption long_options[]
+@@ -512,6 +520,7 @@ static struct poptOption long_options[]
{"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
{"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
{"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
{"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 },
-@@ -1189,6 +1198,15 @@ int parse_arguments(int *argc, const cha
+@@ -1236,6 +1245,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");
-@@ -1849,6 +1867,9 @@ void server_options(char **args,int *arg
+@@ -1909,6 +1927,9 @@ void server_options(char **args,int *arg
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
if (do_progress)
--- old/rsync.h
+++ new/rsync.h
-@@ -554,6 +554,10 @@ struct idev_node {
+@@ -563,6 +563,10 @@ struct idev_node {
#define ACLS_NEED_MASK 1
#endif
union file_extras {
--- old/rsync.yo
+++ new/rsync.yo
-@@ -334,6 +334,7 @@ to the detailed description below for a
- -O, --omit-dir-times omit directories when preserving times
+@@ -335,6 +335,7 @@ to the detailed description below for a
--super receiver attempts super-user activities
+ --fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
+ --preallocate posix_fallocate dest files before writing
-n, --dry-run show what would have been transferred
-W, --whole-file copy files whole (without rsync algorithm)
-x, --one-file-system don't cross filesystem boundaries
-@@ -926,6 +927,19 @@ NOTE: Don't use this option when the des
+@@ -956,6 +957,19 @@ NOTE: Don't use this option when the des
filesystem. It doesn't seem to handle seeks over null regions
correctly and ends up corrupting the files.
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
-@@ -70,7 +72,7 @@ install-strip:
+@@ -72,7 +74,7 @@ install-strip:
$(MAKE) INSTALL_STRIP='-s' install
rsync$(EXEEXT): $(OBJS)
--- old/clientserver.c
+++ new/clientserver.c
-@@ -853,6 +853,13 @@ int daemon_main(void)
+@@ -858,6 +858,13 @@ int daemon_main(void)
* address too. In fact, why not just do inet_ntop on the
* local address??? */
int fd;
--- old/configure.in
+++ new/configure.in
-@@ -625,6 +625,29 @@ if test $rsync_cv_can_hardlink_special =
+@@ -641,6 +641,29 @@ if test $rsync_cv_can_hardlink_special =
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
fi
} global;
static global Globals;
-@@ -290,6 +293,9 @@ static struct parm_struct parm_table[] =
+@@ -292,6 +295,9 @@ static struct parm_struct parm_table[] =
{"motd file", P_STRING, P_GLOBAL,&Globals.motd_file, NULL,0},
{"pid file", P_STRING, P_GLOBAL,&Globals.pid_file, NULL,0},
{"port", P_INTEGER,P_GLOBAL,&Globals.rsync_port, NULL,0},
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
-@@ -380,6 +386,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
+@@ -383,6 +389,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
int dummy2;
--- old/options.c
+++ new/options.c
-@@ -206,6 +206,7 @@ static void print_rsync_version(enum log
- char const *xattrs = "no ";
+@@ -212,6 +212,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
+ char const *iconv = "no ";
char const *ipv6 = "no ";
+ char const *slp = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -232,6 +233,9 @@ static void print_rsync_version(enum log
- #ifdef INET6
- ipv6 = "";
+@@ -241,6 +242,9 @@ static void print_rsync_version(enum log
+ #ifdef ICONV_OPTION
+ iconv = "";
#endif
+#if HAVE_LIBSLP
+ slp = "";
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -245,8 +249,8 @@ static void print_rsync_version(enum log
+@@ -254,8 +258,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);
-- rprintf(f, " %sappend, %sACLs, %sxattrs\n",
-- have_inplace, acls, xattrs);
-+ rprintf(f, " %sappend, %sACLs, %sxattrs, %sSLP\n",
-+ have_inplace, acls, xattrs, slp);
+- rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv\n",
+- have_inplace, acls, xattrs, iconv);
++ rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv, %sSLP\n",
++ have_inplace, acls, xattrs, iconv, slp);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
enddit()
-@@ -556,6 +565,7 @@ use chroot = no
+@@ -561,6 +570,7 @@ use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid