The branch, master has been updated via 9fce0eb5 Avoid some pedantic errors & old warnings. via 33e94849 Handle early gcc versions that don't understand -Wno-pedantic. via 8f151118 Make gcc die on init overflow of an array. via acca9d43 Expand the max name_num_item list size. via 58f464f4 Change `--info=skip2` messages & add info on attr changes. via 7eb59a91 Change from $build_cpu to $host_cpu as edo1 suggested. from 740ed11a Make the extra info on the "exists" messages optional.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 9fce0eb5ab80da4d4d97bcde346c9b0b92432ac8 Author: Wayne Davison <wa...@opencoder.net> Date: Tue Sep 29 14:47:31 2020 -0700 Avoid some pedantic errors & old warnings. commit 33e94849b1013ff7e7b04e0a45ab2fffe2dd1e44 Author: Wayne Davison <wa...@opencoder.net> Date: Tue Sep 29 14:22:40 2020 -0700 Handle early gcc versions that don't understand -Wno-pedantic. commit 8f1511184ab5ad10110286cdef22195b5a67f01f Author: Wayne Davison <wa...@opencoder.net> Date: Tue Sep 29 13:04:41 2020 -0700 Make gcc die on init overflow of an array. - Use -pedantic-errors with gcc to make an array-init fatal. - Fix all the extra warnings that gcc outputs due to this option. - Also add -Wno-pedantic to gcc if we're using the internal popt code (since it has lots of pedantic issues). commit acca9d43d3143113088efa76d561b813735f1a73 Author: Wayne Davison <wa...@opencoder.net> Date: Tue Sep 29 12:57:32 2020 -0700 Expand the max name_num_item list size. commit 58f464f4daa1b1ee00c6afd898a19ca5cd81bf58 Author: Wayne Davison <wa...@opencoder.net> Date: Wed Sep 23 09:26:10 2020 -0700 Change `--info=skip2` messages & add info on attr changes. commit 7eb59a9152a2ace7bc7858e9915c671b3ab54344 Author: Wayne Davison <wa...@opencoder.net> Date: Tue Sep 22 17:19:45 2020 -0700 Change from $build_cpu to $host_cpu as edo1 suggested. ----------------------------------------------------------------------- Summary of changes: NEWS.md | 3 ++- configure.ac | 20 +++++++++++++++++--- generator.c | 13 ++++++++----- lib/sysxattrs.c | 9 +++++---- loadparm.c | 2 +- log.c | 24 +++++++++++++++++------- rsync.1.md | 7 ++++--- rsync.h | 2 +- tls.c | 3 ++- token.c | 2 +- xattrs.c | 3 ++- 11 files changed, 60 insertions(+), 28 deletions(-) Changeset truncated at 500 lines: diff --git a/NEWS.md b/NEWS.md index d978222c..bbc1b3fe 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,7 +32,8 @@ - Added extra info to the "FILENAME exists" output of `--ignore-existing` when `--info=skip2` is used. The skip message becomes "FILENAME exists (INFO)" - where the INFO is one of uptodate, type differs, or differs. + where the INFO is one of "type change", "sum change" (requires `-c`), "file + change" (based on the quick check), "attr change", or "uptodate". - Some manpage improvements. diff --git a/configure.ac b/configure.ac index 109546a6..1116e658 100644 --- a/configure.ac +++ b/configure.ac @@ -211,7 +211,7 @@ CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g //'` if test x"$enable_simd" != x"no"; then # For x86-64 SIMD, g++ >=5 or clang++ >=7 is required - if test x"$build_cpu" = x"x86_64"; then + if test x"$host_cpu" = x"x86_64"; then AC_LANG(C++) AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> #include <immintrin.h> @@ -283,8 +283,8 @@ AC_ARG_ENABLE(asm, AS_HELP_STRING([--disable-asm],[disable ASM optimizations])) if test x"$enable_asm" != x"no"; then - if test x"$build_cpu" = x"x86_64"; then - ASM="$build_cpu" + if test x"$host_cpu" = x"x86_64"; then + ASM="$host_cpu" elif test x"$enable_asm" = x"yes"; then AC_MSG_RESULT(unavailable) AC_MSG_ERROR(The ASM optimizations are currently x86_64 only. @@ -1046,6 +1046,20 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then with_included_popt=yes fi +if test x"$GCC" = x"yes"; then + if test x"$with_included_popt" != x"yes"; then + # Turn pedantic warnings into errors to ensure an array-init overflow is an error. + CFLAGS="$CFLAGS -pedantic-errors" + else + # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to + # turn off pedantic warnings (which will not lose the error for array-init overflow). + case `$CC -dumpversion 2>/dev/null` in + 4.*) ;; # Early gcc doesn't understand -Wno-pedantic + *) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; + esac + fi +fi + AC_MSG_CHECKING([whether to use included libpopt]) if test x"$with_included_popt" = x"yes"; then AC_MSG_RESULT($srcdir/popt) diff --git a/generator.c b/generator.c index e3bc40a6..a890bdc3 100644 --- a/generator.c +++ b/generator.c @@ -182,7 +182,8 @@ static int remember_delete(struct file_struct *file, const char *fname, int flag static int read_delay_line(char *buf, int *flags_p) { static int read_pos = 0; - int j, len, mode; + unsigned int mode; + int j, len; char *bp, *past_space; while (1) { @@ -1381,11 +1382,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, const char *suf = ""; if (INFO_GTE(SKIP, 2)) { if (ftype != stype) - suf = " (type differs)"; - else if (quick_check_ok(ftype, fname, file, &sx.st)) - suf = " (uptodate)"; + suf = " (type change)"; + else if (!quick_check_ok(ftype, fname, file, &sx.st)) + suf = always_checksum ? " (sum change)" : " (file change)"; + else if (!unchanged_attrs(fname, file, &sx)) + suf = " (attr change)"; else - suf = " (differs)"; + suf = " (uptodate)"; } rprintf(FINFO, "%s exists%s\n", fname, suf); } diff --git a/lib/sysxattrs.c b/lib/sysxattrs.c index 583b93e9..d403caf5 100644 --- a/lib/sysxattrs.c +++ b/lib/sysxattrs.c @@ -67,7 +67,7 @@ ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t si u_int32_t offset = len; size_t data_retrieved = len; while (data_retrieved < size) { - len = getxattr(path, name, value + offset, size - data_retrieved, offset, XATTR_NOFOLLOW); + len = getxattr(path, name, (char*)value + offset, size - data_retrieved, offset, XATTR_NOFOLLOW); if (len <= 0) break; data_retrieved += len; @@ -167,7 +167,7 @@ static ssize_t read_xattr(int attrfd, void *buf, size_t buflen) } else { size_t bufpos; for (bufpos = 0; bufpos < sb.st_size; ) { - ssize_t cnt = read(attrfd, buf + bufpos, sb.st_size - bufpos); + ssize_t cnt = read(attrfd, (char*)buf + bufpos, sb.st_size - bufpos); if (cnt <= 0) { if (cnt < 0 && errno == EINTR) continue; @@ -218,7 +218,7 @@ int sys_lsetxattr(const char *path, const char *name, const void *value, size_t return -1; for (bufpos = 0; bufpos < size; ) { - ssize_t cnt = write(attrfd, value+bufpos, size); + ssize_t cnt = write(attrfd, (char*)value + bufpos, size); if (cnt <= 0) { if (cnt < 0 && errno == EINTR) continue; @@ -274,7 +274,8 @@ ssize_t sys_llistxattr(const char *path, char *list, size_t size) && (dp->d_name[10] == 'o' || dp->d_name[10] == 'w')) continue; - if ((ret += len+1) > size) { + ret += len + 1; + if ((size_t)ret > size) { if (size == 0) continue; ret = -1; diff --git a/loadparm.c b/loadparm.c index 952a0b74..3906bc0f 100644 --- a/loadparm.c +++ b/loadparm.c @@ -437,7 +437,7 @@ static BOOL do_parameter(char *parmname, char *parmvalue) break; case P_OCTAL: - sscanf(parmvalue, "%o", (int *)parm_ptr); + sscanf(parmvalue, "%o", (unsigned int *)parm_ptr); break; case P_PATH: diff --git a/log.c b/log.c index 062a930e..06844a94 100644 --- a/log.c +++ b/log.c @@ -838,14 +838,24 @@ void maybe_log_item(struct file_struct *file, int iflags, int itemizing, const c void log_delete(const char *fname, int mode) { - static struct { - union file_extras ex[4]; /* just in case... */ - struct file_struct file; - } x; /* Zero-initialized due to static declaration. */ + static struct file_struct *file = NULL; int len = strlen(fname); const char *fmt; - x.file.mode = mode; + if (!file) { + int extra_len = (file_extra_cnt + 2) * EXTRA_LEN; + char *bp; +#if EXTRA_ROUNDING > 0 + if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN)) + extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN; +#endif + + bp = new_array0(char, FILE_STRUCT_LEN + extra_len + 1); + bp += extra_len; + file = (struct file_struct *)bp; + } + + file->mode = mode; if (am_server && protocol_version >= 29 && len < MAXPATHLEN) { if (S_ISDIR(mode)) @@ -855,14 +865,14 @@ void log_delete(const char *fname, int mode) ; else { fmt = stdout_format_has_o_or_i ? stdout_format : "deleting %n"; - log_formatted(FCLIENT, fmt, "del.", &x.file, fname, ITEM_DELETED, NULL); + log_formatted(FCLIENT, fmt, "del.", file, fname, ITEM_DELETED, NULL); } if (!logfile_name || dry_run || !logfile_format) return; fmt = logfile_format_has_o_or_i ? logfile_format : "deleting %n"; - log_formatted(FLOG, fmt, "del.", &x.file, fname, ITEM_DELETED, NULL); + log_formatted(FLOG, fmt, "del.", file, fname, ITEM_DELETED, NULL); } /* diff --git a/rsync.1.md b/rsync.1.md index ba79eb7a..3e4a72b0 100644 --- a/rsync.1.md +++ b/rsync.1.md @@ -1607,9 +1607,10 @@ your home directory (remove the '=' for that). only looking at the existing files in the destination hierarchy itself. When `--info=skip2` is used rsync will output "FILENAME exists (INFO)" - messages where the INFO indicates one of "uptodate", "type differs", or - "differs". The first level of skip messages (which is also implied by - `-vv`) outputs the exists message without the "(INFO)" suffix. + messages where the INFO indicates one of "type change", "sum change" + (requires `-c`), "file change" (based on the quick check), "attr change", + or "uptodate". Using `--info=skip1` (which is also implied by `-vv`) + outputs the exists message without the INFO suffix. 0. `--remove-source-files` diff --git a/rsync.h b/rsync.h index 68dfba51..9d5c8008 100644 --- a/rsync.h +++ b/rsync.h @@ -1164,7 +1164,7 @@ struct name_num_obj { uchar *saw; int saw_len; int negotiated_num; - struct name_num_item list[8]; /* A big-enough len (we'll get a compile error if it is ever too small) */ + struct name_num_item list[10]; /* we'll get a compile error/warning if this is ever too small */ }; #ifndef __cplusplus diff --git a/tls.c b/tls.c index c50fa6c3..cb497360 100644 --- a/tls.c +++ b/tls.c @@ -60,7 +60,8 @@ int nsec_times = 0; static int stat_xattr(const char *fname, STRUCT_STAT *fst) { - int mode, rdev_major, rdev_minor, uid, gid, len; + unsigned int mode; + int rdev_major, rdev_minor, uid, gid, len; char buf[256]; if (am_root >= 0 || IS_DEVICE(fst->st_mode) || IS_SPECIAL(fst->st_mode)) diff --git a/token.c b/token.c index 61be8dd9..3a6d069e 100644 --- a/token.c +++ b/token.c @@ -570,7 +570,7 @@ static int32 recv_deflated_token(int f, char **data) rx_strm.avail_in = 4; rx_strm.next_in = (Bytef *)cbuf; cbuf[0] = cbuf[1] = 0; - cbuf[2] = cbuf[3] = 0xff; + cbuf[2] = cbuf[3] = (char)0xff; inflate(&rx_strm, Z_SYNC_FLUSH); recv_state = r_idle; } diff --git a/xattrs.c b/xattrs.c index bcb4bcac..508649c0 100644 --- a/xattrs.c +++ b/xattrs.c @@ -1118,7 +1118,8 @@ int del_def_xattr_acl(const char *fname) int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst) { - int mode, rdev_major, rdev_minor, uid, gid, len; + unsigned int mode; + int rdev_major, rdev_minor, uid, gid, len; char buf[256]; if (am_root >= 0 || IS_DEVICE(fst->st_mode) || IS_SPECIAL(fst->st_mode)) -- The rsync repository. _______________________________________________ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs