./configure (optional if already run)
make
-based-on: patch/fileflags
+based-on: patch/master/fileflags
diff --git a/compat.c b/compat.c
--- a/compat.c
+++ b/compat.c
-@@ -46,6 +46,7 @@ extern int force_change;
+@@ -45,6 +45,7 @@ extern int force_change;
extern int protect_args;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_fileflags;
extern int preserve_acls;
extern int preserve_xattrs;
-@@ -64,7 +65,7 @@ extern char *iconv_opt;
+@@ -63,7 +64,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 */
-@@ -141,6 +142,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -140,6 +141,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
extern int relative_paths;
extern int implied_dirs;
extern int file_extra_cnt;
-@@ -406,7 +407,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -407,7 +408,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
#endif
int ndx, int first_ndx)
{
static mode_t mode;
#ifdef SUPPORT_FILEFLAGS
static uint32 fileflags;
-@@ -517,6 +518,13 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -518,6 +519,13 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
modtime = file->modtime;
if (NSEC_BUMP(file) && protocol_version >= 31)
xflags |= XMIT_MOD_NSEC;
#ifdef SUPPORT_HARD_LINKS
if (tmp_dev != 0) {
-@@ -601,6 +609,8 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -602,6 +610,8 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
}
if (xflags & XMIT_MOD_NSEC)
write_varint(f, F_MOD_NSEC(file));
if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
#ifdef SUPPORT_FILEFLAGS
-@@ -692,7 +702,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
+@@ -693,7 +703,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
static struct file_struct *recv_file_entry(int f, struct file_list *flist, int xflags)
{
static mode_t mode;
#ifdef SUPPORT_FILEFLAGS
static uint32 fileflags;
-@@ -837,6 +847,19 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
+@@ -838,6 +848,19 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
modtime_nsec = read_varint(f);
else
modtime_nsec = 0;
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
-@@ -1007,6 +1030,8 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
+@@ -1008,6 +1031,8 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
F_GROUP(file) = gid;
file->flags |= gid_flags;
}
if (unsort_ndx)
F_NDX(file) = flist->used + flist->ndx_start;
-@@ -1406,6 +1431,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1407,6 +1432,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
F_OWNER(file) = st.st_uid;
if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */
F_GROUP(file) = st.st_gid;
extern int preserve_hard_links;
extern int preserve_executability;
extern int preserve_fileflags;
-@@ -420,6 +421,13 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
+@@ -418,6 +419,13 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file))
return 0;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
if (!ACL_READY(*sxp))
-@@ -463,6 +471,12 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
+@@ -461,6 +469,12 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
: iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !(iflags & ITEM_MATCHED)
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
iflags |= ITEM_REPORT_TIME;
#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -1030,6 +1044,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1028,6 +1042,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
int64 len;
int colwidth = human_readable ? 14 : 11;
-@@ -1045,10 +1060,11 @@ static void list_file_entry(struct file_struct *f)
+@@ -1043,10 +1058,11 @@ static void list_file_entry(struct file_struct *f)
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
} else
#endif
if (missing_args == 2 && f->mode == 0) {
-@@ -1056,9 +1072,11 @@ static void list_file_entry(struct file_struct *f)
+@@ -1054,9 +1070,11 @@ static void list_file_entry(struct file_struct *f)
colwidth + 31, "*missing",
f_name(f, NULL));
} else {
}
}
-@@ -1149,6 +1167,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1147,6 +1165,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
diff --git a/ifuncs.h b/ifuncs.h
--- a/ifuncs.h
+++ b/ifuncs.h
-@@ -35,6 +35,28 @@ realloc_xbuf(xbuf *xb, size_t sz)
- xb->size = sz;
+@@ -43,6 +43,28 @@ free_xbuf(xbuf *xb)
+ memset(xb, 0, sizeof (xbuf));
}
+static inline time_t
diff --git a/log.c b/log.c
--- a/log.c
+++ b/log.c
-@@ -718,7 +718,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
+@@ -736,7 +736,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
c[8] = !(iflags & ITEM_REPORT_FFLAGS) ? '.' : 'f';
c[9] = !(iflags & ITEM_REPORT_ACL) ? '.' : 'a';
c[10] = !(iflags & ITEM_REPORT_XATTR) ? '.' : 'x';
{"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 1, 0, 0 },
{"no-omit-dir-times",0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 },
{"no-O", 0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 },
-@@ -2333,6 +2338,8 @@ void server_options(char **args, int *argc_p)
+@@ -2367,6 +2372,8 @@ void server_options(char **args, int *argc_p)
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
diff --git a/rsync.c b/rsync.c
--- a/rsync.c
+++ b/rsync.c
-@@ -521,6 +521,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -538,6 +538,14 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
else
file->flags |= FLAG_TIME_FAILED;
}
change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP)
-@@ -671,7 +679,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -688,7 +696,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
ATTRS_DELAY_IMMUTABLE
/* move tmp file over real file */
if (DEBUG_GTE(RECV, 1))
-@@ -702,7 +710,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -719,7 +727,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
do_set_file_attrs:
set_file_attrs(fnametmp, file, NULL, fnamecmp,
/* These flags are used in the live flist data. */
-@@ -160,6 +161,7 @@
+@@ -162,6 +163,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define ATTRS_DELAY_IMMUTABLE (1<<2)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -176,7 +178,7 @@
+@@ -178,7 +180,7 @@
#define FNAMECMP_FUZZY 0x83
/* For use by the itemize_changes code */
#define ITEM_REPORT_CHANGE (1<<1)
#define ITEM_REPORT_SIZE (1<<2) /* regular files only */
#define ITEM_REPORT_TIMEFAIL (1<<2) /* symlinks only */
-@@ -685,6 +687,7 @@ extern int file_extra_cnt;
+@@ -693,6 +695,7 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
extern int fileflags_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -692,6 +695,7 @@ extern int xattrs_ndx;
+@@ -700,6 +703,7 @@ extern int xattrs_ndx;
#define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
#define EXTRA_LEN (sizeof (union file_extras))
#define PTR_EXTRA_CNT ((sizeof (char *) + EXTRA_LEN - 1) / EXTRA_LEN)
#define DEV_EXTRA_CNT 2
#define DIRNODE_EXTRA_CNT 3
#define SUM_EXTRA_CNT ((MAX_DIGEST_LEN + EXTRA_LEN - 1) / EXTRA_LEN)
-@@ -963,6 +967,7 @@ typedef struct {
+@@ -979,6 +983,7 @@ typedef struct {
typedef struct {
STRUCT_STAT st;
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -1106,6 +1107,9 @@ it is preserving modification times (see bf(--times)). If NFS is sharing
+@@ -1110,6 +1111,9 @@ it is preserving modification times (see bf(--times)). If NFS is sharing
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
-@@ -1903,7 +1907,7 @@ with older versions of rsync, but that also turns on the output of other
+@@ -1922,7 +1926,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.
-@@ -1962,6 +1966,8 @@ quote(itemization(
+@@ -1981,6 +1985,8 @@ quote(itemization(
it() The bf(f) means that the fileflags information changed.
it() The bf(a) means that the ACL information changed.
it() The bf(x) means that the extended attribute information changed.
diff --git a/syscall.c b/syscall.c
--- a/syscall.c
+++ b/syscall.c
-@@ -38,6 +38,11 @@ extern int force_change;
+@@ -38,6 +38,14 @@ extern int force_change;
extern int preserve_perms;
extern int preserve_executability;
++#pragma pack(push)
++#pragma pack(4)
+struct create_time {
-+ unsigned long length;
++ uint32 length;
+ struct timespec crtime;
+};
++#pragma pack(pop)
+
#define RETURN_ERROR_IF(x,e) \
do { \
if (x) { \
-@@ -437,3 +442,33 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
+@@ -439,3 +447,33 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
return lseek(fd, offset, whence);
#endif
}
diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns
--- a/testsuite/rsync.fns
+++ b/testsuite/rsync.fns
-@@ -24,9 +24,9 @@ todir="$tmpdir/to"
+@@ -23,9 +23,9 @@ todir="$tmpdir/to"
chkdir="$tmpdir/chk"
# For itemized output: