[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Fri Jul 9 02:00:45 UTC 2021
The branch, master has been updated
via 291a042b Support --crtimes on Cygwin.
via 9dad3721 Make whole-line comments clearer.
from dbb1c2d1 Set whole_file = 0 when whole_file < 0. Fixes issue 114.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 291a042b3e6cdca6a2c48e796c9fcd2b83193311
Author: Wayne Davison <wayne at opencoder.net>
Date: Thu Jul 8 18:47:21 2021 -0700
Support --crtimes on Cygwin.
commit 9dad3721a9535b6ae864cbc5f70eda92d3ac02ca
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jul 4 12:42:51 2021 -0700
Make whole-line comments clearer.
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 4 ++--
flist.c | 2 +-
generator.c | 4 ++--
rsync.1.md | 21 +++++++++++++--------
rsync.c | 2 +-
rsync.h | 2 +-
syscall.c | 38 +++++++++++++++++++++++++++++++++++---
tls.c | 2 +-
8 files changed, 56 insertions(+), 19 deletions(-)
Changeset truncated at 500 lines:
diff --git a/Makefile.in b/Makefile.in
index 67190489..0313e6ff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50,7 +50,7 @@ popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
-TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
+TLS_OBJ = tls.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
# Programs we must have to run the test cases
CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
@@ -155,7 +155,7 @@ getgroups$(EXEEXT): getgroups.o
getfsdev$(EXEEXT): getfsdev.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
-TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
+TRIMSLASH_OBJ = trimslash.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o
trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
diff --git a/flist.c b/flist.c
index 5a1e4245..3442d868 100644
--- a/flist.c
+++ b/flist.c
@@ -1438,7 +1438,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
F_ATIME(file) = st.st_atime;
#ifdef SUPPORT_CRTIMES
if (crtimes_ndx)
- F_CRTIME(file) = get_create_time(fname);
+ F_CRTIME(file) = get_create_time(fname, &st);
#endif
if (basename != thisname)
diff --git a/generator.c b/generator.c
index a890bdc3..dc457093 100644
--- a/generator.c
+++ b/generator.c
@@ -399,7 +399,7 @@ static inline int any_time_differs(stat_x *sxp, struct file_struct *file, UNUSED
#ifdef SUPPORT_CRTIMES
if (!differs && crtimes_ndx) {
if (sxp->crtime == 0)
- sxp->crtime = get_create_time(fname);
+ sxp->crtime = get_create_time(fname, &sxp->st);
differs = !same_time(sxp->crtime, 0, F_CRTIME(file), 0);
}
#endif
@@ -525,7 +525,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
#ifdef SUPPORT_CRTIMES
if (crtimes_ndx) {
if (sxp->crtime == 0)
- sxp->crtime = get_create_time(fnamecmp);
+ sxp->crtime = get_create_time(fnamecmp, &sxp->st);
if (!same_time(sxp->crtime, 0, F_CRTIME(file), 0))
iflags |= ITEM_REPORT_CRTIME;
}
diff --git a/rsync.1.md b/rsync.1.md
index ec55a688..24457b2b 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -2049,9 +2049,11 @@ your home directory (remove the '=' for that).
0. `--exclude-from=FILE`
This option is related to the `--exclude` option, but it specifies a FILE
- that contains exclude patterns (one per line). Blank lines in the file and
- lines starting with '`;`' or '`#`' are ignored. If _FILE_ is '`-`', the
- list will be read from standard input.
+ that contains exclude patterns (one per line). Blank lines in the file are
+ ignored, as are whole-line comments that start with '`;`' or '`#`'
+ (filename rules that contain those characters are unaffected).
+
+ If _FILE_ is '`-`', the list will be read from standard input.
0. `--include=PATTERN`
@@ -2064,9 +2066,11 @@ your home directory (remove the '=' for that).
0. `--include-from=FILE`
This option is related to the `--include` option, but it specifies a FILE
- that contains include patterns (one per line). Blank lines in the file and
- lines starting with '`;`' or '`#`' are ignored. If _FILE_ is '`-`', the
- list will be read from standard input.
+ that contains include patterns (one per line). Blank lines in the file are
+ ignored, as are whole-line comments that start with '`;`' or '`#`'
+ (filename rules that contain those characters are unaffected).
+
+ If _FILE_ is '`-`', the list will be read from standard input.
0. `--files-from=FILE`
@@ -3501,8 +3505,9 @@ available rule prefixes:
0. `risk, 'R'` files that match the pattern are not protected.
0. `clear, '!'` clears the current include/exclude list (takes no arg)
-When rules are being read from a file, empty lines are ignored, as are comment
-lines that start with a "#".
+When rules are being read from a file, empty lines are ignored, as are
+whole-line comments that start with a '`#`' (filename rules that contain a hash
+are unaffected).
[comment]: # (Remember that markdown strips spaces from start/end of ` ... ` sequences!)
[comment]: # (Thus, the `x ` sequences below use a literal non-breakable space!)
diff --git a/rsync.c b/rsync.c
index e7f1f96a..bcecac63 100644
--- a/rsync.c
+++ b/rsync.c
@@ -620,7 +620,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
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->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;
diff --git a/rsync.h b/rsync.h
index 9d5c8008..2f674bc5 100644
--- a/rsync.h
+++ b/rsync.h
@@ -587,7 +587,7 @@ typedef unsigned int size_t;
#define SUPPORT_ATIMES 1
#endif
-#ifdef HAVE_GETATTRLIST
+#if defined HAVE_GETATTRLIST || defined __CYGWIN__
#define SUPPORT_CRTIMES 1
#endif
diff --git a/syscall.c b/syscall.c
index 11d10e4a..181be11d 100644
--- a/syscall.c
+++ b/syscall.c
@@ -55,12 +55,16 @@ extern int open_noatime;
#endif
#ifdef SUPPORT_CRTIMES
+#ifdef HAVE_GETATTRLIST
#pragma pack(push, 4)
struct create_time {
uint32 length;
struct timespec crtime;
};
#pragma pack(pop)
+#elif defined __CYGWIN__
+#include <windows.h>
+#endif
#endif
#define RETURN_ERROR_IF(x,e) \
@@ -407,23 +411,30 @@ int do_setattrlist_times(const char *fname, STRUCT_STAT *stp)
#endif
#ifdef SUPPORT_CRTIMES
-time_t get_create_time(const char *path)
+time_t get_create_time(const char *path, STRUCT_STAT *stp)
{
+#ifdef HAVE_GETATTRLIST
static struct create_time attrBuf;
struct attrlist attrList;
+ (void)stp;
memset(&attrList, 0, sizeof attrList);
attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
attrList.commonattr = ATTR_CMN_CRTIME;
if (getattrlist(path, &attrList, &attrBuf, sizeof attrBuf, FSOPT_NOFOLLOW) < 0)
return 0;
return attrBuf.crtime.tv_sec;
-}
+#elif defined __CYGWIN__
+ (void)path;
+ return stp->st_birthtime;
+#else
+#error Unknown crtimes implementation
#endif
+}
-#ifdef SUPPORT_CRTIMES
int set_create_time(const char *path, time_t crtime)
{
+#ifdef HAVE_GETATTRLIST
struct attrlist attrList;
struct timespec ts;
@@ -437,6 +448,27 @@ int set_create_time(const char *path, time_t crtime)
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;
+ WCHAR *pathw = new_array(WCHAR, cnt);
+ if (!pathw)
+ return -1;
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, pathw, cnt);
+ HANDLE handle = CreateFileW(pathw, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ free(pathw);
+ if (handle == INVALID_HANDLE_VALUE)
+ return -1;
+ int64 temp_time = Int32x32To64(crtime, 10000000) + 116444736000000000LL;
+ FILETIME birth_time;
+ birth_time.dwLowDateTime = (DWORD)temp_time;
+ birth_time.dwHighDateTime = (DWORD)(temp_time >> 32);
+ int ok = SetFileTime(handle, &birth_time, NULL, NULL);
+ CloseHandle(handle);
+ return ok ? 0 : -1;
+#endif
}
#endif
diff --git a/tls.c b/tls.c
index cb497360..96698674 100644
--- a/tls.c
+++ b/tls.c
@@ -160,7 +160,7 @@ static void list_file(const char *fname)
if (do_lstat(fname, &buf) < 0)
failed("stat", fname);
#ifdef SUPPORT_CRTIMES
- if (display_crtimes && (crtime = get_create_time(fname)) == 0)
+ if (display_crtimes && (crtime = get_create_time(fname, &buf)) == 0)
failed("get_create_time", fname);
#endif
#ifdef SUPPORT_XATTRS
--
The rsync repository.
More information about the rsync-cvs
mailing list