[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Sun Oct 10 19:54:16 UTC 2021
The branch, master has been updated
via 296352ec Tweak atime/crtime code a bit more.
via 11a9b623 Avoid spurious warning about "code" var not being initialized.
via 452ef785 Unify on "path" vs "fname" arg naming.
via 0d1b4889 Change do_lchmod() back to a swtich with some better ENOTSUP & ENOSYS logic.
via ec8a05f6 Some packaging improvements.
from 78b5bc66 Enable --atimes on macOS.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 296352ecb0175fa3c37de550dd57aeff39632095
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Oct 10 11:45:14 2021 -0700
Tweak atime/crtime code a bit more.
commit 11a9b623226ef2324985958c3416d2bae5a3b7f3
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Oct 10 10:04:54 2021 -0700
Avoid spurious warning about "code" var not being initialized.
commit 452ef785179a9bcdee7f6f96c72e34f5ad24384c
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Oct 10 09:53:35 2021 -0700
Unify on "path" vs "fname" arg naming.
commit 0d1b48893ab764f2c632abf0c94ef8d39312dfd0
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Oct 10 09:20:13 2021 -0700
Change do_lchmod() back to a swtich with some better ENOTSUP & ENOSYS logic.
commit ec8a05f65356c04a1f70cd58f1f80ed1e0b2d887
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Oct 3 12:02:58 2021 -0700
Some packaging improvements.
-----------------------------------------------------------------------
Summary of changes:
NEWS.md | 2 +-
generator.c | 1 -
ifuncs.h | 1 +
md2man | 14 ++++++-
packaging/pre-push | 17 +++++++-
packaging/release-rsync | 14 +++++++
rsync.1.md | 8 ++--
rsync.c | 48 +++++++++++++---------
rsyncd.conf.5.md | 4 +-
syscall.c | 106 ++++++++++++++++++++++++++++--------------------
10 files changed, 139 insertions(+), 76 deletions(-)
Changeset truncated at 500 lines:
diff --git a/NEWS.md b/NEWS.md
index 74c3edfc..a35d6ee5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -51,7 +51,7 @@
- Reduced memory usage for an incremental transfer that has a bunch of small
diretories.
- - Add support for `--atimes` on macOS.
+ - Added support for `--atimes` on macOS and fix using using it without -t.
- Rsync can now update the xattrs on a read-only file when your user can
temporarily add user-write permission to the file. (It always worked for a
diff --git a/generator.c b/generator.c
index 3287ae31..9c9751dc 100644
--- a/generator.c
+++ b/generator.c
@@ -1269,7 +1269,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
- sx.crtime = 0;
if (dry_run > 1 || (dry_missing_dir && is_below(file, dry_missing_dir))) {
int i;
diff --git a/ifuncs.h b/ifuncs.h
index 4037639b..491f0807 100644
--- a/ifuncs.h
+++ b/ifuncs.h
@@ -75,6 +75,7 @@ d_name(struct dirent *di)
static inline void
init_stat_x(stat_x *sx_p)
{
+ sx_p->crtime = 0;
#ifdef SUPPORT_ACLS
sx_p->acc_acl = sx_p->def_acl = NULL;
#endif
diff --git a/md2man b/md2man
index 7f783c56..fa1d2e82 100755
--- a/md2man
+++ b/md2man
@@ -11,6 +11,13 @@
# The html.parser is used as a state machine that both tweaks the html and
# outputs the nroff data based on the html tags.
#
+# We normally grab the prefix from the generated Makefile, which is then used
+# in the various other grabbed values (see the Makefile for its ${prefix}
+# paths). However, the maintainer can choose to override this prefix by
+# exporting RSYNC_OVERRIDE_PREFIX=/usr. This allows the man pages to refer to
+# /usr paths (and are thus compatible with the release-rsync script) while
+# still having the built rsync get installed into /usr/local for local testing.
+#
# Copyright (C) 2020 Wayne Davison
#
# This program is freely redistributable.
@@ -58,6 +65,7 @@ HTML_END = """\
MAN_START = r"""
.TH "%s" "%s" "%s" "%s" "User Commands"
+.\" prefix=%s
""".lstrip()
MAN_END = """\
@@ -91,7 +99,8 @@ def main():
if args.test:
env_subs['VERSION'] = '1.0.0'
- env_subs['libdir'] = '/usr'
+ env_subs['bindir'] = '/usr/bin'
+ env_subs['libdir'] = '/usr/lib/rsync'
else:
for fn in (fi.srcdir + 'version.h', 'Makefile'):
try:
@@ -124,13 +133,14 @@ def main():
txt = fh.read()
txt = re.sub(r'@VERSION@', env_subs['VERSION'], txt)
+ txt = re.sub(r'@BINDIR@', env_subs['bindir'], txt)
txt = re.sub(r'@LIBDIR@', env_subs['libdir'], txt)
fi.html_in = md_parser(txt)
txt = None
fi.date = time.strftime('%d %b %Y', time.localtime(fi.mtime))
- fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'])
+ fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'], env_subs['prefix'])
HtmlToManPage(fi)
diff --git a/packaging/pre-push b/packaging/pre-push
index 04b0d20b..8a713695 100755
--- a/packaging/pre-push
+++ b/packaging/pre-push
@@ -1,3 +1,16 @@
-#!/bin/sh
+#!/bin/bash -e
+
cat >/dev/null # Just discard stdin data
-make gensend
+
+if [[ -f /proc/$PPID/cmdline ]]; then
+ while read -d $'\0' arg ; do
+ if [[ "$arg" == '--tags' ]] ; then
+ exit 0
+ fi
+ done </proc/$PPID/cmdline
+fi
+
+branch=`git rev-parse --abbrev-ref HEAD`
+if [[ "$branch" = master && "$*" == *github* ]]; then
+ make gensend
+fi
diff --git a/packaging/release-rsync b/packaging/release-rsync
index 02cc2f08..f7cfcfe5 100755
--- a/packaging/release-rsync
+++ b/packaging/release-rsync
@@ -18,6 +18,9 @@ dest = os.environ['HOME'] + '/samba-rsync-ftp'
ORIGINAL_PATH = os.environ['PATH']
def main():
+ if not os.path.isfile('packaging/release-rsync'):
+ die('You must run this script from the top of your rsync checkout.')
+
now = datetime.now()
cl_today = now.strftime('* %a %b %d %Y')
year = now.strftime('%Y')
@@ -44,6 +47,17 @@ def main():
{dash_line}
""")
+ with open('build/rsync.1') as fh:
+ for line in fh:
+ if line.startswith(r'.\" prefix='):
+ doc_prefix = line.split('=')[1].strip()
+ if doc_prefix != '/usr':
+ warn(f"*** The documentation was built with prefix {doc_prefix} instead of /usr ***")
+ warn("*** Read the md2man script for a way to override this. ***\n")
+ break
+ if line.startswith('.P'):
+ die("Failed to find the prefix comment at the start of the rsync.1 manpage.")
+
if not os.path.isdir(dest):
die(dest, "dest does not exist")
if not os.path.isdir('.git'):
diff --git a/rsync.1.md b/rsync.1.md
index 9bfda865..3de57b72 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -1391,8 +1391,8 @@ your home directory (remove the '=' for that).
0. `--omit-dir-times`, `-O`
- This tells rsync to omit directories when it is preserving modification
- times (see `--times`). If NFS is sharing the directories on the receiving
+ This tells rsync to omit directories when it is preserving modification,
+ access, and create times. If NFS is sharing the directories on the receiving
side, it is a good idea to use `-O`. This option is inferred if you use
`--backup` without `--backup-dir`.
@@ -1409,8 +1409,8 @@ your home directory (remove the '=' for that).
0. `--omit-link-times`, `-J`
- This tells rsync to omit symlinks when it is preserving modification times
- (see `--times`).
+ This tells rsync to omit symlinks when it is preserving modification,
+ access, and create times.
0. `--super`
diff --git a/rsync.c b/rsync.c
index bcecac63..ff9489be 100644
--- a/rsync.c
+++ b/rsync.c
@@ -63,8 +63,7 @@ extern char *iconv_opt;
#define UPDATED_ATIME (1<<3)
#define UPDATED_ACLS (1<<4)
#define UPDATED_MODE (1<<5)
-
-#define UPDATED_TIMES (UPDATED_MTIME|UPDATED_ATIME)
+#define UPDATED_CRTIME (1<<6)
#ifdef ICONV_CONST
iconv_t ic_chck = (iconv_t)-1;
@@ -576,10 +575,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
set_xattr(fname, file, fnamecmp, sxp);
#endif
- if (!preserve_times
- || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
- || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
- flags |= ATTRS_SKIP_MTIME | ATTRS_SKIP_ATIME;
+ if (!preserve_times)
+ flags |= ATTRS_SKIP_MTIME | (atimes_ndx ? 0 : ATTRS_SKIP_ATIME) | (crtimes_ndx ? 0 : ATTRS_SKIP_CRTIME);
+ else if ((!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode))
+ || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
+ flags |= ATTRS_SKIP_MTIME | ATTRS_SKIP_ATIME | ATTRS_SKIP_CRTIME;
else if (sxp != &sx2)
memcpy(&sx2.st, &sxp->st, sizeof (sx2.st));
if (!atimes_ndx || S_ISDIR(sxp->st.st_mode))
@@ -604,28 +604,36 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
updated |= UPDATED_ATIME;
}
}
- if (updated & UPDATED_TIMES) {
+#ifdef SUPPORT_CRTIMES
+ if (crtimes_ndx && !(flags & ATTRS_SKIP_CRTIME)) {
+ time_t file_crtime = F_CRTIME(file);
+ if (sxp->crtime == 0)
+ sxp->crtime = get_create_time(fname, &sxp->st);
+ if (!same_time(sxp->crtime, 0L, file_crtime, 0L)) {
+ if (
+#ifdef HAVE_GETATTRLIST
+ do_setattrlist_crtime(fname, file_crtime) == 0
+#elif defined __CYGWIN__
+ do_SetFileTime(fname, file_crtime) == 0
+#else
+#error Unknown crtimes implementation
+#endif
+ )
+ updated |= UPDATED_CRTIME;
+ }
+ }
+#endif
+ if (updated & (UPDATED_MTIME|UPDATED_ATIME)) {
int ret = set_times(fname, &sx2.st);
if (ret < 0) {
- rsyserr(FERROR_XFER, errno, "failed to set times on %s",
- full_fname(fname));
+ rsyserr(FERROR_XFER, errno, "failed to set times on %s", full_fname(fname));
goto cleanup;
}
if (ret > 0) { /* ret == 1 if symlink could not be set */
- updated &= ~UPDATED_TIMES;
+ updated &= ~(UPDATED_MTIME|UPDATED_ATIME);
file->flags |= FLAG_TIME_FAILED;
}
}
-#ifdef SUPPORT_CRTIMES
- if (crtimes_ndx && !(flags & ATTRS_SKIP_CRTIME)) {
- time_t file_crtime = F_CRTIME(file);
- if (sxp->crtime == 0)
- sxp->crtime = get_create_time(fname, &sxp->st);
- if (!same_time(sxp->crtime, 0L, file_crtime, 0L)
- && set_create_time(fname, file_crtime) == 0)
- updated = 1;
- }
-#endif
#ifdef SUPPORT_ACLS
/* It's OK to call set_acl() now, even for a dir, as the generator
diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
index b70532b1..730ef71e 100644
--- a/rsyncd.conf.5.md
+++ b/rsyncd.conf.5.md
@@ -60,9 +60,9 @@ When run via inetd you should add a line like this to /etc/services:
and a single line something like this to /etc/inetd.conf:
-> rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
+> rsync stream tcp nowait root @BINDIR@/rsync rsyncd --daemon
-Replace "/usr/bin/rsync" with the path to where you have rsync installed on
+Replace "@BINDIR@/rsync" with the path to where you have rsync installed on
your system. You will then need to send inetd a HUP signal to tell it to
reread its config file.
diff --git a/syscall.c b/syscall.c
index abb00575..56948a83 100644
--- a/syscall.c
+++ b/syscall.c
@@ -77,15 +77,15 @@ struct create_time {
#define RETURN_ERROR_IF_RO_OR_LO RETURN_ERROR_IF(read_only || list_only, EROFS)
-int do_unlink(const char *fname)
+int do_unlink(const char *path)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
- return unlink(fname);
+ return unlink(path);
}
#ifdef SUPPORT_LINKS
-int do_symlink(const char *lnk, const char *fname)
+int do_symlink(const char *lnk, const char *path)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
@@ -95,7 +95,7 @@ int do_symlink(const char *lnk, const char *fname)
* and write the lnk into it. */
if (am_root < 0) {
int ok, len = strlen(lnk);
- int fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+ int fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
if (fd < 0)
return -1;
ok = write(fd, lnk, len) == len;
@@ -105,7 +105,7 @@ int do_symlink(const char *lnk, const char *fname)
}
#endif
- return symlink(lnk, fname);
+ return symlink(lnk, path);
}
#if defined NO_SYMLINK_XATTRS || defined NO_SYMLINK_USER_XATTRS
@@ -231,13 +231,24 @@ int do_open(const char *pathname, int flags, mode_t mode)
#ifdef HAVE_CHMOD
int do_chmod(const char *path, mode_t mode)
{
+ static int switch_step = 0;
int code;
+
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
+
+ switch (switch_step) {
#ifdef HAVE_LCHMOD
- if ((code = lchmod(path, mode & CHMOD_BITS)) < 0 && errno == ENOTSUP)
+ case 0:
+ if ((code = lchmod(path, mode & CHMOD_BITS)) == 0)
+ break;
+ if (errno == ENOSYS)
+ switch_step++;
+ else if (errno != ENOTSUP)
+ break;
#endif
- {
+
+ default:
if (S_ISLNK(mode)) {
# if defined HAVE_SETATTRLIST
struct attrlist attrList;
@@ -252,6 +263,7 @@ int do_chmod(const char *path, mode_t mode)
# endif
} else
code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */
+ break;
}
if (code != 0 && (preserve_perms || preserve_executability))
return code;
@@ -300,12 +312,12 @@ void trim_trailing_slashes(char *name)
}
}
-int do_mkdir(char *fname, mode_t mode)
+int do_mkdir(char *path, mode_t mode)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
- trim_trailing_slashes(fname);
- return mkdir(fname, mode);
+ trim_trailing_slashes(path);
+ return mkdir(path, mode);
}
/* like mkstemp but forces permissions */
@@ -339,25 +351,25 @@ int do_mkstemp(char *template, mode_t perms)
#endif
}
-int do_stat(const char *fname, STRUCT_STAT *st)
+int do_stat(const char *path, STRUCT_STAT *st)
{
#ifdef USE_STAT64_FUNCS
- return stat64(fname, st);
+ return stat64(path, st);
#else
- return stat(fname, st);
+ return stat(path, st);
#endif
}
-int do_lstat(const char *fname, STRUCT_STAT *st)
+int do_lstat(const char *path, STRUCT_STAT *st)
{
#ifdef SUPPORT_LINKS
# ifdef USE_STAT64_FUNCS
- return lstat64(fname, st);
+ return lstat64(path, st);
# else
- return lstat(fname, st);
+ return lstat(path, st);
# endif
#else
- return do_stat(fname, st);
+ return do_stat(path, st);
#endif
}
@@ -385,7 +397,7 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
}
#ifdef HAVE_SETATTRLIST
-int do_setattrlist_times(const char *fname, STRUCT_STAT *stp)
+int do_setattrlist_times(const char *path, STRUCT_STAT *stp)
{
struct attrlist attrList;
struct timespec ts[2];
@@ -403,9 +415,28 @@ int do_setattrlist_times(const char *fname, STRUCT_STAT *stp)
memset(&attrList, 0, sizeof attrList);
attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
attrList.commonattr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME;
- return setattrlist(fname, &attrList, ts, sizeof ts, FSOPT_NOFOLLOW);
+ return setattrlist(path, &attrList, ts, sizeof ts, FSOPT_NOFOLLOW);
+}
+
+#ifdef SUPPORT_CRTIMES
+int do_setattrlist_crtime(const char *path, time_t crtime)
+{
+ struct attrlist attrList;
+ struct timespec ts;
+
+ if (dry_run) return 0;
+ RETURN_ERROR_IF_RO_OR_LO;
+
+ ts.tv_sec = crtime;
+ ts.tv_nsec = 0;
+
+ memset(&attrList, 0, sizeof attrList);
+ attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
+ attrList.commonattr = ATTR_CMN_CRTIME;
+ return setattrlist(path, &attrList, &ts, sizeof ts, FSOPT_NOFOLLOW);
}
#endif
+#endif /* HAVE_SETATTRLIST */
#ifdef SUPPORT_CRTIMES
time_t get_create_time(const char *path, STRUCT_STAT *stp)
@@ -429,24 +460,12 @@ time_t get_create_time(const char *path, STRUCT_STAT *stp)
#endif
}
-int set_create_time(const char *path, time_t crtime)
+#if defined __CYGWIN__
+int do_SetFileTime(const char *path, time_t crtime)
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
- {
-#ifdef HAVE_GETATTRLIST
- struct attrlist attrList;
- struct timespec ts;
-
- ts.tv_sec = crtime;
- ts.tv_nsec = 0;
-
- memset(&attrList, 0, sizeof attrList);
- attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
- attrList.commonattr = ATTR_CMN_CRTIME;
- return setattrlist(path, &attrList, &ts, sizeof ts, FSOPT_NOFOLLOW);
-#elif defined __CYGWIN__
int cnt = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
if (cnt == 0)
return -1;
@@ -466,13 +485,12 @@ int set_create_time(const char *path, time_t crtime)
int ok = SetFileTime(handle, &birth_time, NULL, NULL);
CloseHandle(handle);
return ok ? 0 : -1;
-#endif
- }
}
+#endif
#endif /* SUPPORT_CRTIMES */
#ifdef HAVE_UTIMENSAT
-int do_utimensat(const char *fname, STRUCT_STAT *stp)
+int do_utimensat(const char *path, STRUCT_STAT *stp)
{
struct timespec t[2];
@@ -491,12 +509,12 @@ int do_utimensat(const char *fname, STRUCT_STAT *stp)
#else
t[1].tv_nsec = 0;
#endif
- return utimensat(AT_FDCWD, fname, t, AT_SYMLINK_NOFOLLOW);
+ return utimensat(AT_FDCWD, path, t, AT_SYMLINK_NOFOLLOW);
}
#endif
#ifdef HAVE_LUTIMES
-int do_lutimes(const char *fname, STRUCT_STAT *stp)
+int do_lutimes(const char *path, STRUCT_STAT *stp)
{
struct timeval t[2];
@@ -515,12 +533,12 @@ int do_lutimes(const char *fname, STRUCT_STAT *stp)
#else
t[1].tv_usec = 0;
#endif
- return lutimes(fname, t);
+ return lutimes(path, t);
}
#endif
#ifdef HAVE_UTIMES
-int do_utimes(const char *fname, STRUCT_STAT *stp)
--
The rsync repository.
More information about the rsync-cvs
mailing list