diff -Nru rsync-3.1.1/access.c rsync-3.1.2/access.c --- rsync-3.1.1/access.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/access.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Routines to authenticate access to a daemon (hosts allow/deny). * * Copyright (C) 1998 Andrew Tridgell - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/aclocal.m4 rsync-3.1.2/aclocal.m4 --- rsync-3.1.1/aclocal.m4 2007-11-02 20:52:33.000000000 +0000 +++ rsync-3.1.2/aclocal.m4 2015-12-19 00:12:21.000000000 +0000 @@ -1,92 +1,16 @@ -dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] -dnl if the cache file is inconsistent with the current host, -dnl target and build system types, execute CMD or print a default -dnl error message. -AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ - AC_REQUIRE([AC_CANONICAL_SYSTEM]) - AC_MSG_CHECKING([config.cache system type]) - if { test x"${ac_cv_host_system_type+set}" = x"set" && - test x"$ac_cv_host_system_type" != x"$host"; } || - { test x"${ac_cv_build_system_type+set}" = x"set" && - test x"$ac_cv_build_system_type" != x"$build"; } || - { test x"${ac_cv_target_system_type+set}" = x"set" && - test x"$ac_cv_target_system_type" != x"$target"; }; then - AC_MSG_RESULT([different]) - ifelse($#, 1, [$1], - [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) - else - AC_MSG_RESULT([same]) - fi - ac_cv_host_system_type="$host" - ac_cv_build_system_type="$build" - ac_cv_target_system_type="$target" -]) +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- -dnl Check for socklen_t: historically on BSD it is an int, and in -dnl POSIX 1g it is a type of its own, but some platforms use different -dnl types for the argument to getsockopt, getpeername, etc. So we -dnl have to test to find something that will work. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. -dnl This is no good, because passing the wrong pointer on C compilers is -dnl likely to only generate a warning, not an error. We don't call this at -dnl the moment. - -AC_DEFUN([TYPE_SOCKLEN_T], -[ - AC_CHECK_TYPE([socklen_t], ,[ - AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([rsync_cv_socklen_t_equiv], - [ - # Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - rsync_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do - AC_TRY_COMPILE([ -#include -#include - - int getpeername (int, $arg2 *, $t *); - ],[ - $t len; - getpeername(0,0,&len); - ],[ - rsync_cv_socklen_t_equiv="$t" - break - ]) - done - done - - if test "x$rsync_cv_socklen_t_equiv" = x; then - AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) - fi - ]) - AC_MSG_RESULT($rsync_cv_socklen_t_equiv) - AC_DEFINE_UNQUOTED(socklen_t, $rsync_cv_socklen_t_equiv, - [type to use in place of socklen_t if not defined])], - [#include -#include ]) -]) - -dnl AC_HAVE_TYPE(TYPE,INCLUDES) -AC_DEFUN([AC_HAVE_TYPE], [ -AC_REQUIRE([AC_HEADER_STDC]) -cv=`echo "$1" | sed 'y%./+- %__p__%'` -AC_MSG_CHECKING(for $1) -AC_CACHE_VAL([ac_cv_type_$cv], -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -AC_INCLUDES_DEFAULT -$2]], -[[$1 foo;]])], -[eval "ac_cv_type_$cv=yes"], -[eval "ac_cv_type_$cv=no"]))dnl -ac_foo=`eval echo \\$ac_cv_type_$cv` -AC_MSG_RESULT($ac_foo) -if test "$ac_foo" = yes; then - ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'` -if false; then - AC_CHECK_TYPES($1) -fi - AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1']) -fi -]) +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_include([m4/have_type.m4]) +m4_include([m4/socklen_t.m4]) diff -Nru rsync-3.1.1/acls.c rsync-3.1.2/acls.c --- rsync-3.1.1/acls.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/acls.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2006-2014 Wayne Davison + * Copyright (C) 2006-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/authenticate.c rsync-3.1.2/authenticate.c --- rsync-3.1.1/authenticate.c 2014-04-13 20:51:36.000000000 +0000 +++ rsync-3.1.2/authenticate.c 2015-08-24 18:54:00.000000000 +0000 @@ -2,7 +2,7 @@ * Support rsync daemon authentication. * * Copyright (C) 1998-2000 Andrew Tridgell - * Copyright (C) 2002-2014 Wayne Davison + * Copyright (C) 2002-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -279,17 +279,18 @@ /* See if authorizing user is a real user, and if so, see * if it is in a group that matches tok+1 wildmat. */ if (auth_uid_groups_cnt < 0) { - gid_t gid_list[64]; + item_list gid_list = EMPTY_ITEM_LIST; uid_t auth_uid; - auth_uid_groups_cnt = sizeof gid_list / sizeof (gid_t); if (!user_to_uid(line, &auth_uid, False) - || getallgroups(auth_uid, gid_list, &auth_uid_groups_cnt) != NULL) + || getallgroups(auth_uid, &gid_list) != NULL) auth_uid_groups_cnt = 0; else { + gid_t *gid_array = gid_list.items; + auth_uid_groups_cnt = gid_list.count; if ((auth_uid_groups = new_array(char *, auth_uid_groups_cnt)) == NULL) out_of_memory("auth_server"); for (j = 0; j < auth_uid_groups_cnt; j++) - auth_uid_groups[j] = gid_to_group(gid_list[j]); + auth_uid_groups[j] = gid_to_group(gid_array[j]); } } for (j = 0; j < auth_uid_groups_cnt; j++) { diff -Nru rsync-3.1.1/backup.c rsync-3.1.2/backup.c --- rsync-3.1.1/backup.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/backup.c 2015-08-24 04:58:18.000000000 +0000 @@ -2,7 +2,7 @@ * Backup handling code. * * Copyright (C) 1999 Andrew Tridgell - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -157,6 +157,18 @@ char *get_backup_name(const char *fname) { if (backup_dir) { + static int initialized = 0; + if (!initialized) { + int ret; + if (backup_dir_len > 1) + backup_dir_buf[backup_dir_len-1] = '\0'; + ret = make_path(backup_dir_buf, 0); + if (backup_dir_len > 1) + backup_dir_buf[backup_dir_len-1] = '/'; + if (ret < 0) + return NULL; + initialized = 1; + } /* copy fname into backup_dir_buf while validating the dirs. */ if (copy_valid_path(fname)) return backup_dir_buf; @@ -208,23 +220,24 @@ return 0; } -/* Hard-link, rename, or copy an item to the backup name. Returns 2 if item - * was duplicated into backup area, 1 if item was moved, or 0 for failure.*/ +/* Hard-link, rename, or copy an item to the backup name. Returns 0 for + * failure, 1 if item was moved, 2 if item was duplicated or hard linked + * into backup area, or 3 if item doesn't exist or isn't a regular file. */ int make_backup(const char *fname, BOOL prefer_rename) { stat_x sx; struct file_struct *file; int save_preserve_xattrs; - char *buf = get_backup_name(fname); + char *buf; int ret = 0; - if (!buf) - return 0; - init_stat_x(&sx); /* Return success if no file to keep. */ if (x_lstat(fname, &sx.st, NULL) < 0) - return 1; + return 3; + + if (!(buf = get_backup_name(fname))) + return 0; /* Try a hard-link or a rename first. Using rename is not atomic, but * is more efficient than forcing a copy for larger files when no hard- @@ -244,7 +257,7 @@ /* Fall back to making a copy. */ if (!(file = make_file(fname, NULL, &sx.st, 0, NO_FILTERS))) - return 1; /* the file could have disappeared */ + return 3; /* the file could have disappeared */ #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(file->mode)) { @@ -299,7 +312,7 @@ #ifdef SUPPORT_XATTRS uncache_tmp_xattrs(); #endif - return 2; + return 3; } /* Copy to backup tree if a file. */ diff -Nru rsync-3.1.1/batch.c rsync-3.1.2/batch.c --- rsync-3.1.1/batch.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/batch.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1999 Weiss * Copyright (C) 2004 Chris Shoemaker - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/byteorder.h rsync-3.1.2/byteorder.h --- rsync-3.1.1/byteorder.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/byteorder.h 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Simple byteorder handling. * * Copyright (C) 1992-1995 Andrew Tridgell - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/case_N.h rsync-3.1.2/case_N.h --- rsync-3.1.1/case_N.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/case_N.h 2015-08-08 19:47:03.000000000 +0000 @@ -1,7 +1,7 @@ /* * Allow an arbitrary sequence of case labels. * - * Copyright (C) 2006-2014 Wayne Davison + * Copyright (C) 2006-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/checksum.c rsync-3.1.2/checksum.c --- rsync-3.1.1/checksum.c 2014-04-19 23:26:35.000000000 +0000 +++ rsync-3.1.2/checksum.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ extern int checksum_seed; extern int protocol_version; +extern int proper_seed_order; /* a simple 32 bit checksum that can be upadted from either end @@ -54,10 +55,18 @@ if (protocol_version >= 30) { uchar seedbuf[4]; md5_begin(&m); - md5_update(&m, (uchar *)buf, len); - if (checksum_seed) { - SIVALu(seedbuf, 0, checksum_seed); - md5_update(&m, seedbuf, 4); + if (proper_seed_order) { + if (checksum_seed) { + SIVALu(seedbuf, 0, checksum_seed); + md5_update(&m, seedbuf, 4); + } + md5_update(&m, (uchar *)buf, len); + } else { + md5_update(&m, (uchar *)buf, len); + if (checksum_seed) { + SIVALu(seedbuf, 0, checksum_seed); + md5_update(&m, seedbuf, 4); + } } md5_result(&m, (uchar *)sum); } else { diff -Nru rsync-3.1.1/chmod.c rsync-3.1.2/chmod.c --- rsync-3.1.1/chmod.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/chmod.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Implement the core of the --chmod option. * * Copyright (C) 2002 Scott Howard - * Copyright (C) 2005-2014 Wayne Davison + * Copyright (C) 2005-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/cleanup.c rsync-3.1.2/cleanup.c --- rsync-3.1.1/cleanup.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/cleanup.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include "rsync.h" +extern int dry_run; extern int am_server; extern int am_daemon; extern int am_receiver; @@ -232,8 +233,9 @@ if (DEBUG_GTE(EXIT, 1)) { rprintf(FINFO, "[%s] _exit_cleanup(code=%d, file=%s, line=%d): " - "about to call exit(%d)\n", - who_am_i(), first_code, exit_file, exit_line, exit_code); + "about to call exit(%d)%s\n", + who_am_i(), first_code, exit_file, exit_line, exit_code, + dry_run ? " (DRY RUN)" : ""); } /* FALLTHROUGH */ diff -Nru rsync-3.1.1/clientname.c rsync-3.1.2/clientname.c --- rsync-3.1.1/clientname.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/clientname.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1992-2001 Andrew Tridgell * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2002-2014 Wayne Davison + * Copyright (C) 2002-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/clientserver.c rsync-3.1.2/clientserver.c --- rsync-3.1.1/clientserver.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/clientserver.c 2015-08-24 18:54:00.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1998-2001 Andrew Tridgell * Copyright (C) 2001-2002 Martin Pool - * Copyright (C) 2002-2014 Wayne Davison + * Copyright (C) 2002-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,8 +60,6 @@ extern iconv_t ic_send, ic_recv; #endif -#define MAX_GID_LIST 32 - char *auth_user; int read_only = 0; int module_id = -1; @@ -81,8 +79,7 @@ static struct sigaction sigact; #endif -static gid_t gid_list[MAX_GID_LIST]; -static int gid_count = 0; +static item_list gid_list = EMPTY_ITEM_LIST; /* Used when "reverse lookup" is off. */ const char undetermined_hostname[] = "UNDETERMINED"; @@ -438,18 +435,14 @@ static int add_a_group(int f_out, const char *gname) { - gid_t gid; + gid_t gid, *gid_p; if (!group_to_gid(gname, &gid, True)) { rprintf(FLOG, "Invalid gid %s\n", gname); io_printf(f_out, "@ERROR: invalid gid %s\n", gname); return -1; } - if (gid_count == MAX_GID_LIST) { - rprintf(FLOG, "Too many groups specified via gid parameter.\n"); - io_printf(f_out, "@ERROR: too many groups\n"); - return -1; - } - gid_list[gid_count++] = gid; + gid_p = EXPAND_ITEM_LIST(&gid_list, gid_t, -32); + *gid_p = gid; return 0; } @@ -457,8 +450,7 @@ static int want_all_groups(int f_out, uid_t uid) { const char *err; - gid_count = MAX_GID_LIST; - if ((err = getallgroups(uid, gid_list, &gid_count)) != NULL) { + if ((err = getallgroups(uid, &gid_list)) != NULL) { rsyserr(FLOG, errno, "%s", err); io_printf(f_out, "@ERROR: %s\n", err); return -1; @@ -469,14 +461,15 @@ static struct passwd *want_all_groups(int f_out, uid_t uid) { struct passwd *pw; + gid_t *gid_p; if ((pw = getpwuid(uid)) == NULL) { rsyserr(FLOG, errno, "getpwuid failed"); io_printf(f_out, "@ERROR: getpwuid failed\n"); return NULL; } - /* Start with the default group and initgroups() will add the reset. */ - gid_count = 1; - gid_list[0] = pw->pw_gid; + /* Start with the default group and initgroups() will add the rest. */ + gid_p = EXPAND_ITEM_LIST(&gid_list, gid_t, -32); + *gid_p = pw->pw_gid; return pw; } #endif @@ -818,15 +811,16 @@ } } - if (gid_count) { - if (setgid(gid_list[0])) { - rsyserr(FLOG, errno, "setgid %ld failed", (long)gid_list[0]); + if (gid_list.count) { + gid_t *gid_array = gid_list.items; + if (setgid(gid_array[0])) { + rsyserr(FLOG, errno, "setgid %ld failed", (long)gid_array[0]); io_printf(f_out, "@ERROR: setgid failed\n"); return -1; } #ifdef HAVE_SETGROUPS /* Set the group(s) we want to be active. */ - if (setgroups(gid_count, gid_list)) { + if (setgroups(gid_list.count, gid_array)) { rsyserr(FLOG, errno, "setgroups failed"); io_printf(f_out, "@ERROR: setgroups failed\n"); return -1; diff -Nru rsync-3.1.1/compat.c rsync-3.1.2/compat.c --- rsync-3.1.1/compat.c 2014-06-08 17:42:14.000000000 +0000 +++ rsync-3.1.2/compat.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) Andrew Tridgell 1996 * Copyright (C) Paul Mackerras 1996 - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ int compat_flags = 0; int use_safe_inc_flist = 0; int want_xattr_optim = 0; +int proper_seed_order = 0; extern int am_server; extern int am_sender; @@ -78,6 +79,7 @@ #define CF_SYMLINK_ICONV (1<<2) #define CF_SAFE_FLIST (1<<3) #define CF_AVOID_XATTR_OPTIM (1<<4) +#define CF_CHKSUM_SEED_FIX (1<<5) static const char *client_info; @@ -271,12 +273,15 @@ compat_flags |= CF_SAFE_FLIST; if (local_server || strchr(client_info, 'x') != NULL) compat_flags |= CF_AVOID_XATTR_OPTIM; + if (local_server || strchr(client_info, 'C') != NULL) + compat_flags |= CF_CHKSUM_SEED_FIX; write_byte(f_out, compat_flags); } else compat_flags = read_byte(f_in); /* The inc_recurse var MUST be set to 0 or 1. */ inc_recurse = compat_flags & CF_INC_RECURSE ? 1 : 0; want_xattr_optim = protocol_version >= 31 && !(compat_flags & CF_AVOID_XATTR_OPTIM); + proper_seed_order = compat_flags & CF_CHKSUM_SEED_FIX ? 1 : 0; if (am_sender) { receiver_symlink_times = am_server ? strchr(client_info, 'L') != NULL @@ -328,7 +333,7 @@ if (am_server) { if (!checksum_seed) - checksum_seed = time(NULL); + checksum_seed = time(NULL) ^ (getpid() << 6); write_int(f_out, checksum_seed); } else { checksum_seed = read_int(f_in); diff -Nru rsync-3.1.1/config.h.in rsync-3.1.2/config.h.in --- rsync-3.1.1/config.h.in 2014-06-22 17:07:34.000000000 +0000 +++ rsync-3.1.2/config.h.in 2015-12-21 20:20:53.000000000 +0000 @@ -237,7 +237,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FALLOC_H -/* True if you have Linux xattrs */ +/* True if you have Linux xattrs (or equivalent) */ #undef HAVE_LINUX_XATTRS /* Define to 1 if you have the `locale_charset' function. */ @@ -532,6 +532,9 @@ /* true if you have UnixWare ACLs */ #undef HAVE_UNIXWARE_ACLS +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME @@ -643,9 +646,6 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - /* location of configuration file for rsync server */ #undef RSYNCD_SYSCONF @@ -741,6 +741,11 @@ # endif #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS diff -Nru rsync-3.1.1/configure.ac rsync-3.1.2/configure.ac --- rsync-3.1.1/configure.ac 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/configure.ac 2015-12-21 20:00:49.000000000 +0000 @@ -1,20 +1,25 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT() +AC_INIT([rsync],[3.1.2],[http://rsync.samba.org/bugzilla.html]) + +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([byteorder.h]) AC_CONFIG_HEADER(config.h) -AC_PREREQ(2.60) +AC_PREREQ([2.69]) -RSYNC_VERSION=3.1.1 -AC_SUBST(RSYNC_VERSION) -AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION]) +AC_SUBST(RSYNC_VERSION, $PACKAGE_VERSION) +AC_MSG_NOTICE([Configuring rsync $PACKAGE_VERSION]) -AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version]) +AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$PACKAGE_VERSION"], [rsync release version]) LDFLAGS=${LDFLAGS-""} AC_CANONICAL_HOST +dnl define the directory for replacement function since AC_LIBOBJ does not +dnl officially support subdirs and fails with automake +AC_CONFIG_LIBOBJ_DIR([lib]) + # We must decide this before testing the compiler. # Please allow this to default to yes, so that your users have more @@ -22,8 +27,7 @@ AC_MSG_CHECKING([whether to include debugging symbols]) AC_ARG_ENABLE(debug, - AC_HELP_STRING([--disable-debug], - [disable debugging symbols and features])) + AS_HELP_STRING([--disable-debug],[disable debugging symbols and features])) if test x"$enable_debug" = x"no"; then AC_MSG_RESULT(no) @@ -42,6 +46,7 @@ AC_PROG_MKDIR_P AC_PROG_CC_STDC AC_SUBST(SHELL) +AC_PATH_PROG([PERL], [perl]) AC_DEFINE([_GNU_SOURCE], 1, [Define _GNU_SOURCE so that we get all necessary prototypes]) @@ -51,8 +56,7 @@ fi AC_ARG_ENABLE(profile, - AC_HELP_STRING([--enable-profile], - [turn on CPU profiling])) + AS_HELP_STRING([--enable-profile],[turn on CPU profiling])) if test x"$enable_profile" = x"yes"; then CFLAGS="$CFLAGS -pg" fi @@ -60,8 +64,7 @@ # Specifically, this turns on panic_action handling. AC_ARG_ENABLE(maintainer-mode, - AC_HELP_STRING([--enable-maintainer-mode], - [turn on extra debug features])) + AS_HELP_STRING([--enable-maintainer-mode],[turn on extra debug features])) if test x"$enable_maintainer_mode" = x"yes"; then CFLAGS="$CFLAGS -DMAINTAINER_MODE" fi @@ -77,26 +80,26 @@ fi AC_ARG_WITH(included-popt, - AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system])) + AS_HELP_STRING([--with-included-popt],[use bundled popt library, not from system])) AC_ARG_WITH(included-zlib, - AC_HELP_STRING([--with-included-zlib], [use bundled zlib library, not from system])) + AS_HELP_STRING([--with-included-zlib],[use bundled zlib library, not from system])) AC_ARG_WITH(protected-args, - AC_HELP_STRING([--with-protected-args], [make --protected-args option the default])) + AS_HELP_STRING([--with-protected-args],[make --protected-args option the default])) if test x"$with_protected_args" = x"yes"; then AC_DEFINE_UNQUOTED(RSYNC_USE_PROTECTED_ARGS, 1, [Define to 1 if --protected-args should be the default]) fi AC_ARG_WITH(rsync-path, - AC_HELP_STRING([--with-rsync-path=PATH], [set default --rsync-path to PATH (default: rsync)]), + AS_HELP_STRING([--with-rsync-path=PATH],[set default --rsync-path to PATH (default: rsync)]), [ RSYNC_PATH="$with_rsync_path" ], [ RSYNC_PATH="rsync" ]) AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine]) AC_ARG_WITH(rsyncd-conf, - AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]), + AS_HELP_STRING([--with-rsyncd-conf=PATH],[set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]), [ if test ! -z "$with_rsyncd_conf" ; then case $with_rsyncd_conf in yes|no) @@ -117,7 +120,7 @@ AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server]) AC_ARG_WITH(rsh, - AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)])) + AS_HELP_STRING([--with-rsh=CMD],[set remote shell command to CMD (default: ssh)])) AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0) if test x$HAVE_REMSH = x1; then @@ -143,8 +146,7 @@ AC_PATH_PROG(FAKEROOT_PATH, fakeroot, /usr/bin/fakeroot, [/usr/xpg4/bin$PATH_SEPARATOR$PATH]) AC_ARG_WITH(nobody-group, - AC_HELP_STRING([--with-nobody-group=GROUP], - [set the default unprivileged group (default nobody or nogroup)]), + AS_HELP_STRING([--with-nobody-group=GROUP],[set the default unprivileged group (default nobody or nogroup)]), [ NOBODY_GROUP="$with_nobody_group" ]) if test x"$with_nobody_group" = x; then @@ -165,7 +167,7 @@ # arrgh. libc in some old debian version screwed up the largefile # stuff, getting byte range locking wrong AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #define _FILE_OFFSET_BITS 64 #include #include @@ -197,8 +199,7 @@ unlink(tpl); exit(WEXITSTATUS(status)); } -], -rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)]) +]])],[rsync_cv_HAVE_BROKEN_LARGEFILE=yes],[rsync_cv_HAVE_BROKEN_LARGEFILE=no],[rsync_cv_HAVE_BROKEN_LARGEFILE=cross])]) if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then AC_SYS_LARGEFILE fi @@ -208,8 +209,7 @@ ipv6trylibc=yes AC_ARG_ENABLE(ipv6, - AC_HELP_STRING([--disable-ipv6], - [do not even try to use IPv6])) + AS_HELP_STRING([--disable-ipv6],[do not even try to use IPv6])) if test x"$enable_ipv6" != x"no"; then AC_MSG_CHECKING([ipv6 stack type]) for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do @@ -320,8 +320,7 @@ dnl Do you want to disable use of locale functions AC_ARG_ENABLE([locale], - AC_HELP_STRING([--disable-locale], - [disable locale features])) + AS_HELP_STRING([--disable-locale],[disable locale features])) AH_TEMPLATE([CONFIG_LOCALE], [Undefine if you do not want locale features. By default this is defined.]) if test x"$enable_locale" != x"no"; then @@ -352,7 +351,7 @@ AC_HEADER_MAJOR AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #ifdef MAJOR_IN_MKDEV #include @@ -370,8 +369,7 @@ exit(1); return 0; } -], -rsync_cv_MAKEDEV_TAKES_3_ARGS=yes,rsync_cv_MAKEDEV_TAKES_3_ARGS=no,rsync_cv_MAKEDEV_TAKES_3_ARGS=no)]) +]])],[rsync_cv_MAKEDEV_TAKES_3_ARGS=yes],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no])]) if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then AC_DEFINE(MAKEDEV_TAKES_3_ARGS, 1, [Define to 1 if makedev() takes 3 args]) fi @@ -390,9 +388,13 @@ AC_CHECK_SIZEOF(time_t) AC_C_INLINE -AC_C_LONG_DOUBLE -AC_TYPE_SIGNAL +AC_TYPE_LONG_DOUBLE_WIDER +ac_cv_c_long_double=$ac_cv_type_long_double_wider +if test $ac_cv_c_long_double = yes; then + AC_DEFINE([HAVE_LONG_DOUBLE],[1],[Define to 1 if the type `long double' works and has more range or precision than `double'.]) +fi + AC_TYPE_UID_T AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t]) AC_TYPE_GETGROUPS @@ -412,8 +414,7 @@ TYPE_SOCKLEN_T AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [ - AC_TRY_COMPILE([#include ],[int i = errno], - rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int i = errno]])],[rsync_cv_errno=yes],[rsync_cv_have_errno_decl=no])]) if test x"$rsync_cv_errno" = x"yes"; then AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define to 1 if errno is declared in errno.h]) fi @@ -464,7 +465,7 @@ AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include extern @@ -476,7 +477,7 @@ #else size_t iconv(); #endif -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") +]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- @@ -486,8 +487,7 @@ dnl AC_MSG_NOTICE([Looking in libraries: $LIBS]) -AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)]) -AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)]) +AC_REPLACE_FUNCS([inet_ntop inet_pton]) AC_HAVE_TYPE([struct addrinfo], [#include ]) AC_HAVE_TYPE([struct sockaddr_storage], [#include @@ -506,23 +506,19 @@ #endif], rsync_cv_HAVE_GETADDR_DEFINES=yes, rsync_cv_HAVE_GETADDR_DEFINES=no)]) -if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then +AS_IF([test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"],[ # Tru64 UNIX has getaddrinfo() but has it renamed in libc as # something else so we must include to get the # redefinition. AC_CHECK_FUNCS(getaddrinfo, , [AC_MSG_CHECKING([for getaddrinfo by including ]) - AC_TRY_LINK([#include + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include - #include ],[getaddrinfo(NULL, NULL, NULL, NULL);], - [AC_MSG_RESULT([yes]) + #include ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],[AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETADDRINFO, 1, - [Define to 1 if you have the "getaddrinfo" function and required types.])], - [AC_MSG_RESULT([no]) - AC_LIBOBJ(lib/getaddrinfo)])]) -else - AC_LIBOBJ(lib/getaddrinfo) -fi + [Define to 1 if you have the "getaddrinfo" function and required types.])],[AC_MSG_RESULT([no]) + AC_LIBOBJ([getaddrinfo])])]) + ],[AC_LIBOBJ([getaddrinfo])]) AC_CHECK_MEMBER([struct sockaddr.sa_len], [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ], @@ -602,7 +598,7 @@ setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \ seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \ extattr_get_link sigaction sigprocmask setattrlist getgrouplist \ - initgroups utimensat posix_fallocate attropen setvbuf) + initgroups utimensat posix_fallocate attropen setvbuf usleep) dnl cygwin iconv.h defines iconv_open as libiconv_open if test x"$ac_cv_func_iconv_open" != x"yes"; then @@ -612,19 +608,15 @@ dnl Preallocation stuff (also fallocate, posix_fallocate function tests above): AC_CACHE_CHECK([for useable fallocate],rsync_cv_have_fallocate,[ -AC_TRY_LINK([#include -#include ], -[fallocate(0, 0, 0, 0);], -rsync_cv_have_fallocate=yes,rsync_cv_have_fallocate=no)]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[fallocate(0, 0, 0, 0);]])],[rsync_cv_have_fallocate=yes],[rsync_cv_have_fallocate=no])]) if test x"$rsync_cv_have_fallocate" = x"yes"; then AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the fallocate function and it compiles and links without error]) fi AC_CACHE_CHECK([for SYS_fallocate],rsync_cv_have_sys_fallocate,[ -AC_TRY_COMPILE([#include -#include ], -[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);], -rsync_cv_have_sys_fallocate=yes,rsync_cv_have_sys_fallocate=no)]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);]])],[rsync_cv_have_sys_fallocate=yes],[rsync_cv_have_sys_fallocate=no])]) if test x"$rsync_cv_have_sys_fallocate" = x"yes"; then AC_DEFINE(HAVE_SYS_FALLOCATE, 1, [Define to 1 if you have the SYS_fallocate syscall number]) fi @@ -651,8 +643,7 @@ fi AC_ARG_ENABLE(iconv-open, - AC_HELP_STRING([--disable-iconv-open], - [disable all use of iconv_open() function]), + AS_HELP_STRING([--disable-iconv-open],[disable all use of iconv_open() function]), [], [enable_iconv_open=$ac_cv_func_iconv_open]) if test x"$enable_iconv_open" != x"no"; then @@ -660,8 +651,7 @@ fi AC_ARG_ENABLE(iconv, - AC_HELP_STRING([--disable-iconv], - [disable rsync's --iconv option]), + AS_HELP_STRING([--disable-iconv],[disable rsync's --iconv option]), [], [enable_iconv=$enable_iconv_open]) AH_TEMPLATE([ICONV_OPTION], [Define if you want the --iconv option. Specifing a value will set the @@ -676,7 +666,7 @@ fi AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[ - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_UNISTD_H # include #endif @@ -688,14 +678,13 @@ if (symlink("conftest.no-such", dangling_symlink) < 0) abort(); if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1); exit(0); - }], - rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)]) + }]])],[rsync_cv_chown_modifies_symlink=yes],[rsync_cv_chown_modifies_symlink=no],[rsync_cv_chown_modifies_symlink=no])]) if test $rsync_cv_chown_modifies_symlink = yes; then AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.]) fi AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[ - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_UNISTD_H # include #endif @@ -708,14 +697,13 @@ unlink(FILENAME "2"); if (link(FILENAME, FILENAME "2") < 0) exit(1); exit(0); - }], - rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)]) + }]])],[rsync_cv_can_hardlink_symlink=yes],[rsync_cv_can_hardlink_symlink=no],[rsync_cv_can_hardlink_symlink=no])]) if test $rsync_cv_can_hardlink_symlink = yes; then AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.]) fi AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[ - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_UNISTD_H # include #endif @@ -728,27 +716,25 @@ unlink(FILENAME "2"); if (link(FILENAME, FILENAME "2") < 0) exit(1); exit(0); - }], - rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)]) + }]])],[rsync_cv_can_hardlink_special=yes],[rsync_cv_can_hardlink_special=no],[rsync_cv_can_hardlink_special=no])]) if test $rsync_cv_can_hardlink_special = yes; then AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.]) fi AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include main() { int fd[2]; exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); -}], -rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) +}]])],[rsync_cv_HAVE_SOCKETPAIR=yes],[rsync_cv_HAVE_SOCKETPAIR=no],[rsync_cv_HAVE_SOCKETPAIR=cross])]) if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function]) fi -AC_CHECK_FUNCS(getpass, , [AC_LIBOBJ(lib/getpass)]) +AC_REPLACE_FUNCS([getpass]) if test x"$with_included_popt" != x"yes"; then AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) @@ -799,43 +785,37 @@ fi AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[ -AC_TRY_COMPILE([],[signed char *s = ""], -rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])]) if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type]) fi AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ -AC_TRY_RUN([#include +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && -di->d_name[0] == 0) exit(0); exit(1);} ], -rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) +di->d_name[0] == 0) exit(0); exit(1);} ]])],[rsync_cv_HAVE_BROKEN_READDIR=yes],[rsync_cv_HAVE_BROKEN_READDIR=no],[rsync_cv_HAVE_BROKEN_READDIR=cross])]) if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken]) fi AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[ -AC_TRY_COMPILE([#include -#include ], -[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));], -rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));]])],[rsync_cv_HAVE_STRUCT_UTIMBUF=yes],[rsync_cv_HAVE_STRUCT_UTIMBUF=no])]) if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type]) fi AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ -AC_TRY_COMPILE([#include -#include ], -[struct timeval tv; exit(gettimeofday(&tv, NULL));], -rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[struct timeval tv; exit(gettimeofday(&tv, NULL));]])],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=no])]) if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg]) fi AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include void foo(const char *format, ...) { @@ -853,15 +833,14 @@ exit(0); } main() { foo("hello"); } -], -rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) +]])],[rsync_cv_HAVE_C99_VSNPRINTF=yes],[rsync_cv_HAVE_C99_VSNPRINTF=no],[rsync_cv_HAVE_C99_VSNPRINTF=cross])]) if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value]) fi AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ -AC_TRY_RUN([#include +AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include #include #include @@ -874,10 +853,7 @@ if (fstat(fd, &st) != 0) exit(1); if ((st.st_mode & 0777) != 0600) exit(1); exit(0); -}], -rsync_cv_HAVE_SECURE_MKSTEMP=yes, -rsync_cv_HAVE_SECURE_MKSTEMP=no, -rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) +}]])],[rsync_cv_HAVE_SECURE_MKSTEMP=yes],[rsync_cv_HAVE_SECURE_MKSTEMP=no],[rsync_cv_HAVE_SECURE_MKSTEMP=cross])]) if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then case $host_os in hpux*) @@ -894,29 +870,27 @@ AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include main() { int rc, ec; char *fn = "fifo-test"; unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn); if (rc) {printf("(%d %d) ",rc,ec); return ec;} -return 0;}], - rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)]) +return 0;}]])],[rsync_cv_MKNOD_CREATES_FIFOS=yes],[rsync_cv_MKNOD_CREATES_FIFOS=no],[rsync_cv_MKNOD_CREATES_FIFOS=cross])]) if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.]) fi AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[ -AC_TRY_RUN([ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include main() { int rc, ec; char *fn = "sock-test"; unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn); if (rc) {printf("(%d %d) ",rc,ec); return ec;} -return 0;}], - rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)]) +return 0;}]])],[rsync_cv_MKNOD_CREATES_SOCKETS=yes],[rsync_cv_MKNOD_CREATES_SOCKETS=no],[rsync_cv_MKNOD_CREATES_SOCKETS=cross])]) if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.]) fi @@ -963,8 +937,7 @@ AC_MSG_CHECKING([whether to support ACLs]) AC_ARG_ENABLE(acl-support, - AC_HELP_STRING([--disable-acl-support], - [disable ACL support])) + AS_HELP_STRING([--disable-acl-support],[disable ACL support])) if test x"$enable_acl_support" = x"no"; then AC_MSG_RESULT(no) @@ -1010,20 +983,16 @@ AC_MSG_RESULT(running tests:) AC_CHECK_LIB(acl,acl_get_file) AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[ - AC_TRY_LINK([#include -#include ], -[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);], -samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);]])],[samba_cv_HAVE_POSIX_ACLS=yes],[samba_cv_HAVE_POSIX_ACLS=no])]) AC_MSG_CHECKING(ACL test results) if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then AC_MSG_RESULT(Using posix ACLs) AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs]) AC_DEFINE(SUPPORT_ACLS, 1) AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[ - AC_TRY_LINK([#include -#include ], -[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);], -samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);]])],[samba_cv_HAVE_ACL_GET_PERM_NP=yes],[samba_cv_HAVE_ACL_GET_PERM_NP=no])]) if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np]) fi @@ -1042,8 +1011,7 @@ # check for extended attribute support AC_MSG_CHECKING(whether to support extended attributes) AC_ARG_ENABLE(xattr-support, - AC_HELP_STRING([--disable-xattr-support], - [disable extended attributes]), + AS_HELP_STRING([--disable-xattr-support],[disable extended attributes]), [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_attropen" in *yes*) enable_xattr_support=maybe ;; *) enable_xattr_support=no ;; @@ -1054,9 +1022,9 @@ AC_MSG_RESULT(no) else case "$host_os" in - *linux*) + *linux*|*netbsd*) AC_MSG_RESULT(Using Linux xattrs) - AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs]) + AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs (or equivalent)]) AC_DEFINE(SUPPORT_XATTRS, 1) AC_DEFINE(NO_SYMLINK_USER_XATTRS, 1, [True if symlinks do not support user xattrs]) AC_CHECK_LIB(attr,getxattr) @@ -1093,7 +1061,7 @@ AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter]) OLD_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wno-unused-parameter" - AC_TRY_LINK([#include ], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("hello\n");]])],[rsync_warn_flag=yes],[rsync_warn_flag=no]) AC_MSG_RESULT([$rsync_warn_flag]) if test x"$rsync_warn_flag" = x"no"; then CFLAGS="$OLD_CFLAGS" diff -Nru rsync-3.1.1/configure.sh rsync-3.1.2/configure.sh --- rsync-3.1.1/configure.sh 2014-06-22 17:07:33.000000000 +0000 +++ rsync-3.1.2/configure.sh 2015-12-21 20:20:53.000000000 +0000 @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69 for rsync 3.1.2. # +# Report bugs to . # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -212,21 +238,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -236,7 +266,8 @@ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: http://rsync.samba.org/bugzilla.html about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -328,6 +359,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -449,6 +488,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -483,16 +526,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -504,28 +547,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -555,14 +578,15 @@ MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= +PACKAGE_NAME='rsync' +PACKAGE_TARNAME='rsync' +PACKAGE_VERSION='3.1.2' +PACKAGE_STRING='rsync 3.1.2' +PACKAGE_BUGREPORT='http://rsync.samba.org/bugzilla.html' +PACKAGE_URL='' ac_unique_file="byteorder.h" +ac_config_libobj_dir=lib # Factoring default headers for most tests. ac_includes_default="\ #include @@ -615,6 +639,7 @@ SHELL_PATH HAVE_YODL2MAN HAVE_REMSH +PERL MKDIR_P INSTALL_DATA INSTALL_SCRIPT @@ -746,7 +771,7 @@ localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' @@ -1161,8 +1186,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1248,7 +1271,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. +\`configure' configures rsync 3.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1296,7 +1319,7 @@ --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --docdir=DIR documentation root [DATAROOTDIR/doc/rsync] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1312,7 +1335,9 @@ fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of rsync 3.1.2:";; + esac cat <<\_ACEOF Optional Features: @@ -1358,7 +1383,7 @@ Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. +Report bugs to . _ACEOF ac_status=$? fi @@ -1421,10 +1446,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -configure -generated by GNU Autoconf 2.68 +rsync configure 3.1.2 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1579,7 +1604,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1699,6 +1724,10 @@ $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------------------------- ## +## Report this to http://rsync.samba.org/bugzilla.html ## +## --------------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -1733,7 +1762,8 @@ main () { static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -1749,7 +1779,8 @@ main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -1775,7 +1806,8 @@ main () { static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -1791,7 +1823,8 @@ main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -1825,7 +1858,8 @@ main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -2075,8 +2109,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by rsync $as_me 3.1.2, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2425,18 +2459,20 @@ + + ac_config_headers="$ac_config_headers config.h" -RSYNC_VERSION=3.1.1 +RSYNC_VERSION=$PACKAGE_VERSION -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring rsync $RSYNC_VERSION" >&5 -$as_echo "$as_me: Configuring rsync $RSYNC_VERSION" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring rsync $PACKAGE_VERSION" >&5 +$as_echo "$as_me: Configuring rsync $PACKAGE_VERSION" >&6;} cat >>confdefs.h <<_ACEOF -#define RSYNC_VERSION "$RSYNC_VERSION" +#define RSYNC_VERSION "$PACKAGE_VERSION" _ACEOF @@ -2543,6 +2579,8 @@ + + # We must decide this before testing the compiler. # Please allow this to default to yes, so that your users have more @@ -2588,7 +2626,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2628,7 +2666,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2681,7 +2719,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2722,7 +2760,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2780,7 +2818,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2824,7 +2862,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3270,8 +3308,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3509,7 +3546,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3575,7 +3612,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -3660,7 +3697,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -3729,7 +3766,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -3908,7 +3945,7 @@ return 0; } _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : @@ -3948,8 +3985,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -4052,6 +4088,46 @@ esac +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PERL+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h @@ -4187,7 +4263,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_REMSH="1" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4242,7 +4318,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_HAVE_YODL2MAN="1" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4289,7 +4365,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SHELL_PATH="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4330,7 +4406,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_FAKEROOT_PATH="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4472,7 +4548,7 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4518,7 +4594,7 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4542,7 +4618,7 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4587,7 +4663,7 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4611,7 +4687,7 @@ We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4643,6 +4719,8 @@ esac rm -rf conftest* fi + + fi fi @@ -6105,7 +6183,8 @@ - (LDBL_MANT_DIG < DBL_MANT_DIG))) && (int) LDBL_EPSILON == 0 )]; -test_array [0] = 0 +test_array [0] = 0; +return test_array [0]; ; return 0; @@ -6126,46 +6205,12 @@ fi - ac_cv_c_long_double=$ac_cv_type_long_double_wider - if test $ac_cv_c_long_double = yes; then +ac_cv_c_long_double=$ac_cv_type_long_double_wider +if test $ac_cv_c_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h - fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if ${ac_cv_type_signal+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int -else - ac_cv_type_signal=void fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } @@ -6911,41 +6956,32 @@ -for ac_func in inet_ntop -do : - ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" +ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" if test "x$ac_cv_func_inet_ntop" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INET_NTOP 1 -_ACEOF + $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h else case " $LIBOBJS " in - *" lib/inet_ntop.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lib/inet_ntop.$ac_objext" + *" inet_ntop.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext" ;; esac fi -done -for ac_func in inet_pton -do : - ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" +ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" if test "x$ac_cv_func_inet_pton" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INET_PTON 1 -_ACEOF + $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h else case " $LIBOBJS " in - *" lib/inet_pton.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lib/inet_pton.$ac_objext" + *" inet_pton.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext" ;; esac fi -done + @@ -7083,7 +7119,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_GETADDR_DEFINES" >&5 $as_echo "$rsync_cv_HAVE_GETADDR_DEFINES" >&6; } -if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then +if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then : + # Tru64 UNIX has getaddrinfo() but has it renamed in libc as # something else so we must include to get the # redefinition. @@ -7121,8 +7158,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } case " $LIBOBJS " in - *" lib/getaddrinfo.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lib/getaddrinfo.$ac_objext" + *" getaddrinfo.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" ;; esac @@ -7132,10 +7169,11 @@ fi done + else - case " $LIBOBJS " in - *" lib/getaddrinfo.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lib/getaddrinfo.$ac_objext" + case " $LIBOBJS " in + *" getaddrinfo.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" ;; esac @@ -7612,23 +7650,20 @@ /* end confdefs.h. */ $ac_includes_default int -find_stack_direction () +find_stack_direction (int *addr, int depth) { - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; } int -main () +main (int argc, char **argv) { - return find_stack_direction () < 0; + return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -7657,7 +7692,7 @@ setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \ seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \ extattr_get_link sigaction sigprocmask setattrlist getgrouplist \ - initgroups utimensat posix_fallocate attropen setvbuf + initgroups utimensat posix_fallocate attropen setvbuf usleep do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -8020,23 +8055,19 @@ fi -for ac_func in getpass -do : - ac_fn_c_check_func "$LINENO" "getpass" "ac_cv_func_getpass" +ac_fn_c_check_func "$LINENO" "getpass" "ac_cv_func_getpass" if test "x$ac_cv_func_getpass" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPASS 1 -_ACEOF + $as_echo "#define HAVE_GETPASS 1" >>confdefs.h else case " $LIBOBJS " in - *" lib/getpass.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lib/getpass.$ac_objext" + *" getpass.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getpass.$ac_objext" ;; esac fi -done + if test x"$with_included_popt" != x"yes"; then @@ -8559,7 +8590,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_STUNNEL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -8600,7 +8631,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_STUNNEL4="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -8868,7 +8899,7 @@ $as_echo "no" >&6; } else case "$host_os" in - *linux*) + *linux*|*netbsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using Linux xattrs" >&5 $as_echo "Using Linux xattrs" >&6; } @@ -9420,16 +9451,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -9489,28 +9520,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -9531,8 +9550,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by rsync $as_me 3.1.2, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -9587,17 +9606,17 @@ Configuration headers: $config_headers -Report bugs to the package provider." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.68, +rsync config.status 3.1.2 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -9687,7 +9706,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff -Nru rsync-3.1.1/debian/changelog rsync-3.1.2/debian/changelog --- rsync-3.1.1/debian/changelog 2016-01-19 20:01:09.000000000 +0000 +++ rsync-3.1.2/debian/changelog 2016-10-07 14:05:24.000000000 +0000 @@ -1,11 +1,28 @@ -rsync (3.1.1-3ubuntu1) xenial; urgency=medium +rsync (3.1.2-1) unstable; urgency=medium - * SECURITY UPDATE: incomplete fix for rsync path spoofing attack - - debian/patches/CVE-2014-9512-2.diff: add parent-dir validation for - --no-inc-recurse too in flist.c, generator.c. - - CVE-2014-9512 + * new upstream release + * Bumped Standards-Version to 3.9.8 (no change necessary). + * added deb-systemd-helper stuff to maintainer scripts to properly support + systemd. + closes:#764616 + * Modified the /etc/default/rsync and /usr/share/doc/rsync/README.Debian + to document how to configure the rsync daemon behaviour when using systemd. + closes:#786549 + * included copy-devices.diff patch from + https://rsync.samba.org/ftp/rsync/src/rsync-patches-3.1.2.tar.gz to + enable the --copy-devices option to copy the data inside a device instead + of copying the node. + closes:#509335 + * included time-limit.diff patch from + https://rsync.samba.org/ftp/rsync/src/rsync-patches-3.1.2.tar.gz to + enable the -stop-at and --time-limit patches to stop rsync at a certain + time or after a certain duration. + closes:#701812 + * Add description of value for --compress-level to manpage. + closes:#700697 + * Don't use hard-coded path to invoke-rc.d for check in prerm script. - -- Marc Deslauriers Tue, 19 Jan 2016 14:58:35 -0500 + -- Paul Slootman Fri, 07 Oct 2016 15:48:23 +0200 rsync (3.1.1-3) unstable; urgency=medium diff -Nru rsync-3.1.1/debian/control rsync-3.1.2/debian/control --- rsync-3.1.1/debian/control 2016-01-19 20:01:22.000000000 +0000 +++ rsync-3.1.2/debian/control 2016-10-07 13:58:17.000000000 +0000 @@ -1,16 +1,15 @@ Source: rsync Section: net Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Paul Slootman +Maintainer: Paul Slootman Build-Depends: libpopt-dev,libacl1-dev,libattr1-dev -Standards-Version: 3.9.5 +Standards-Version: 3.9.8 Homepage: http://rsync.samba.org/ Package: rsync Architecture: any Multi-Arch: foreign -Depends: ${shlibs:Depends}, lsb-base (>= 3.2-14), base-files (>= 4.0.1) +Depends: ${shlibs:Depends}, lsb-base (>= 3.2-14), base-files (>= 4.0.1), init-system-helpers (>= 1.18~) Breaks: duplicity (<< 0.6.11) Suggests: openssh-client, openssh-server Description: fast, versatile, remote (and local) file-copying tool diff -Nru rsync-3.1.1/debian/default rsync-3.1.2/debian/default --- rsync-3.1.1/debian/default 2013-09-30 14:54:04.000000000 +0000 +++ rsync-3.1.2/debian/default 2015-12-30 09:05:44.000000000 +0000 @@ -1,4 +1,10 @@ # defaults file for rsync daemon mode +# +# This file is only used for init.d based systems! +# If this system uses systemd, you can specify options etc. for rsync +# in daemon mode by copying /lib/systemd/system/rsync.service to +# /etc/systemd/system/rsync.service and modifying the copy; add required +# options to the ExecStart line. # start rsync in daemon mode from init.d script? # only allowed values are "true", "false", and "inetd" diff -Nru rsync-3.1.1/debian/patches/backup-dir-implies-backup.diff rsync-3.1.2/debian/patches/backup-dir-implies-backup.diff --- rsync-3.1.1/debian/patches/backup-dir-implies-backup.diff 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/debian/patches/backup-dir-implies-backup.diff 2016-03-29 09:07:19.000000000 +0000 @@ -0,0 +1,21 @@ +--- rsync-3.1.2.orig/options.c 2016-03-29 11:03:33.260097224 +0200 ++++ rsync-3.1.2/options.c 2016-03-29 11:03:43.859729633 +0200 +@@ -2121,6 +2121,7 @@ + } + if (backup_dir) { + size_t len; ++ make_backups = 1; /* --backup-dir implies --backup */ + while (*backup_dir == '.' && backup_dir[1] == '/') + backup_dir += 2; + if (*backup_dir == '.' && backup_dir[1] == '\0') +--- rsync-3.1.2.orig/rsync.yo 2015-12-30 11:52:56.599111311 +0100 ++++ rsync-3.1.2/rsync.yo 2016-03-29 11:04:36.767894855 +0200 +@@ -780,7 +780,7 @@ + your rules specify a trailing inclusion/exclusion of '*', the auto-added + rule would never be reached). + +-dit(bf(--backup-dir=DIR)) In combination with the bf(--backup) option, this ++dit(bf(--backup-dir=DIR)) This implies the bf(--backup) option, and + tells rsync to store all backups in the specified directory on the receiving + side. This can be used for incremental backups. You can additionally + specify a backup suffix using the bf(--suffix) option diff -Nru rsync-3.1.1/debian/patches/copy-devices.diff rsync-3.1.2/debian/patches/copy-devices.diff --- rsync-3.1.1/debian/patches/copy-devices.diff 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/debian/patches/copy-devices.diff 2016-10-07 12:54:11.000000000 +0000 @@ -0,0 +1,113 @@ +This patch adds the --copy-devices option, which will try to copy +the data inside a device instead of duplicating the device node. + +To use this patch, run these commands for a successful build: + + patch -p1 mode)) { ++ if (!(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) { + if (solo_file) + fname = f_name(file, NULL); + rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname); +diff --git a/options.c b/options.c +--- a/options.c ++++ b/options.c +@@ -50,6 +50,7 @@ int append_mode = 0; + int keep_dirlinks = 0; + int copy_dirlinks = 0; + int copy_links = 0; ++int copy_devices = 0; + int preserve_links = 0; + int preserve_hard_links = 0; + int preserve_acls = 0; +@@ -704,6 +705,7 @@ void usage(enum logcode F) + rprintf(F," -o, --owner preserve owner (super-user only)\n"); + rprintf(F," -g, --group preserve group\n"); + rprintf(F," --devices preserve device files (super-user only)\n"); ++ rprintf(F," --copy-devices copy device contents as regular file\n"); + rprintf(F," --specials preserve special files\n"); + rprintf(F," -D same as --devices --specials\n"); + rprintf(F," -t, --times preserve modification times\n"); +@@ -885,6 +887,7 @@ static struct poptOption long_options[] = { + {"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 }, + {"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 }, + {"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 }, ++ {"copy-devices", 0, POPT_ARG_NONE, ©_devices, 0, 0, 0 }, + {"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 }, + {"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 }, + {"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 }, +@@ -2762,6 +2765,9 @@ void server_options(char **args, int *argc_p) + else if (remove_source_files) + args[ac++] = "--remove-sent-files"; + ++ if (copy_devices) ++ args[ac++] = "--copy-devices"; ++ + if (preallocate_files && am_sender) + args[ac++] = "--preallocate"; + +diff --git a/rsync.c b/rsync.c +--- a/rsync.c ++++ b/rsync.c +@@ -33,6 +33,7 @@ extern int preserve_xattrs; + extern int preserve_perms; + extern int preserve_executability; + extern int preserve_times; ++extern int copy_devices; + extern int am_root; + extern int am_server; + extern int am_daemon; +@@ -404,7 +405,8 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, + + if (iflags & ITEM_TRANSFER) { + int i = ndx - cur_flist->ndx_start; +- if (i < 0 || !S_ISREG(cur_flist->files[i]->mode)) { ++ struct file_struct *file = cur_flist->files[i]; ++ if (i < 0 || !(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) { + rprintf(FERROR, + "received request to transfer non-regular file: %d [%s]\n", + ndx, who_am_i()); +diff --git a/sender.c b/sender.c +--- a/sender.c ++++ b/sender.c +@@ -365,6 +365,20 @@ void send_files(int f_in, int f_out) + exit_cleanup(RERR_FILEIO); + } + ++ /* On Matt's computer, st_size is falsely 0 for most devices. ++ * If this happens, try harder to determine the actual device size. */ ++ if (IS_DEVICE(st.st_mode) && st.st_size == 0) { ++ OFF_T off = lseek(fd, 0, SEEK_END); ++ if (off == (OFF_T) -1) ++ rsyserr(FERROR, errno, "failed to seek to end of %s to determine size", fname); ++ else { ++ st.st_size = off; ++ off = lseek(fd, 0, SEEK_SET); ++ if (off != 0) ++ rsyserr(FERROR, errno, "failed to seek back to beginning of %s to read it", fname); ++ } ++ } ++ + if (st.st_size) { + int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE); + mbuf = map_file(fd, st.st_size, read_size, s->blength); diff -Nru rsync-3.1.1/debian/patches/CVE-2014-9512-1.diff rsync-3.1.2/debian/patches/CVE-2014-9512-1.diff --- rsync-3.1.1/debian/patches/CVE-2014-9512-1.diff 2015-03-07 14:42:18.000000000 +0000 +++ rsync-3.1.2/debian/patches/CVE-2014-9512-1.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -From 962f8b90045ab331fc04c9e65f80f1a53e68243b Mon Sep 17 00:00:00 2001 -From: Wayne Davison -Date: Wed, 31 Dec 2014 12:41:03 -0800 -Subject: [PATCH 1/1] Complain if an inc-recursive path is not right for its - dir. This ensures that a malicious sender can't use a just-sent symlink as a - trasnfer path. - ---- - NEWS | 7 ++++++- - flist.c | 22 ++++++++++++++++++++-- - io.c | 2 +- - main.c | 4 ++-- - rsync.c | 2 +- - 5 files changed, 30 insertions(+), 7 deletions(-) - -diff --git a/NEWS b/NEWS ---- a/NEWS -+++ b/NEWS -@@ -4,6 +4,10 @@ - - BUG FIXES: - -+ - Make sure that an inc-recursive transfer includes the right directory- -+ name prefixes for each dir. This makes it impossible for a malicious -+ sender to use a just-sent symlink as a path in a transfer. -+ - - If the receiver gets bogus filenames from the sender (an unexpected - leading slash or a ".." infix dir), exit with an error. This prevents a - malicious sender from trying to inject filenames that would affect an -diff --git a/flist.c b/flist.c -index c24672e..92e4b65 100644 ---- a/flist.c -+++ b/flist.c -@@ -2435,8 +2435,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) - return flist; - } - --struct file_list *recv_file_list(int f) -+struct file_list *recv_file_list(int f, int dir_ndx) - { -+ const char *good_dirname = NULL; - struct file_list *flist; - int dstart, flags; - int64 start_read; -@@ -2492,6 +2493,23 @@ struct file_list *recv_file_list(int f) - flist_expand(flist, 1); - file = recv_file_entry(f, flist, flags); - -+ if (inc_recurse) { -+ static const char empty_dir[] = "\0"; -+ const char *cur_dir = file->dirname ? file->dirname : empty_dir; -+ if (relative_paths && *cur_dir == '/') -+ cur_dir++; -+ if (cur_dir != good_dirname) { -+ const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir; -+ if (strcmp(cur_dir, d) != 0) { -+ rprintf(FERROR, -+ "ABORTING due to invalid dir prefix from sender: %s (should be: %s)\n", -+ cur_dir, d); -+ exit_cleanup(RERR_PROTOCOL); -+ } -+ good_dirname = cur_dir; -+ } -+ } -+ - if (S_ISREG(file->mode)) { - /* Already counted */ - } else if (S_ISDIR(file->mode)) { -@@ -2615,7 +2633,7 @@ void recv_additional_file_list(int f) - rprintf(FINFO, "[%s] receiving flist for dir %d\n", - who_am_i(), ndx); - } -- flist = recv_file_list(f); -+ flist = recv_file_list(f, ndx); - flist->parent_ndx = ndx; - } - } -diff --git a/io.c b/io.c -index b9a9bd0..a868fa9 100644 ---- a/io.c -+++ b/io.c -@@ -1685,7 +1685,7 @@ void wait_for_receiver(void) - rprintf(FINFO, "[%s] receiving flist for dir %d\n", - who_am_i(), ndx); - } -- flist = recv_file_list(iobuf.in_fd); -+ flist = recv_file_list(iobuf.in_fd, ndx); - flist->parent_ndx = ndx; - #ifdef SUPPORT_HARD_LINKS - if (preserve_hard_links) -diff --git a/main.c b/main.c -index e7a13f7..713b818 100644 ---- a/main.c -+++ b/main.c -@@ -1009,7 +1009,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[]) - filesfrom_fd = -1; - } - -- flist = recv_file_list(f_in); -+ flist = recv_file_list(f_in, -1); - if (!flist) { - rprintf(FERROR,"server_recv: recv_file_list error\n"); - exit_cleanup(RERR_FILESELECT); -@@ -1183,7 +1183,7 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]) - - if (write_batch && !am_server) - start_write_batch(f_in); -- flist = recv_file_list(f_in); -+ flist = recv_file_list(f_in, -1); - if (inc_recurse && file_total == 1) - recv_additional_file_list(f_in); - -diff --git a/rsync.c b/rsync.c -index 68ff6b1..c3ecc51 100644 ---- a/rsync.c -+++ b/rsync.c -@@ -364,7 +364,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, - } - /* Send all the data we read for this flist to the generator. */ - start_flist_forward(ndx); -- flist = recv_file_list(f_in); -+ flist = recv_file_list(f_in, ndx); - flist->parent_ndx = ndx; - stop_flist_forward(); - } --- -1.9.1 - diff -Nru rsync-3.1.1/debian/patches/CVE-2014-9512-2.diff rsync-3.1.2/debian/patches/CVE-2014-9512-2.diff --- rsync-3.1.1/debian/patches/CVE-2014-9512-2.diff 2016-01-19 19:59:23.000000000 +0000 +++ rsync-3.1.2/debian/patches/CVE-2014-9512-2.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -From e12a6c087ca1eecdb8eae5977be239c24f4dd3d9 Mon Sep 17 00:00:00 2001 -From: Wayne Davison -Date: Sat, 4 Jul 2015 16:08:08 -0700 -Subject: [PATCH] Add parent-dir validation for --no-inc-recurse too. - ---- - flist.c | 32 ++++++++++++++++++++++++++++++-- - generator.c | 14 ++++++++++++++ - 2 files changed, 44 insertions(+), 2 deletions(-) - -diff --git a/flist.c b/flist.c -index 92e4b65..0817a4a 100644 ---- a/flist.c -+++ b/flist.c -@@ -2502,8 +2502,8 @@ struct file_list *recv_file_list(int f, int dir_ndx) - const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir; - if (strcmp(cur_dir, d) != 0) { - rprintf(FERROR, -- "ABORTING due to invalid dir prefix from sender: %s (should be: %s)\n", -- cur_dir, d); -+ "ABORTING due to invalid path from sender: %s/%s\n", -+ cur_dir, file->basename); - exit_cleanup(RERR_PROTOCOL); - } - good_dirname = cur_dir; -@@ -2689,6 +2689,34 @@ int flist_find(struct file_list *flist, struct file_struct *f) - return -1; - } - -+/* Search for a name in the file list. You must specify want_dir_match as: -+ * 1=match directories, 0=match non-directories, or -1=match either. */ -+int flist_find_name(struct file_list *flist, const char *fname, int want_dir_match) -+{ -+ struct { /* We have to create a temporary file_struct for the search. */ -+ struct file_struct f; -+ char name_space[MAXPATHLEN]; -+ } t; -+ char fbuf[MAXPATHLEN]; -+ const char *slash = strrchr(fname, '/'); -+ const char *basename = slash ? slash+1 : fname; -+ -+ memset(&t.f, 0, FILE_STRUCT_LEN); -+ memcpy((void *)t.f.basename, basename, strlen(basename)+1); -+ -+ if (slash) { -+ strlcpy(fbuf, fname, slash - fname + 1); -+ t.f.dirname = fbuf; -+ } else -+ t.f.dirname = NULL; -+ -+ t.f.mode = want_dir_match > 0 ? S_IFDIR : S_IFREG; -+ -+ if (want_dir_match < 0) -+ return flist_find_ignore_dirness(flist, &t.f); -+ return flist_find(flist, &t.f); -+} -+ - /* Search for an identically-named item in the file list. Differs from - * flist_find in that an item that agrees with "f" in directory-ness is - * preferred but one that does not is still found. */ -diff --git a/generator.c b/generator.c -index 91009a5..e3fc284 100644 ---- a/generator.c -+++ b/generator.c -@@ -1177,6 +1177,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, - int itemizing, enum logcode code, int f_out) - { - static const char *parent_dirname = ""; -+ static struct file_struct *prior_dir_file = NULL; - /* Missing dir not created due to --dry-run; will still be scanned. */ - static struct file_struct *dry_missing_dir = NULL; - /* Missing dir whose contents are skipped altogether due to -@@ -1256,6 +1257,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, - const char *dn = file->dirname ? file->dirname : "."; - dry_missing_dir = NULL; - if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) { -+ /* Each parent dir must be in the file list or the flist data is bad. -+ * Optimization: most of the time the parent dir will be the last dir -+ * this function was asked to process in the file list. */ -+ if (!inc_recurse -+ && (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */ -+ && (prior_dir_file && strcmp(dn, f_name(prior_dir_file, NULL)) != 0) -+ && flist_find_name(cur_flist, dn, 1) < 0) { -+ rprintf(FERROR, -+ "ABORTING due to invalid path from sender: %s/%s\n", -+ dn, file->basename); -+ exit_cleanup(RERR_PROTOCOL); -+ } - if (relative_paths && !implied_dirs - && do_stat(dn, &sx.st) < 0) { - if (dry_run) -@@ -1467,6 +1480,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, - else - change_local_filter_dir(fname, strlen(fname), F_DEPTH(file)); - } -+ prior_dir_file = file; - goto cleanup; - } - --- -1.9.1 - diff -Nru rsync-3.1.1/debian/patches/manpage-compress-level.diff rsync-3.1.2/debian/patches/manpage-compress-level.diff --- rsync-3.1.1/debian/patches/manpage-compress-level.diff 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/debian/patches/manpage-compress-level.diff 2015-12-30 10:58:31.000000000 +0000 @@ -0,0 +1,26 @@ +--- rsync-3.1.2.orig/rsync.1 2015-12-30 11:56:19.518738015 +0100 ++++ rsync-3.1.2/rsync.1 2015-12-30 11:56:42.434609727 +0100 +@@ -2167,7 +2167,9 @@ + .IP + .IP "\fB\-\-compress\-level=NUM\fP" + Explicitly set the compression level to use +-(see \fB\-\-compress\fP) instead of letting it default. If NUM is non\-zero, ++(see \fB\-\-compress\fP) instead of letting it default. Allowed values for NUM ++are between 0 and 9; default when \fB\-\-compress\fP option is specified is 6. ++If NUM is non\-zero, + the \fB\-\-compress\fP option is implied. + .IP + .IP "\fB\-\-skip\-compress=LIST\fP" +--- rsync-3.1.2.orig/rsync.yo 2015-12-30 11:47:24.180646652 +0100 ++++ rsync-3.1.2/rsync.yo 2015-12-30 11:47:27.477198899 +0100 +@@ -1907,7 +1907,9 @@ + that will not be compressed. + + dit(bf(--compress-level=NUM)) Explicitly set the compression level to use +-(see bf(--compress)) instead of letting it default. If NUM is non-zero, ++(see bf(--compress)) instead of letting it default. Allowed values for NUM ++are between 0 and 9; default when bf(--compress) option is specified is 6. ++If NUM is non-zero, + the bf(--compress) option is implied. + + dit(bf(--skip-compress=LIST)) Override the list of file suffixes that will diff -Nru rsync-3.1.1/debian/patches/README rsync-3.1.2/debian/patches/README --- rsync-3.1.1/debian/patches/README 2015-03-07 14:43:09.000000000 +0000 +++ rsync-3.1.2/debian/patches/README 2016-03-29 09:09:30.000000000 +0000 @@ -5,12 +5,11 @@ If you're wondering about the lack of patches, the explanation is that upstream has adopted most of them :-) -CVE-2014-9512.diff - prevent path spoofing attack vulnerability - (the original git diff is modified to update NEWS - cleanly) logdir.diff - fix the location of the logdir ssh-6-option.diff - call ssh with -6 option if rsync was called with -6, ditto with -4 noatime.diff - add an option --noatime to request the kernel not to update files' access times while reading them. See https://bugzilla.samba.org/show_bug.cgi?id=7249#c5 +manpage-compress-level.diff - describe value for --compress-level +backup-dir-implies-backup.diff - passing --backup-dir=xxx implies --backup diff -Nru rsync-3.1.1/debian/patches/time-limit.diff rsync-3.1.2/debian/patches/time-limit.diff --- rsync-3.1.1/debian/patches/time-limit.diff 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/debian/patches/time-limit.diff 2016-10-07 13:09:00.000000000 +0000 @@ -0,0 +1,348 @@ +John Taylor's patch for implementing --time-limit and --stop-at, reworked +to be simpler and more efficient by Wayne Davison. + +Do we need configure support for mktime()? + +To use this patch, run these commands for a successful build: + + patch -p1 = stop_at_utime) { ++ rprintf(FERROR, "run-time limit exceeded\n"); ++ exit_cleanup(RERR_TIMEOUT); ++ } ++ ++ if (!io_timeout) ++ return; ++ + if (allow_keepalive) { + /* This may put data into iobuf.msg w/o flushing. */ + maybe_send_keepalive(t, keepalive_flags); +diff --git a/options.c b/options.c +--- a/options.c ++++ b/options.c +@@ -115,6 +115,7 @@ size_t bwlimit_writemax = 0; + int ignore_existing = 0; + int ignore_non_existing = 0; + int need_messages_from_generator = 0; ++time_t stop_at_utime = 0; + int max_delete = INT_MIN; + OFF_T max_size = -1; + OFF_T min_size = -1; +@@ -791,6 +792,8 @@ void usage(enum logcode F) + rprintf(F," --password-file=FILE read daemon-access password from FILE\n"); + rprintf(F," --list-only list the files instead of copying them\n"); + rprintf(F," --bwlimit=RATE limit socket I/O bandwidth\n"); ++ rprintf(F," --stop-at=y-m-dTh:m Stop rsync at year-month-dayThour:minute\n"); ++ rprintf(F," --time-limit=MINS Stop rsync after MINS minutes have elapsed\n"); + #ifdef HAVE_SETVBUF + rprintf(F," --outbuf=N|L|B set output buffering to None, Line, or Block\n"); + #endif +@@ -819,6 +822,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, + OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE, + OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, + OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, ++ OPT_STOP_AT, OPT_TIME_LIMIT, + OPT_SERVER, OPT_REFUSED_BASE = 9000}; + + static struct poptOption long_options[] = { +@@ -1014,6 +1018,8 @@ static struct poptOption long_options[] = { + {"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 }, + {"contimeout", 0, POPT_ARG_INT, &connect_timeout, 0, 0, 0 }, + {"no-contimeout", 0, POPT_ARG_VAL, &connect_timeout, 0, 0, 0 }, ++ {"stop-at", 0, POPT_ARG_STRING, 0, OPT_STOP_AT, 0, 0 }, ++ {"time-limit", 0, POPT_ARG_STRING, 0, OPT_TIME_LIMIT, 0, 0 }, + {"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 }, + {"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 }, + {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 }, +@@ -1785,6 +1791,36 @@ int parse_arguments(int *argc_p, const char ***argv_p) + return 0; + #endif + ++ case OPT_STOP_AT: ++ arg = poptGetOptArg(pc); ++ if ((stop_at_utime = parse_time(arg)) == (time_t)-1) { ++ snprintf(err_buf, sizeof err_buf, ++ "invalid --stop-at format: %s\n", ++ arg); ++ rprintf(FERROR, "ERROR: %s", err_buf); ++ return 0; ++ } ++ if (stop_at_utime < time(NULL)) { ++ snprintf(err_buf, sizeof err_buf, ++ "--stop-at time is in the past: %s\n", ++ arg); ++ rprintf(FERROR, "ERROR: %s", err_buf); ++ return 0; ++ } ++ break; ++ ++ case OPT_TIME_LIMIT: ++ arg = poptGetOptArg(pc); ++ if ((stop_at_utime = atol(arg) * 60) <= 0) { ++ snprintf(err_buf, sizeof err_buf, ++ "invalid --time-limit value: %s\n", ++ arg); ++ rprintf(FERROR, "ERROR: %s", err_buf); ++ return 0; ++ } ++ stop_at_utime += time(NULL); ++ break; ++ + default: + /* A large opt value means that set_refuse_options() + * turned this option off. */ +@@ -2584,6 +2620,15 @@ void server_options(char **args, int *argc_p) + args[ac++] = arg; + } + ++ if (stop_at_utime) { ++ long mins = (stop_at_utime - time(NULL)) / 60; ++ if (mins <= 0) ++ mins = 1; ++ if (asprintf(&arg, "--time-limit=%ld", mins) < 0) ++ goto oom; ++ args[ac++] = arg; ++ } ++ + if (backup_dir) { + args[ac++] = "--backup-dir"; + args[ac++] = backup_dir; +diff --git a/rsync.yo b/rsync.yo +--- a/rsync.yo ++++ b/rsync.yo +@@ -451,6 +451,8 @@ to the detailed description below for a complete description. verb( + --password-file=FILE read daemon-access password from FILE + --list-only list the files instead of copying them + --bwlimit=RATE limit socket I/O bandwidth ++ --stop-at=y-m-dTh:m Stop rsync at year-month-dayThour:minute ++ --time-limit=MINS Stop rsync after MINS minutes have elapsed + --write-batch=FILE write a batched update to FILE + --only-write-batch=FILE like --write-batch but w/o updating dest + --read-batch=FILE read a batched update from FILE +@@ -2524,6 +2526,19 @@ files can show up as being rapidly sent when the data is quickly buffered, + while other can show up as very slow when the flushing of the output buffer + occurs. This may be fixed in a future version. + ++dit(bf(--stop-at=y-m-dTh:m)) This option allows you to specify at what ++time to stop rsync, in year-month-dayThour:minute numeric format (e.g. ++2004-12-31T23:59). You can specify a 2 or 4-digit year. You can also ++leave off various items and the result will be the next possible time ++that matches the specified data. For example, "1-30" specifies the next ++January 30th (at midnight), "04:00" specifies the next 4am, "1" ++specifies the next 1st of the month at midnight, and ":59" specifies the ++next 59th minute after the hour. If you prefer, you may separate the ++date numbers using slashes instead of dashes. ++ ++dit(bf(--time-limit=MINS)) This option allows you to specify the maximum ++number of minutes rsync will run for. ++ + dit(bf(--write-batch=FILE)) Record a file that can later be applied to + another identical destination with bf(--read-batch). See the "BATCH MODE" + section for details, and also the bf(--only-write-batch) option. +diff --git a/util.c b/util.c +--- a/util.c ++++ b/util.c +@@ -115,6 +115,133 @@ void print_child_argv(const char *prefix, char **cmd) + rprintf(FCLIENT, " (%d args)\n", cnt); + } + ++/* Allow the user to specify a time in the format yyyy-mm-ddThh:mm while ++ * also allowing abbreviated data. For instance, if the time is omitted, ++ * it defaults to midnight. If the date is omitted, it defaults to the ++ * next possible date in the future with the specified time. Even the ++ * year or year-month can be omitted, again defaulting to the next date ++ * in the future that matches the specified information. A 2-digit year ++ * is also OK, as is using '/' instead of '-'. */ ++time_t parse_time(const char *arg) ++{ ++ const char *cp; ++ time_t val, now = time(NULL); ++ struct tm t, *today = localtime(&now); ++ int in_date, n; ++ ++ memset(&t, 0, sizeof t); ++ t.tm_year = t.tm_mon = t.tm_mday = -1; ++ t.tm_hour = t.tm_min = t.tm_isdst = -1; ++ cp = arg; ++ if (*cp == 'T' || *cp == 't' || *cp == ':') { ++ cp++; ++ in_date = 0; ++ } else ++ in_date = 1; ++ for ( ; ; cp++) { ++ if (!isDigit(cp)) ++ return -1; ++ ++ n = 0; ++ do { ++ n = n * 10 + *cp++ - '0'; ++ } while (isDigit(cp)); ++ ++ if (*cp == ':') ++ in_date = 0; ++ if (in_date) { ++ if (t.tm_year != -1) ++ return -1; ++ t.tm_year = t.tm_mon; ++ t.tm_mon = t.tm_mday; ++ t.tm_mday = n; ++ if (!*cp) ++ break; ++ if (*cp == 'T' || *cp == 't') { ++ if (!cp[1]) ++ break; ++ in_date = 0; ++ } else if (*cp != '-' && *cp != '/') ++ return -1; ++ continue; ++ } ++ if (t.tm_hour != -1) ++ return -1; ++ t.tm_hour = t.tm_min; ++ t.tm_min = n; ++ if (!*cp) ++ break; ++ if (*cp != ':') ++ return -1; ++ } ++ ++ in_date = 0; ++ if (t.tm_year < 0) { ++ t.tm_year = today->tm_year; ++ in_date = 1; ++ } else if (t.tm_year < 100) { ++ while (t.tm_year < today->tm_year) ++ t.tm_year += 100; ++ } else ++ t.tm_year -= 1900; ++ if (t.tm_mon < 0) { ++ t.tm_mon = today->tm_mon; ++ in_date = 2; ++ } else ++ t.tm_mon--; ++ if (t.tm_mday < 0) { ++ t.tm_mday = today->tm_mday; ++ in_date = 3; ++ } ++ ++ n = 0; ++ if (t.tm_min < 0) { ++ t.tm_hour = t.tm_min = 0; ++ } else if (t.tm_hour < 0) { ++ if (in_date != 3) ++ return -1; ++ in_date = 0; ++ t.tm_hour = today->tm_hour; ++ n = 60*60; ++ } ++ ++ if (t.tm_hour > 23 || t.tm_min > 59 ++ || t.tm_mon < 0 || t.tm_mon >= 12 ++ || t.tm_mday < 1 || t.tm_mday > 31 ++ || (val = mktime(&t)) == (time_t)-1) ++ return -1; ++ ++ if (val <= now && in_date) { ++ tweak_date: ++ switch (in_date) { ++ case 3: ++ t.tm_mday++; ++ break; ++ case 2: ++ if (++t.tm_mon == 12) ++ t.tm_mon = 0; ++ else ++ break; ++ case 1: ++ t.tm_year++; ++ break; ++ } ++ if ((val = mktime(&t)) == (time_t)-1) { ++ if (in_date == 3 && t.tm_mday > 28) { ++ t.tm_mday = 1; ++ in_date = 2; ++ goto tweak_date; ++ } ++ return -1; ++ } ++ } ++ if (n) { ++ while (val <= now) ++ val += n; ++ } ++ return val; ++} ++ + /* This returns 0 for success, 1 for a symlink if symlink time-setting + * is not possible, or -1 for any other error. */ + int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode) +diff -Nurp a/proto.h b/proto.h +--- a/proto.h ++++ b/proto.h +@@ -354,6 +354,7 @@ void set_nonblocking(int fd); + void set_blocking(int fd); + int fd_pair(int fd[2]); + void print_child_argv(const char *prefix, char **cmd); ++time_t parse_time(const char *arg); + int set_modtime(const char *fname, time_t modtime, uint32 mod_nsec, mode_t mode); + int make_path(char *fname, int flags); + int full_write(int desc, const char *ptr, size_t len); +diff -Nurp a/rsync.1 b/rsync.1 +--- a/rsync.1 ++++ b/rsync.1 +@@ -527,6 +527,8 @@ to the detailed description below for a + \-\-password\-file=FILE read daemon\-access password from FILE + \-\-list\-only list the files instead of copying them + \-\-bwlimit=RATE limit socket I/O bandwidth ++ \-\-stop\-at=y\-m\-dTh:m Stop rsync at year\-month\-dayThour:minute ++ \-\-time\-limit=MINS Stop rsync after MINS minutes have elapsed + \-\-write\-batch=FILE write a batched update to FILE + \-\-only\-write\-batch=FILE like \-\-write\-batch but w/o updating dest + \-\-read\-batch=FILE read a batched update from FILE +@@ -2872,6 +2874,21 @@ files can show up as being rapidly sent + while other can show up as very slow when the flushing of the output buffer + occurs. This may be fixed in a future version. + .IP ++.IP "\fB\-\-stop\-at=y\-m\-dTh:m\fP" ++This option allows you to specify at what ++time to stop rsync, in year\-month\-dayThour:minute numeric format (e.g. ++2004\-12\-31T23:59). You can specify a 2 or 4\-digit year. You can also ++leave off various items and the result will be the next possible time ++that matches the specified data. For example, \(dq\&1\-30\(dq\& specifies the next ++January 30th (at midnight), \(dq\&04:00\(dq\& specifies the next 4am, \(dq\&1\(dq\& ++specifies the next 1st of the month at midnight, and \(dq\&:59\(dq\& specifies the ++next 59th minute after the hour. If you prefer, you may separate the ++date numbers using slashes instead of dashes. ++.IP ++.IP "\fB\-\-time\-limit=MINS\fP" ++This option allows you to specify the maximum ++number of minutes rsync will run for. ++.IP + .IP "\fB\-\-write\-batch=FILE\fP" + Record a file that can later be applied to + another identical destination with \fB\-\-read\-batch\fP. See the \(dq\&BATCH MODE\(dq\& diff -Nru rsync-3.1.1/debian/postinst rsync-3.1.2/debian/postinst --- rsync-3.1.1/debian/postinst 2013-09-30 15:26:00.000000000 +0000 +++ rsync-3.1.2/debian/postinst 2015-12-30 08:14:18.000000000 +0000 @@ -13,18 +13,24 @@ update-rc.d -f rsync remove fi - update-rc.d rsync defaults - if [ -x /usr/sbin/invoke-rc.d ]; then - invoke-rc.d rsync restart - else - /etc/init.d/rsync restart - fi + update-rc.d rsync defaults >/dev/null + invoke-rc.d rsync restart fi -# # Remove shutdown and reboot links; this init script does not need them. -# # The wildcards are needed as we can't predict the number anymore... -# if dpkg --compare-versions "$oldversion" lt "3.0.7-2"; then -# rm -f /etc/rc0.d/K??rsync /etc/rc1.d/K??rsync /etc/rc6.d/K??rsync -# fi +## from /usr/share/debhelper/autoscripts/postinst-systemd-enable : + +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask rsync.service >/dev/null || true + +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled rsync.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable rsync.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state rsync.service >/dev/null || true +fi exit 0 diff -Nru rsync-3.1.1/debian/postrm rsync-3.1.2/debian/postrm --- rsync-3.1.1/debian/postrm 2013-09-30 14:54:04.000000000 +0000 +++ rsync-3.1.2/debian/postrm 2015-12-30 08:16:54.000000000 +0000 @@ -5,4 +5,18 @@ update-rc.d rsync remove >/dev/null fi +## from /usr/share/debhelper/autoscripts/postrm-systemd : + +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask rsync.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge rsync.service >/dev/null + deb-systemd-helper unmask rsync.service >/dev/null + fi +fi exit 0 diff -Nru rsync-3.1.1/debian/prerm rsync-3.1.2/debian/prerm --- rsync-3.1.1/debian/prerm 2013-09-30 14:54:04.000000000 +0000 +++ rsync-3.1.2/debian/prerm 2016-10-07 14:03:20.000000000 +0000 @@ -1,29 +1,41 @@ #!/bin/sh -e # prerm for rsync +pathfind() { + OLDIFS="$IFS" + IFS=: + for p in $PATH; do + if [ -x "$p/$*" ]; then + IFS="$OLDIFS" + return 0 + fi + done + IFS="$OLDIFS" + return 1 +} + + case "$1" in - remove|deconfigure) - if [ -h /usr/doc/rsync ]; then - rm -f /usr/doc/rsync - fi - if [ -x /etc/init.d/rsync ]; then - if [ -x /usr/sbin/invoke-rc.d ]; then - invoke-rc.d rsync stop - else - /etc/init.d/rsync stop + remove|deconfigure) + if [ -h /usr/doc/rsync ]; then + rm -f /usr/doc/rsync fi - fi - ;; - upgrade) - if [ -h /usr/doc/rsync ]; then - rm -f /usr/doc/rsync - fi - ;; - failed-upgrade) - ;; - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 0 + if [ -x /etc/init.d/rsync ]; then + if pathfind invoke-rc.d; then + invoke-rc.d rsync stop + else + /etc/init.d/rsync stop + fi + fi + if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop rsync.service >/dev/null + fi + ;; + upgrade|failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 0 ;; esac diff -Nru rsync-3.1.1/debian/README.Debian rsync-3.1.2/debian/README.Debian --- rsync-3.1.1/debian/README.Debian 2014-07-10 11:16:54.000000000 +0000 +++ rsync-3.1.2/debian/README.Debian 2015-12-30 09:05:16.000000000 +0000 @@ -1,10 +1,17 @@ rsync for Debian ---------------- -To let rsync's init.d script do its work, you need to edit /etc/default/rsync +If you still have an init.d based system, you need to edit /etc/default/rsync by hand to set RSYNC_ENABLE=true +so that the init.d script will try to start the daemon. -You also need an /etc/rsyncd.conf file as described by the rsyncd.conf -manpage; you can look at /usr/share/doc/rsync/examples/rsyncd.conf as an -example. +Note that this is not necessary for systemd-based systems; i.e. the default +in jessie! To override options for the rsync daemon on these systems, copy +/lib/systemd/system/rsync.service to /etc/systemd/system/rsync.service and +modify the copy; add required options to the ExecStart line. + +You will need an /etc/rsyncd.conf file as described by the rsyncd.conf +manpage for rsync to do anything useful as a daemon (the daemon won't +start otherwise); you can look at +/usr/share/doc/rsync/examples/rsyncd.conf as an example. diff -Nru rsync-3.1.1/debian/rules rsync-3.1.2/debian/rules --- rsync-3.1.1/debian/rules 2014-08-09 09:00:36.000000000 +0000 +++ rsync-3.1.2/debian/rules 2016-10-07 13:51:56.000000000 +0000 @@ -59,9 +59,13 @@ -rm -rf debian/buildtree mkdir debian/buildtree cp -p * debian/buildtree || true - cp -r lib popt support testsuite zlib debian/buildtree + cp -pr lib m4 popt support testsuite zlib debian/buildtree + # work around newer autoconf stuff (runstatedir) + touch debian/buildtree/aclocal.m4 @echo applying misc Debian patches for i in debian/patches/*.patch debian/patches/*.diff; do if [ -s $$i ]; then echo " $$i ..."; cat $$i | (cd debian/buildtree; patch -p1) || exit 1; fi; done + # work around newer autoconf stuff (runstatedir) + touch debian/buildtree/configure.sh debian/buildtree/config.h.in @echo configuring (cd debian/buildtree; ./configure --with-included-zlib=yes --prefix=/usr --mandir='$${prefix}/share/man' --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) LDFLAGS="$(LDFLAGS)") @echo building @@ -111,7 +115,7 @@ $(INSTALL_FILE) debian/README.Debian debian/tmp/usr/share/doc/rsync/ echo -e '\n\f' >> debian/tmp/usr/share/doc/rsync/changelog cat OLDNEWS >> debian/tmp/usr/share/doc/rsync/changelog - gzip -9fr `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ -type f` + gzip -9frn `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ -type f` $(INSTALL_FILE) debian/rsyncd.conf debian/logrotate.conf.rsync debian/tmp/usr/share/doc/rsync/examples/ $(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/rsync/ # $(INSTALL_SCRIPT) test.sh debian/tmp/usr/lib/debian-test/tests/rsync diff -Nru rsync-3.1.1/delete.c rsync-3.1.2/delete.c --- rsync-3.1.1/delete.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/delete.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/errcode.h rsync-3.1.2/errcode.h --- rsync-3.1.1/errcode.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/errcode.h 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Error codes returned by rsync. * * Copyright (C) 1998-2000 Andrew Tridgell - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/exclude.c rsync-3.1.2/exclude.c --- rsync-3.1.1/exclude.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/exclude.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,52 +100,44 @@ static void teardown_mergelist(filter_rule *ex) { + int j; + + if (!ex->u.mergelist) + return; + if (DEBUG_GTE(FILTER, 2)) { rprintf(FINFO, "[%s] deactivating mergelist #%d%s\n", who_am_i(), mergelist_cnt - 1, ex->u.mergelist->debug_type); } - /* We should deactivate mergelists in LIFO order. */ - assert(mergelist_cnt > 0); - assert(ex == mergelist_parents[mergelist_cnt - 1]); - - /* The parent_dirscan filters should have been freed. */ - assert(ex->u.mergelist->parent_dirscan_head == NULL); - free(ex->u.mergelist->debug_type); free(ex->u.mergelist); - mergelist_cnt--; + + for (j = 0; j < mergelist_cnt; j++) { + if (mergelist_parents[j] == ex) { + mergelist_parents[j] = NULL; + break; + } + } + while (mergelist_cnt && mergelist_parents[mergelist_cnt-1] == NULL) + mergelist_cnt--; } static void free_filter(filter_rule *ex) { + if (ex->rflags & FILTRULE_PERDIR_MERGE) + teardown_mergelist(ex); free(ex->pattern); free(ex); } -static void free_filters(filter_rule *head) +static void free_filters(filter_rule *ent) { - filter_rule *rev_head = NULL; - - /* Reverse the list so we deactivate mergelists in the proper LIFO - * order. */ - while (head) { - filter_rule *next = head->next; - head->next = rev_head; - rev_head = head; - head = next; - } - - while (rev_head) { - filter_rule *prev = rev_head->next; - /* Tear down mergelists here, not in free_filter, so that we - * affect only real filter lists and not temporarily allocated - * filters. */ - if (rev_head->rflags & FILTRULE_PERDIR_MERGE) - teardown_mergelist(rev_head); - free_filter(rev_head); - rev_head = prev; + while (ent) { + filter_rule *next = ent->next; + free_filter(ent); + ent = next; } } @@ -252,7 +244,10 @@ * add it again. */ for (i = 0; i < mergelist_cnt; i++) { filter_rule *ex = mergelist_parents[i]; - const char *s = strrchr(ex->pattern, '/'); + const char *s; + if (!ex) + continue; + s = strrchr(ex->pattern, '/'); if (s) s++; else @@ -264,9 +259,8 @@ } } - if (!(lp = new_array(filter_rule_list, 1))) + if (!(lp = new_array0(filter_rule_list, 1))) out_of_memory("add_rule"); - lp->head = lp->tail = lp->parent_dirscan_head = NULL; if (asprintf(&lp->debug_type, " [per-dir %s]", cp) < 0) out_of_memory("add_rule"); rule->u.mergelist = lp; @@ -297,16 +291,23 @@ } } -static void clear_filter_list(filter_rule_list *listp) +/* This frees any non-inherited items, leaving just inherited items on the list. */ +static void pop_filter_list(filter_rule_list *listp) { - if (listp->tail) { - /* Truncate any inherited items from the local list. */ - listp->tail->next = NULL; - /* Now free everything that is left. */ - free_filters(listp->head); - } + filter_rule *inherited; + + if (!listp->tail) + return; + + inherited = listp->tail->next; - listp->head = listp->tail = NULL; + /* Truncate any inherited items from the local list. */ + listp->tail->next = NULL; + /* Now free everything that is left. */ + free_filters(listp->head); + + listp->head = inherited; + listp->tail = NULL; } /* This returns an expanded (absolute) filename for the merge-file name if @@ -457,8 +458,6 @@ strlcpy(y, save, MAXPATHLEN); while ((*x++ = *y++) != '/') {} } - /* Save current head for freeing when the mergelist becomes inactive. */ - lp->parent_dirscan_head = lp->head; parent_dirscan = False; if (DEBUG_GTE(FILTER, 2)) { rprintf(FINFO, "[%s] completed parent_dirscan for mergelist #%d%s\n", @@ -501,15 +500,20 @@ push->mergelist_cnt = mergelist_cnt; for (i = 0; i < mergelist_cnt; i++) { - memcpy(&push->mergelists[i], mergelist_parents[i]->u.mergelist, - sizeof (filter_rule_list)); + filter_rule *ex = mergelist_parents[i]; + if (!ex) + continue; + memcpy(&push->mergelists[i], ex->u.mergelist, sizeof (filter_rule_list)); } /* Note: parse_filter_file() might increase mergelist_cnt, so keep * this loop separate from the above loop. */ for (i = 0; i < mergelist_cnt; i++) { filter_rule *ex = mergelist_parents[i]; - filter_rule_list *lp = ex->u.mergelist; + filter_rule_list *lp; + if (!ex) + continue; + lp = ex->u.mergelist; if (DEBUG_GTE(FILTER, 2)) { rprintf(FINFO, "[%s] pushing mergelist #%d%s\n", @@ -553,44 +557,38 @@ for (i = mergelist_cnt; i-- > 0; ) { filter_rule *ex = mergelist_parents[i]; - filter_rule_list *lp = ex->u.mergelist; + filter_rule_list *lp; + if (!ex) + continue; + lp = ex->u.mergelist; if (DEBUG_GTE(FILTER, 2)) { rprintf(FINFO, "[%s] popping mergelist #%d%s\n", who_am_i(), i, lp->debug_type); } - clear_filter_list(lp); - - if (i >= old_mergelist_cnt) { - /* This mergelist does not exist in the state to be - * restored. Free its parent_dirscan list to clean up - * any per-dir mergelists defined there so we don't - * crash trying to restore nonexistent state for them - * below. (Counterpart to setup_merge_file call in - * push_local_filters. Must be done here, not in - * free_filter, for LIFO order.) */ + pop_filter_list(lp); + if (i >= old_mergelist_cnt && lp->head) { + /* This mergelist does not exist in the state to be restored, but it + * still has inherited rules. This can sometimes happen if a per-dir + * merge file calls setup_merge_file() in push_local_filters() and that + * leaves some inherited rules that aren't in the pushed list state. */ if (DEBUG_GTE(FILTER, 2)) { rprintf(FINFO, "[%s] freeing parent_dirscan filters of mergelist #%d%s\n", who_am_i(), i, ex->u.mergelist->debug_type); } - free_filters(lp->parent_dirscan_head); - lp->parent_dirscan_head = NULL; + pop_filter_list(lp); } } - /* If we cleaned things up properly, the only still-active mergelists - * should be those with a state to be restored. */ - assert(mergelist_cnt == old_mergelist_cnt); - - if (!pop) { - /* No state to restore. */ - return; - } + if (!pop) + return; /* No state to restore. */ - for (i = 0; i < mergelist_cnt; i++) { - memcpy(mergelist_parents[i]->u.mergelist, &pop->mergelists[i], - sizeof (filter_rule_list)); + for (i = 0; i < old_mergelist_cnt; i++) { + filter_rule *ex = mergelist_parents[i]; + if (!ex) + continue; + memcpy(ex->u.mergelist, &pop->mergelists[i], sizeof (filter_rule_list)); } free(pop); @@ -872,7 +870,7 @@ switch (ch) { case ':': rule->rflags |= FILTRULE_PERDIR_MERGE - | FILTRULE_FINISH_SETUP; + | FILTRULE_FINISH_SETUP; /* FALL THROUGH */ case '.': rule->rflags |= FILTRULE_MERGE_FILE; @@ -1093,7 +1091,8 @@ "[%s] clearing filter list%s\n", who_am_i(), listp->debug_type); } - clear_filter_list(listp); + pop_filter_list(listp); + listp->head = NULL; goto free_continue; } diff -Nru rsync-3.1.1/fileio.c rsync-3.1.2/fileio.c --- rsync-3.1.1/fileio.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/fileio.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1998 Andrew Tridgell * Copyright (C) 2002 Martin Pool - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/flist.c rsync-3.1.2/flist.c --- rsync-3.1.1/flist.c 2014-06-13 23:05:08.000000000 +0000 +++ rsync-3.1.2/flist.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2002-2014 Wayne Davison + * Copyright (C) 2002-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2435,8 +2435,9 @@ return flist; } -struct file_list *recv_file_list(int f) +struct file_list *recv_file_list(int f, int dir_ndx) { + const char *good_dirname = NULL; struct file_list *flist; int dstart, flags; int64 start_read; @@ -2492,6 +2493,23 @@ flist_expand(flist, 1); file = recv_file_entry(f, flist, flags); + if (inc_recurse) { + static const char empty_dir[] = "\0"; + const char *cur_dir = file->dirname ? file->dirname : empty_dir; + if (relative_paths && *cur_dir == '/') + cur_dir++; + if (cur_dir != good_dirname) { + const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir; + if (strcmp(cur_dir, d) != 0) { + rprintf(FERROR, + "ABORTING due to invalid path from sender: %s/%s\n", + cur_dir, file->basename); + exit_cleanup(RERR_PROTOCOL); + } + good_dirname = cur_dir; + } + } + if (S_ISREG(file->mode)) { /* Already counted */ } else if (S_ISDIR(file->mode)) { @@ -2615,7 +2633,7 @@ rprintf(FINFO, "[%s] receiving flist for dir %d\n", who_am_i(), ndx); } - flist = recv_file_list(f); + flist = recv_file_list(f, ndx); flist->parent_ndx = ndx; } } @@ -2671,6 +2689,34 @@ return -1; } +/* Search for a name in the file list. You must specify want_dir_match as: + * 1=match directories, 0=match non-directories, or -1=match either. */ +int flist_find_name(struct file_list *flist, const char *fname, int want_dir_match) +{ + struct { /* We have to create a temporary file_struct for the search. */ + struct file_struct f; + char name_space[MAXPATHLEN]; + } t; + char fbuf[MAXPATHLEN]; + const char *slash = strrchr(fname, '/'); + const char *basename = slash ? slash+1 : fname; + + memset(&t.f, 0, FILE_STRUCT_LEN); + memcpy((void *)t.f.basename, basename, strlen(basename)+1); + + if (slash) { + strlcpy(fbuf, fname, slash - fname + 1); + t.f.dirname = fbuf; + } else + t.f.dirname = NULL; + + t.f.mode = want_dir_match > 0 ? S_IFDIR : S_IFREG; + + if (want_dir_match < 0) + return flist_find_ignore_dirness(flist, &t.f); + return flist_find(flist, &t.f); +} + /* Search for an identically-named item in the file list. Differs from * flist_find in that an item that agrees with "f" in directory-ness is * preferred but one that does not is still found. */ diff -Nru rsync-3.1.1/generator.c rsync-3.1.2/generator.c --- rsync-3.1.1/generator.c 2014-06-13 23:05:08.000000000 +0000 +++ rsync-3.1.2/generator.c 2015-12-05 19:10:24.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -895,23 +895,21 @@ } while (basis_dir[++j] != NULL); if (!match_level) - return -1; + goto got_nothing_for_ya; if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); if (link_stat(cmpbuf, &sxp->st, 0) < 0) - return -1; + goto got_nothing_for_ya; } if (match_level == 3 && !copy_dest) { if (find_exact_for_existing) { if (link_dest && real_st.st_dev == sxp->st.st_dev && real_st.st_ino == sxp->st.st_ino) return -1; - if (do_unlink(fname) < 0 && errno != ENOENT) { - sxp->st = real_st; - return -1; - } + if (do_unlink(fname) < 0 && errno != ENOENT) + goto got_nothing_for_ya; } #ifdef SUPPORT_HARD_LINKS if (link_dest) { @@ -935,10 +933,8 @@ return -2; } - if (find_exact_for_existing) { - sxp->st = real_st; - return -1; - } + if (find_exact_for_existing) + goto got_nothing_for_ya; if (match_level >= 2) { #ifdef SUPPORT_HARD_LINKS @@ -946,7 +942,7 @@ #endif if (!dry_run && copy_altdest_file(cmpbuf, fname, file) < 0) { if (find_exact_for_existing) /* Can get here via hard-link failure */ - sxp->st = real_st; + goto got_nothing_for_ya; return -1; } if (itemizing) @@ -966,6 +962,10 @@ } return FNAMECMP_BASIS_DIR_LOW + j; + +got_nothing_for_ya: + sxp->st = real_st; + return -1; } /* This is only called for non-regular files. We return -2 if we've finished @@ -1177,6 +1177,7 @@ int itemizing, enum logcode code, int f_out) { static const char *parent_dirname = ""; + static struct file_struct *prior_dir_file = NULL; /* Missing dir not created due to --dry-run; will still be scanned. */ static struct file_struct *dry_missing_dir = NULL; /* Missing dir whose contents are skipped altogether due to @@ -1256,6 +1257,18 @@ const char *dn = file->dirname ? file->dirname : "."; dry_missing_dir = NULL; if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) { + /* Each parent dir must be in the file list or the flist data is bad. + * Optimization: most of the time the parent dir will be the last dir + * this function was asked to process in the file list. */ + if (!inc_recurse + && (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */ + && (prior_dir_file && strcmp(dn, f_name(prior_dir_file, NULL)) != 0) + && flist_find_name(cur_flist, dn, 1) < 0) { + rprintf(FERROR, + "ABORTING due to invalid path from sender: %s/%s\n", + dn, file->basename); + exit_cleanup(RERR_PROTOCOL); + } if (relative_paths && !implied_dirs && do_stat(dn, &sx.st) < 0) { if (dry_run) @@ -1467,6 +1480,7 @@ else change_local_filter_dir(fname, strlen(fname), F_DEPTH(file)); } + prior_dir_file = file; goto cleanup; } diff -Nru rsync-3.1.1/getgroups.c rsync-3.1.2/getgroups.c --- rsync-3.1.1/getgroups.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/getgroups.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * `id -G` on Linux, but it's too hard to find a portable equivalent. * * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as diff -Nru rsync-3.1.1/.gitignore rsync-3.1.2/.gitignore --- rsync-3.1.1/.gitignore 2013-06-15 23:40:10.000000000 +0000 +++ rsync-3.1.2/.gitignore 2015-05-01 21:26:21.000000000 +0000 @@ -12,6 +12,7 @@ config.h.in.old config.log config.status +aclocal.m4 /proto.h /proto.h-tstamp /rsync.1 @@ -44,3 +45,4 @@ /testsuite/devices-fake.test /testsuite/xattrs-hlink.test /patches +.deps diff -Nru rsync-3.1.1/hashtable.c rsync-3.1.2/hashtable.c --- rsync-3.1.1/hashtable.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/hashtable.c 2015-08-08 19:47:03.000000000 +0000 @@ -1,7 +1,7 @@ /* * Routines to provide a memory-efficient hashtable. * - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/hlink.c rsync-3.1.2/hlink.c --- rsync-3.1.1/hlink.c 2014-06-13 23:05:08.000000000 +0000 +++ rsync-3.1.2/hlink.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/ifuncs.h rsync-3.1.2/ifuncs.h --- rsync-3.1.1/ifuncs.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/ifuncs.h 2015-08-08 19:47:03.000000000 +0000 @@ -1,6 +1,6 @@ /* Inline functions for rsync. * - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/inums.h rsync-3.1.2/inums.h --- rsync-3.1.1/inums.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/inums.h 2015-08-08 19:47:03.000000000 +0000 @@ -1,6 +1,6 @@ /* Inline functions for rsync. * - * Copyright (C) 2008-2014 Wayne Davison + * Copyright (C) 2008-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/io.c rsync-3.1.2/io.c --- rsync-3.1.1/io.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/io.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1685,7 +1685,7 @@ rprintf(FINFO, "[%s] receiving flist for dir %d\n", who_am_i(), ndx); } - flist = recv_file_list(iobuf.in_fd); + flist = recv_file_list(iobuf.in_fd, ndx); flist->parent_ndx = ndx; #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links) @@ -2283,7 +2283,7 @@ if (len < 0) exit_cleanup(RERR_PROTOCOL); - if (len > (int)sizeof buf) { + if (len >= (int)sizeof buf) { rprintf(FERROR, "io_printf() was too long for the buffer.\n"); exit_cleanup(RERR_PROTOCOL); } diff -Nru rsync-3.1.1/io.h rsync-3.1.2/io.h --- rsync-3.1.1/io.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/io.h 2015-08-08 19:47:03.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/itypes.h rsync-3.1.2/itypes.h --- rsync-3.1.1/itypes.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/itypes.h 2015-08-08 19:47:03.000000000 +0000 @@ -1,6 +1,6 @@ /* Inline functions for rsync. * - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/lib/compat.c rsync-3.1.2/lib/compat.c --- rsync-3.1.1/lib/compat.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/compat.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1998 Andrew Tridgell * Copyright (C) 2002 Martin Pool - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/lib/mdfour.c rsync-3.1.2/lib/mdfour.c --- rsync-3.1.1/lib/mdfour.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/mdfour.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * An implementation of MD4 designed for use in the SMB authentication protocol. * * Copyright (C) 1997-1998 Andrew Tridgell - * Copyright (C) 2005-2014 Wayne Davison + * Copyright (C) 2005-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/lib/permstring.c rsync-3.1.2/lib/permstring.c --- rsync-3.1.1/lib/permstring.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/permstring.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/lib/sysacls.c rsync-3.1.2/lib/sysacls.c --- rsync-3.1.1/lib/sysacls.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/sysacls.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Unix SMB/CIFS implementation. * Based on the Samba ACL support code. * Copyright (C) Jeremy Allison 2000. - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * The permission functions have been changed to get/set all bits via * one call. Some functions that rsync doesn't need were also removed. diff -Nru rsync-3.1.1/lib/sysacls.h rsync-3.1.2/lib/sysacls.h --- rsync-3.1.1/lib/sysacls.h 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/sysacls.h 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * Version 2.2.x * Portable SMB ACL interface * Copyright (C) Jeremy Allison 2000 - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/lib/sysxattrs.c rsync-3.1.2/lib/sysxattrs.c --- rsync-3.1.1/lib/sysxattrs.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/lib/sysxattrs.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Extended attribute support for rsync. * * Copyright (C) 2004 Red Hat, Inc. - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * Written by Jay Fenlason. * * This program is free software; you can redistribute it and/or modify diff -Nru rsync-3.1.1/loadparm.c rsync-3.1.2/loadparm.c --- rsync-3.1.1/loadparm.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/loadparm.c 2015-08-08 19:47:03.000000000 +0000 @@ -17,7 +17,7 @@ * and Karl Auer. Some of the changes are: * * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison */ /* Load parameters. diff -Nru rsync-3.1.1/log.c rsync-3.1.2/log.c --- rsync-3.1.1/log.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/log.c 2015-09-07 17:07:17.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1998-2001 Andrew Tridgell * Copyright (C) 2000-2001 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -656,21 +656,10 @@ n = auth_user; break; case 'b': - if (!(iflags & ITEM_TRANSFER)) - b = 0; - else if (am_sender) - b = total_data_written - initial_data_written; - else - b = total_data_read - initial_data_read; - strlcat(fmt, "s", sizeof fmt); - snprintf(buf2, sizeof buf2, fmt, - do_big_num(b, humanize, NULL)); - n = buf2; - break; case 'c': if (!(iflags & ITEM_TRANSFER)) b = 0; - else if (!am_sender) + else if ((!!am_sender) ^ (*p == 'c')) b = total_data_written - initial_data_written; else b = total_data_read - initial_data_read; diff -Nru rsync-3.1.1/m4/have_type.m4 rsync-3.1.2/m4/have_type.m4 --- rsync-3.1.1/m4/have_type.m4 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/m4/have_type.m4 2015-04-27 00:54:06.000000000 +0000 @@ -0,0 +1,22 @@ +dnl AC_HAVE_TYPE(TYPE,INCLUDES) +AC_DEFUN([AC_HAVE_TYPE], [ +AC_REQUIRE([AC_HEADER_STDC]) +cv=`echo "$1" | sed 'y%./+- %__p__%'` +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL([ac_cv_type_$cv], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_INCLUDES_DEFAULT +$2]], +[[$1 foo;]])], +[eval "ac_cv_type_$cv=yes"], +[eval "ac_cv_type_$cv=no"]))dnl +ac_foo=`eval echo \\$ac_cv_type_$cv` +AC_MSG_RESULT($ac_foo) +if test "$ac_foo" = yes; then + ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'` +if false; then + AC_CHECK_TYPES($1) +fi + AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1']) +fi +]) diff -Nru rsync-3.1.1/m4/socklen_t.m4 rsync-3.1.2/m4/socklen_t.m4 --- rsync-3.1.1/m4/socklen_t.m4 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/m4/socklen_t.m4 2015-04-27 00:54:06.000000000 +0000 @@ -0,0 +1,45 @@ +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc. So we +dnl have to test to find something that will work. + +dnl This is no good, because passing the wrong pointer on C compilers is +dnl likely to only generate a warning, not an error. We don't call this at +dnl the moment. + +AC_DEFUN([TYPE_SOCKLEN_T], +[ + AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([rsync_cv_socklen_t_equiv], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + rsync_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ +#include +#include + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + rsync_cv_socklen_t_equiv="$t" + break + ]) + done + done + + if test "x$rsync_cv_socklen_t_equiv" = x; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_MSG_RESULT($rsync_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $rsync_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include ]) +]) diff -Nru rsync-3.1.1/m4/validate_cache_system_type.m4 rsync-3.1.2/m4/validate_cache_system_type.m4 --- rsync-3.1.1/m4/validate_cache_system_type.m4 1970-01-01 00:00:00.000000000 +0000 +++ rsync-3.1.2/m4/validate_cache_system_type.m4 2015-04-27 00:54:06.000000000 +0000 @@ -0,0 +1,23 @@ +dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN([AC_VALIDATE_CACHE_SYSTEM_TYPE], [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([config.cache system type]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) + else + AC_MSG_RESULT([same]) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) diff -Nru rsync-3.1.1/main.c rsync-3.1.2/main.c --- rsync-3.1.1/main.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/main.c 2015-08-24 04:58:18.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,6 +76,7 @@ extern unsigned int module_dirlen; extern BOOL flist_receiving_enabled; extern BOOL shutting_down; +extern int backup_dir_len; extern int basis_dir_cnt; extern struct stats stats; extern char *stdout_format; @@ -850,13 +851,25 @@ } if (backup_dir) { - int ret = make_path(backup_dir_buf, MKP_DROP_NAME); /* drops trailing slash */ - if (ret < 0) - exit_cleanup(RERR_SYNTAX); - if (ret) - rprintf(FINFO, "Created backup_dir %s\n", backup_dir_buf); - else if (INFO_GTE(BACKUP, 1)) + STRUCT_STAT st; + int ret; + if (backup_dir_len > 1) + backup_dir_buf[backup_dir_len-1] = '\0'; + ret = do_stat(backup_dir_buf, &st); + if (ret != 0 || !S_ISDIR(st.st_mode)) { + if (ret == 0) { + rprintf(FERROR, "The backup-dir is not a directory: %s\n", backup_dir_buf); + exit_cleanup(RERR_SYNTAX); + } + if (errno != ENOENT) { + rprintf(FERROR, "Failed to stat %s: %s\n", backup_dir_buf, strerror(errno)); + exit_cleanup(RERR_FILEIO); + } + rprintf(FINFO, "(new) backup_dir is %s\n", backup_dir_buf); + } else if (INFO_GTE(BACKUP, 1)) rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf); + if (backup_dir_len > 1) + backup_dir_buf[backup_dir_len-1] = '/'; } io_flush(FULL_FLUSH); @@ -1009,7 +1022,7 @@ filesfrom_fd = -1; } - flist = recv_file_list(f_in); + flist = recv_file_list(f_in, -1); if (!flist) { rprintf(FERROR,"server_recv: recv_file_list error\n"); exit_cleanup(RERR_FILESELECT); @@ -1183,7 +1196,7 @@ if (write_batch && !am_server) start_write_batch(f_in); - flist = recv_file_list(f_in); + flist = recv_file_list(f_in, -1); if (inc_recurse && file_total == 1) recv_additional_file_list(f_in); @@ -1411,12 +1424,12 @@ } -static RETSIGTYPE sigusr1_handler(UNUSED(int val)) +static void sigusr1_handler(UNUSED(int val)) { exit_cleanup(RERR_SIGNAL1); } -static RETSIGTYPE sigusr2_handler(UNUSED(int val)) +static void sigusr2_handler(UNUSED(int val)) { if (!am_server) output_summary(); @@ -1426,7 +1439,7 @@ _exit(0); } -RETSIGTYPE remember_children(UNUSED(int val)) +void remember_children(UNUSED(int val)) { #ifdef WNOHANG int cnt, status; @@ -1487,7 +1500,7 @@ * should just look at the environment variable, but I'm a bit leery * of a signal sending us into a busy loop. **/ -static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig)) +static void rsync_panic_handler(UNUSED(int whatsig)) { char cmd_buf[300]; int ret, pid_int = getpid(); diff -Nru rsync-3.1.1/Makefile.in rsync-3.1.2/Makefile.in --- rsync-3.1.1/Makefile.in 2013-06-15 23:40:10.000000000 +0000 +++ rsync-3.1.2/Makefile.in 2015-12-19 00:09:58.000000000 +0000 @@ -14,6 +14,7 @@ CPPFLAGS=@CPPFLAGS@ EXEEXT=@EXEEXT@ LDFLAGS=@LDFLAGS@ +LIBOBJDIR=lib/ INSTALLCMD=@INSTALL@ INSTALLMAN=@INSTALL@ @@ -28,7 +29,7 @@ .SUFFIXES: .SUFFIXES: .c .o -GENFILES=configure.sh config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5 +GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \ lib/pool_alloc.h LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \ @@ -74,12 +75,12 @@ install-ssl-client: rsync-ssl stunnel-rsync -${MKDIR_P} ${DESTDIR}${bindir} - ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync-ssl ${DESTDIR}${bindir} - ${INSTALLCMD} ${INSTALL_STRIP} -m 755 stunnel-rsync ${DESTDIR}${bindir} + ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir} + ${INSTALLCMD} -m 755 stunnel-rsync ${DESTDIR}${bindir} install-ssl-daemon: stunnel-rsyncd.conf -${MKDIR_P} ${DESTDIR}/etc/stunnel - ${INSTALLCMD} ${INSTALL_STRIP} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf + ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \ echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \ fi @@ -138,11 +139,14 @@ gen: conf proto.h man gensend: gen - rsync -aivzc $(GENFILES) samba.org:/home/ftp/pub/rsync/generated-files/ + rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/ conf: cd $(srcdir) && $(MAKE) -f prepare-source.mak conf +aclocal.m4: $(srcdir)/m4/*.m4 + aclocal -I $(srcdir)/m4 + configure.sh config.h.in: configure.ac aclocal.m4 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi @@ -303,21 +307,10 @@ splint: splint +unixlib +gnuextensions -weak rsync.c - -rsync.dvi: doc/rsync.texinfo - texi2dvi -o $@ $< - -rsync.ps: rsync.dvi - dvips -ta4 -o $@ $< - -rsync.pdf: doc/rsync.texinfo - texi2dvi -o $@ --pdf $< - - doxygen: cd $(srcdir) && rm dox/html/* && doxygen # for maintainers only doxygen-upload: rsync -avzv $(srcdir)/dox/html/ --delete \ - samba.org:/home/httpd/html/rsync/doxygen/head/ + $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/ diff -Nru rsync-3.1.1/match.c rsync-3.1.2/match.c --- rsync-3.1.1/match.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/match.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/NEWS rsync-3.1.2/NEWS --- rsync-3.1.1/NEWS 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/NEWS 2015-12-21 20:00:49.000000000 +0000 @@ -1,115 +1,47 @@ -NEWS for rsync 3.1.1 (22 Jun 2014) +NEWS for rsync 3.1.2 (21 Dec 2015) Protocol: 31 (unchanged) -Changes since 3.1.0: +Changes since 3.1.1: - BUG FIXES: - - - If the receiver gets bogus filenames from the sender (an unexpected - leading slash or a ".." infix dir), exit with an error. This prevents a - malicious sender from trying to inject filenames that would affect an - area outside the destination directories. - - - Fixed a failure to remove the partial-transfer temp file when interrupted - (and rsync is not saving the partial files). - - - Changed the chown/group/xattr-set order to avoid losing some security- - related xattr info (that would get cleared by a chown). - - - Fixed a bug in the xattr-finding code that could make a non-root-run - receiver not able to find some xattr numbers. - - - Fixed a bug in the early daemon protocol where a timeout failed to be - honored (e.g. if the remote side fails to send us the initial protocol - greeting). - - - Fixed unintended inclusion of commas in file numbers in the daemon log. - - - We once again send the 'f' sub-flag (of -e) to the server side so it - knows that we can handle incremental-recursion directory errors properly - in older protocols. - - - Fixed an issue with too-aggressive keep-alive messages causing a problem - for older rsync versions early in the transfer. - - - Fixed an incorrect message about backup-directory-creation when using - --dry-run and the backup dir is not an absolute path. - - - Fixed a bug where a failed deletion and/or a failed sender-side removal - would not affect the exit code. - - - Fixed a bug that caused a failure when combining --delete-missing-args - with --xattrs and/or --acls. - - - Fixed a strange dir_depth assertion error that was caused by empty-dir - removals and/or duplicate files in the transfer. - - - Fixed a problem with --info=progress2's output stats where rsync would - only update the stats at the end of each file's transfer. It now uses - the data that is flowing for the current file, making the stats more - accurate and less jumpy. - - - Fixed an itemize bug that affected the combo of --link-dest, -X, and -n. - - - Fixed a problem with delete messages not appearing in the log file when - the user didn't use --verbose. + SECURITY FIXES: - - Improve chunked xattr reading for OS X. + - Make sure that all transferred files use only path names from inside the + transfer. This makes it impossible for a malicious sender to try to make + the receiver use an unsafe destination path for a transferred file, such + as a just-sent symlink. - - Removed an attempted hard-link xattr optimization that was causing a - transfer failure. This removal is flagged in the compatibility code, so - if a better fix can be discovered, we have a way to flip it on again. - - - Fixed a bug when the receiver is not configured to be able to hard link - symlimks/devices/special-file items but the sender sent some of these - items flagged as hard-linked. - - - We now generate a better error if the buffer overflows in do_mknod(). - - - Fixed a problem reading more than 16 ACLs on some OSes. - - - Fixed the reading of the secrets file to avoid an infinite wait when - the username is missing. - - - Fixed a parsing problem in the --usermap/--groupmap options when using - MIN-MAX numbers. - - - Switched Cygwin back to using socketpair "pipes" to try to speed it up. + BUG FIXES: - - Added knowledge of a few new options to rrsync. + - Change the checksum seed order in the per-block checksums. This prevents + someone from trying to create checksum blocks that match in sum but not + content. + - Fixed a with the per-dir filter files (using -FF) that could trigger an + assert failure. + - Only skip set_modtime() on a transferred file if the time is exactly + right. + - Don't create an empty backup dir for a transferred file that doesn't + exist yet. + - Fixed a bug where --link-dest and --xattrs could cause rsync to exit if + a filename had a matching dir of the same name in the alt-dest area. + - Allow more than 32 group IDs per user in the daemon's gid=LIST config. + - Fix the logging of %b & %c via --log-file (daemon logging was already + correct, as was --out-format='%b/%c'). + - Fix erroneous acceptance of --info=5 & --debug=5 (an empty flag name is + not valid). ENHANCEMENTS: - - Tweaked the temp-file naming when --temp-dir=DIR is used: the temp-file - names will not get a '.' prepended. - - - Added support for a new-compression idiom that does not compress all the - matching data in a transfer. This can help rsync to use less cpu when a - transfer has a lot of matching data, and also makes rsync compatible with - a non-bundled zlib. See the --new-compress and --old-compress options in - the manpage. - - - Added the support/rsync-no-vanished wrapper script. - - - Made configure more prominently mention when we failed to find yodl (in - case the user wants to be able to generate manpages from *.yo files). - - - Have manpage mention how a daemon's max-verbosity setting affects info - and debug options. Also added more clarification on backslash removals - for excludes that contain wildcards. - - - Have configure check if for the attr lib (for getxattr) for those systems - that need to link against it explicitly. - - - Change the early dir-creation logic to only use that idiom in an - inc-recursive copy that is preserving directory times. e.g. using - --omit-dir-times will avoid these early directories being created. - - - Fix a bug in cmp_time() that would return a wrong result if the 2 times - differed by an amount greater than what a time_t can hold. + - Added "(DRY RUN)" info to the --debug=exit output line. + - Use usleep() for our msleep() function if it is available. + - Added a few extra long-option names to rrsync script, which will make + BackupPC happier. + - Made configure choose to use linux xattrs on netbsd (rather than not + supporting xattrs). + - Added -wo (write-only) option to rrsync support script. + - Misc. manpage tweaks. DEVELOPER RELATED: - - We now include an example systemd file (in packaging/systemd). - - - Tweaked configure to make sure that any intended use of the included popt - and/or zlib code is put early in the CFLAGS. + - Fixed a bug with the Makefile's use of INSTALL_STRIP. + - Improve a test in the suite that could get an erroneous timestamp error. + - Tweaks for newer versions of git in the packaging tools. + - Improved the m4 generation rules and some autoconf idioms. diff -Nru rsync-3.1.1/OLDNEWS rsync-3.1.2/OLDNEWS --- rsync-3.1.1/OLDNEWS 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/OLDNEWS 2015-12-21 20:00:49.000000000 +0000 @@ -1,3 +1,119 @@ +NEWS for rsync 3.1.1 (22 Jun 2014) +Protocol: 31 (unchanged) +Changes since 3.1.0: + + BUG FIXES: + + - If the receiver gets bogus filenames from the sender (an unexpected + leading slash or a ".." infix dir), exit with an error. This prevents a + malicious sender from trying to inject filenames that would affect an + area outside the destination directories. + + - Fixed a failure to remove the partial-transfer temp file when interrupted + (and rsync is not saving the partial files). + + - Changed the chown/group/xattr-set order to avoid losing some security- + related xattr info (that would get cleared by a chown). + + - Fixed a bug in the xattr-finding code that could make a non-root-run + receiver not able to find some xattr numbers. + + - Fixed a bug in the early daemon protocol where a timeout failed to be + honored (e.g. if the remote side fails to send us the initial protocol + greeting). + + - Fixed unintended inclusion of commas in file numbers in the daemon log. + + - We once again send the 'f' sub-flag (of -e) to the server side so it + knows that we can handle incremental-recursion directory errors properly + in older protocols. + + - Fixed an issue with too-aggressive keep-alive messages causing a problem + for older rsync versions early in the transfer. + + - Fixed an incorrect message about backup-directory-creation when using + --dry-run and the backup dir is not an absolute path. + + - Fixed a bug where a failed deletion and/or a failed sender-side removal + would not affect the exit code. + + - Fixed a bug that caused a failure when combining --delete-missing-args + with --xattrs and/or --acls. + + - Fixed a strange dir_depth assertion error that was caused by empty-dir + removals and/or duplicate files in the transfer. + + - Fixed a problem with --info=progress2's output stats where rsync would + only update the stats at the end of each file's transfer. It now uses + the data that is flowing for the current file, making the stats more + accurate and less jumpy. + + - Fixed an itemize bug that affected the combo of --link-dest, -X, and -n. + + - Fixed a problem with delete messages not appearing in the log file when + the user didn't use --verbose. + + - Improve chunked xattr reading for OS X. + + - Removed an attempted hard-link xattr optimization that was causing a + transfer failure. This removal is flagged in the compatibility code, so + if a better fix can be discovered, we have a way to flip it on again. + + - Fixed a bug when the receiver is not configured to be able to hard link + symlimks/devices/special-file items but the sender sent some of these + items flagged as hard-linked. + + - We now generate a better error if the buffer overflows in do_mknod(). + + - Fixed a problem reading more than 16 ACLs on some OSes. + + - Fixed the reading of the secrets file to avoid an infinite wait when + the username is missing. + + - Fixed a parsing problem in the --usermap/--groupmap options when using + MIN-MAX numbers. + + - Switched Cygwin back to using socketpair "pipes" to try to speed it up. + + - Added knowledge of a few new options to rrsync. + + ENHANCEMENTS: + + - Tweaked the temp-file naming when --temp-dir=DIR is used: the temp-file + names will not get a '.' prepended. + + - Added support for a new-compression idiom that does not compress all the + matching data in a transfer. This can help rsync to use less cpu when a + transfer has a lot of matching data, and also makes rsync compatible with + a non-bundled zlib. See the --new-compress and --old-compress options in + the manpage. + + - Added the support/rsync-no-vanished wrapper script. + + - Made configure more prominently mention when we failed to find yodl (in + case the user wants to be able to generate manpages from *.yo files). + + - Have manpage mention how a daemon's max-verbosity setting affects info + and debug options. Also added more clarification on backslash removals + for excludes that contain wildcards. + + - Have configure check if for the attr lib (for getxattr) for those systems + that need to link against it explicitly. + + - Change the early dir-creation logic to only use that idiom in an + inc-recursive copy that is preserving directory times. e.g. using + --omit-dir-times will avoid these early directories being created. + + - Fix a bug in cmp_time() that would return a wrong result if the 2 times + differed by an amount greater than what a time_t can hold. + + DEVELOPER RELATED: + + - We now include an example systemd file (in packaging/systemd). + + - Tweaked configure to make sure that any intended use of the included popt + and/or zlib code is put early in the CFLAGS. + NEWS for rsync 3.1.0 (28 Sep 2013) Protocol: 31 (changed) Changes since 3.0.9: @@ -3534,6 +3650,7 @@ Partial Protocol History RELEASE DATE VER. DATE OF COMMIT* PROTOCOL + 21 Dec 2015 3.1.2 31 22 Jun 2014 3.1.1 31 28 Sep 2013 3.1.0 31 Aug 2008 31 23 Sep 2011 3.0.9 30 diff -Nru rsync-3.1.1/options.c rsync-3.1.2/options.c --- rsync-3.1.1/options.c 2014-06-14 16:55:37.000000000 +0000 +++ rsync-3.1.2/options.c 2015-12-18 22:46:28.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1998-2001 Andrew Tridgell * Copyright (C) 2000, 2001, 2002 Martin Pool - * Copyright (C) 2002-2014 Wayne Davison + * Copyright (C) 2002-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -411,16 +411,17 @@ const char *s; int j, len, lev; - if (!str) - return; - - while (*str) { + for ( ; str; str = s) { if ((s = strchr(str, ',')) != NULL) len = s++ - str; else len = strlen(str); - while (len && isDigit(str+len-1)) - len--; + if (!len) + continue; + if (!isDigit(str)) { + while (len && isDigit(str+len-1)) + len--; + } lev = isDigit(str+len) ? atoi(str+len) : 1; if (lev > MAX_OUT_LEVEL) lev = MAX_OUT_LEVEL; @@ -448,9 +449,6 @@ words[j].help, len, str); exit_cleanup(RERR_SYNTAX); } - if (!s) - break; - str = s; } } @@ -613,7 +611,7 @@ rprintf(f, "%s version %s protocol version %d%s\n", RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol); - rprintf(f, "Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.\n"); + rprintf(f, "Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.\n"); rprintf(f, "Web site: http://rsync.samba.org/\n"); rprintf(f, "Capabilities:\n"); rprintf(f, " %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n", @@ -2480,9 +2478,11 @@ * but checking the pre-negotiated value allows the user to use a * --protocol=29 override to avoid the use of this -eFLAGS opt. */ if (protocol_version >= 30) { + /* Use "eFlags" alias so that cull_options doesn't think that these are no-arg option letters. */ +#define eFlags argstr /* We make use of the -e option to let the server know about * any pre-release protocol version && some behavior flags. */ - argstr[x++] = 'e'; + eFlags[x++] = 'e'; #if SUBPROTOCOL_VERSION != 0 if (protocol_version == PROTOCOL_VERSION) { x += snprintf(argstr+x, sizeof argstr - x, @@ -2490,17 +2490,19 @@ PROTOCOL_VERSION, SUBPROTOCOL_VERSION); } else #endif - argstr[x++] = '.'; + eFlags[x++] = '.'; if (allow_inc_recurse) - argstr[x++] = 'i'; + eFlags[x++] = 'i'; #ifdef CAN_SET_SYMLINK_TIMES - argstr[x++] = 'L'; /* symlink time-setting support */ + eFlags[x++] = 'L'; /* symlink time-setting support */ #endif #ifdef ICONV_OPTION - argstr[x++] = 's'; /* symlink iconv translation support */ + eFlags[x++] = 's'; /* symlink iconv translation support */ #endif - argstr[x++] = 'f'; /* flist I/O-error safety support */ - argstr[x++] = 'x'; /* xattr hardlink optimization not desired */ + eFlags[x++] = 'f'; /* flist I/O-error safety support */ + eFlags[x++] = 'x'; /* xattr hardlink optimization not desired */ + eFlags[x++] = 'C'; /* support checksum seed order fix */ +#undef eFlags } if (x >= (int)sizeof argstr) { /* Not possible... */ diff -Nru rsync-3.1.1/packaging/cull_options rsync-3.1.2/packaging/cull_options --- rsync-3.1.1/packaging/cull_options 2013-10-04 21:10:44.000000000 +0000 +++ rsync-3.1.2/packaging/cull_options 2014-09-04 20:44:50.000000000 +0000 @@ -6,12 +6,23 @@ our %short_no_arg; our %short_with_num; -our %long_opt = ( +our %long_opt = ( # These include some extra long-args that BackupPC uses: + 'block-size' => 1, 'daemon' => -1, 'debug' => 1, 'fake-super' => 0, + 'fuzzy' => 0, + 'group' => 0, + 'hard-links' => 0, + 'ignore-times' => 0, 'info' => 1, + 'links' => 0, 'log-file' => 3, + 'one-file-system' => 0, + 'owner' => 0, + 'perms' => 0, + 'recursive' => 0, + 'times' => 0, ); our $last_long_opt; diff -Nru rsync-3.1.1/packaging/git-status.pl rsync-3.1.2/packaging/git-status.pl --- rsync-3.1.1/packaging/git-status.pl 2011-03-19 23:29:47.000000000 +0000 +++ rsync-3.1.2/packaging/git-status.pl 2014-07-31 21:47:09.000000000 +0000 @@ -35,8 +35,8 @@ my($fatal_unless_clean, $subdir) = @_; $subdir = '.' unless defined $subdir; my $status = `cd '$subdir' && git status`; - my $is_clean = $status =~ /\nnothing to commit \(working directory clean\)/; - my($cur_branch) = $status =~ /^# On branch (.+)\n/; + my $is_clean = $status =~ /\nnothing to commit.+working directory clean/; + my($cur_branch) = $status =~ /^(?:# )?On branch (.+)\n/; if ($fatal_unless_clean && !$is_clean) { if ($subdir eq '.') { $subdir = ''; diff -Nru rsync-3.1.1/packaging/lsb/rsync.spec rsync-3.1.2/packaging/lsb/rsync.spec --- rsync-3.1.1/packaging/lsb/rsync.spec 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/packaging/lsb/rsync.spec 2015-12-21 20:00:49.000000000 +0000 @@ -1,6 +1,6 @@ Summary: A fast, versatile, remote (and local) file-copying tool Name: rsync -Version: 3.1.1 +Version: 3.1.2 %define fullversion %{version} Release: 1 %define srcdir src @@ -91,8 +91,8 @@ %dir /etc/rsync-ssl/certs %changelog -* Sun Jun 22 2014 Wayne Davison -Released 3.1.1. +* Mon Dec 21 2015 Wayne Davison +Released 3.1.2. * Fri Mar 21 2008 Wayne Davison Added installation of /etc/xinetd.d/rsync file and some commented-out diff -Nru rsync-3.1.1/packaging/nightly-rsync rsync-3.1.2/packaging/nightly-rsync --- rsync-3.1.1/packaging/nightly-rsync 2010-04-24 16:34:43.000000000 +0000 +++ rsync-3.1.2/packaging/nightly-rsync 2015-08-02 18:15:17.000000000 +0000 @@ -16,6 +16,7 @@ # Where the local copy of /home/ftp/pub/rsync/dev/nightly should be updated. our $dest = $ENV{HOME} . '/samba-rsync-ftp/dev/nightly'; +our $samba_host = $ENV{SAMBA_HOST} || 'samba.org'; our $nightly_symlink = "$dest/rsync-HEAD.tar.gz"; our($make_tar, $upload, $help_opt); @@ -39,8 +40,8 @@ open(IN, '-|', 'git status') or die $!; my $status = join('', ); close IN; - die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/; - die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/; + die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit.+working directory clean/; + die "The checkout is not on the master branch.\n" unless $status =~ /^(?:# )?On branch master\n/; system "make $gen_target" and die "make $gen_target failed!\n"; my @extra_files; @@ -59,13 +60,13 @@ my $confversion; open(IN, '<', 'configure.ac') or die "Unable to open configure.ac: $!\n"; while () { - if (/^RSYNC_VERSION=(.*)/) { + if (/^AC_INIT\(\[rsync\],\s*\[(\d.+?)\]/) { $confversion = $1; last; } } close IN; - die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion; + die "Unable to find AC_INIT with version in configure.ac\n" unless defined $confversion; open(IN, '<', 'OLDNEWS') or die "Unable to open OLDNEWS: $!\n"; $_ = ; @@ -156,7 +157,7 @@ if (defined $ENV{RSYNC_PARTIAL_DIR}) { $opt = " -f 'R $ENV{RSYNC_PARTIAL_DIR}'"; } - system "rsync$opt -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/dev/nightly"; + system "rsync$opt -aviHP --delete-after . $samba_host\:/home/ftp/pub/rsync/dev/nightly"; } exit; diff -Nru rsync-3.1.1/packaging/patch-update rsync-3.1.2/packaging/patch-update --- rsync-3.1.1/packaging/patch-update 2014-01-27 17:18:03.000000000 +0000 +++ rsync-3.1.2/packaging/patch-update 2014-07-31 22:59:32.000000000 +0000 @@ -23,6 +23,8 @@ ); &usage if $help_opt; +$ENV{GIT_MERGE_AUTOEDIT} = 'no'; + if (defined $incl_generated_files) { $patches_dir = $incl_generated_files if $incl_generated_files ne ''; $incl_generated_files = 1; diff -Nru rsync-3.1.1/packaging/release-rsync rsync-3.1.2/packaging/release-rsync --- rsync-3.1.1/packaging/release-rsync 2013-09-16 16:16:30.000000000 +0000 +++ rsync-3.1.2/packaging/release-rsync 2015-07-07 17:37:12.000000000 +0000 @@ -67,13 +67,13 @@ my $confversion; open(IN, '<', 'configure.ac') or die $!; while () { - if (/^RSYNC_VERSION=(.*)/) { + if (/^AC_INIT\(\[rsync\],\s*\[(\d.+?)\]/) { $confversion = $1; last; } } close IN; -die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion; +die "Unable to find AC_INIT with version in configure.ac\n" unless defined $confversion; open(IN, '<', 'OLDNEWS') or die $!; $_ = ; @@ -202,8 +202,8 @@ undef $/; $_ = ; $/ = "\n"; close IN; if ($fn =~ /configure/) { - s/^RSYNC_VERSION=.*/RSYNC_VERSION=$version/m - or die "Unable to update RSYNC_VERSION in $fn\n"; + s/^(AC_INIT\(\[rsync\],\s*\[)\d.+?(\])/$1$version$2/m + or die "Unable to update AC_INIT with version in $fn\n"; } elsif ($fn =~ /\.spec/) { while (my($str, $val) = each %specvars) { s/^\Q$str\E .*/$str $val/m diff -Nru rsync-3.1.1/pipe.c rsync-3.1.2/pipe.c --- rsync-3.1.1/pipe.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/pipe.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/prepare-source rsync-3.1.2/prepare-source --- rsync-3.1.1/prepare-source 2007-12-18 07:32:47.000000000 +0000 +++ rsync-3.1.2/prepare-source 2015-04-26 23:50:41.000000000 +0000 @@ -27,9 +27,9 @@ ;; fetch) if perl --version >/dev/null 2>/dev/null; then - files='c*' + files='[ca]*' else - files='[cp]*' + files='[cap]*' fi rsync -pvz rsync://rsync.samba.org/rsyncftp/generated-files/"$files" . ;; diff -Nru rsync-3.1.1/prepare-source.mak rsync-3.1.2/prepare-source.mak --- rsync-3.1.1/prepare-source.mak 2010-04-24 16:34:43.000000000 +0000 +++ rsync-3.1.2/prepare-source.mak 2015-05-01 22:17:41.000000000 +0000 @@ -1,5 +1,8 @@ conf: configure.sh config.h.in +aclocal.m4: + aclocal -I m4 + configure.sh: configure.ac aclocal.m4 autoconf -o configure.sh diff -Nru rsync-3.1.1/progress.c rsync-3.1.2/progress.c --- rsync-3.1.1/progress.c 2014-02-24 18:07:18.000000000 +0000 +++ rsync-3.1.2/progress.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/proto.h rsync-3.1.2/proto.h --- rsync-3.1.1/proto.h 2014-06-22 17:11:15.000000000 +0000 +++ rsync-3.1.2/proto.h 2015-12-21 20:22:53.000000000 +0000 @@ -89,9 +89,10 @@ void unmake_file(struct file_struct *file); void send_extra_file_list(int f, int at_least); struct file_list *send_file_list(int f, int argc, char *argv[]); -struct file_list *recv_file_list(int f); +struct file_list *recv_file_list(int f, int dir_ndx); void recv_additional_file_list(int f); int flist_find(struct file_list *flist, struct file_struct *f); +int flist_find_name(struct file_list *flist, const char *fname, int want_dir_match); int flist_find_ignore_dirness(struct file_list *flist, struct file_struct *f); void clear_file(struct file_struct *file); struct file_list *flist_new(int flags, char *msg); @@ -253,7 +254,7 @@ int child_main(int argc, char *argv[]); void start_server(int f_in, int f_out, int argc, char *argv[]); int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]); -RETSIGTYPE remember_children(UNUSED(int val)); +void remember_children(UNUSED(int val)); const char *get_panic_action(void); int main(int argc,char *argv[]); void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len); @@ -288,7 +289,7 @@ int exists); int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, const char *fnamecmp, int flags); -RETSIGTYPE sig_int(int sig_num); +void sig_int(int sig_num); int finish_transfer(const char *fname, const char *fnametmp, const char *fnamecmp, const char *partialptr, struct file_struct *file, int ok_to_set_time, @@ -348,7 +349,7 @@ gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr); void recv_id_list(int f, struct file_list *flist); void parse_name_map(char *map, BOOL usernames); -const char *getallgroups(uid_t uid, gid_t *gid_list, int *size_ptr); +const char *getallgroups(uid_t uid, item_list *gid_list); void set_nonblocking(int fd); void set_blocking(int fd); int fd_pair(int fd[2]); diff -Nru rsync-3.1.1/receiver.c rsync-3.1.2/receiver.c --- rsync-3.1.1/receiver.c 2014-06-08 17:42:14.000000000 +0000 +++ rsync-3.1.2/receiver.c 2015-09-07 17:07:17.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -672,8 +672,7 @@ } } - if (!log_before_transfer) - remember_initial_stats(); + remember_initial_stats(); if (!do_xfers) { /* log the transfer */ log_item(FCLIENT, file, iflags, NULL); diff -Nru rsync-3.1.1/rounding.c rsync-3.1.2/rounding.c --- rsync-3.1.1/rounding.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/rounding.c 2015-08-08 19:47:03.000000000 +0000 @@ -1,7 +1,7 @@ /* * A pre-compilation helper program to aid in the creation of rounding.h. * - * Copyright (C) 2007-2014 Wayne Davison + * Copyright (C) 2007-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/rsync.1 rsync-3.1.2/rsync.1 --- rsync-3.1.1/rsync.1 2014-06-22 17:09:56.000000000 +0000 +++ rsync-3.1.2/rsync.1 2015-12-21 20:22:41.000000000 +0000 @@ -1,4 +1,4 @@ -.TH "rsync" "1" "22 Jun 2014" "" "" +.TH "rsync" "1" "21 Dec 2015" "" "" .SH "NAME" rsync \- a fast, versatile, remote (and local) file\-copying tool .SH "SYNOPSIS" @@ -663,7 +663,9 @@ protocol (which normally outputs info messages via stdout). This is mainly intended for debugging in order to avoid changing the data sent via the protocol, since the extra protocol data can change what is being tested. -Keep in mind that a daemon connection does not have a stderr channel to send +The option does not affect the remote side of a transfer without using +\fB\-\-remote\-option\fP \-\- e.g. \fB\-M\-\-msgs2stderr\fP. +Also keep in mind that a daemon connection does not have a stderr channel to send messages back to the client side, so if you are doing any daemon\-transfer debugging using this option, you should start up a daemon using \fB\-\-no\-detach\fP so that you can see the stderr output on the daemon side. @@ -993,6 +995,11 @@ but does not conflict with \fB\-\-sparse\fP (since it is always extending a file\(cq\&s length). .IP +The use of \fB\-\-append\fP can be dangerous if you aren\(cq\&t 100% sure that the files +that are longer have only grown by the appending of data onto the end. You +should thus use include/exclude/filter rules to ensure that such a transfer is +only affecting files that you know to be growing via appended data. +.IP .IP "\fB\-\-append\-verify\fP" This works just like the \fB\-\-append\fP option, but the existing data on the receiving side is included in the full\-file @@ -2791,7 +2798,7 @@ .IP There is also a \fB\-\-info=progress2\fP option that outputs statistics based on the whole transfer, rather than individual files. Use this flag without -outputting a filename (e.g. avoid \fB\-v\fP or specify \fB\-\-info=name0\fP if you +outputting a filename (e.g. avoid \fB\-v\fP or specify \fB\-\-info=name0\fP) if you want to see how the transfer is doing without scrolling the screen with a lot of names. (You don\(cq\&t need to specify the \fB\-\-progress\fP option in order to use \fB\-\-info=progress2\fP.) @@ -3946,7 +3953,7 @@ .SH "VERSION" .PP -This man page is current for version 3.1.1 of rsync. +This man page is current for version 3.1.2 of rsync. .PP .SH "INTERNAL OPTIONS" diff -Nru rsync-3.1.1/rsync.c rsync-3.1.2/rsync.c --- rsync-3.1.1/rsync.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/rsync.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -364,7 +364,7 @@ } /* Send all the data we read for this flist to the generator. */ start_flist_forward(ndx); - flist = recv_file_list(f_in); + flist = recv_file_list(f_in, ndx); flist->parent_ndx = ndx; stop_flist_forward(); } @@ -548,7 +548,11 @@ || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode))) flags |= ATTRS_SKIP_MTIME; if (!(flags & ATTRS_SKIP_MTIME) - && cmp_time(sxp->st.st_mtime, file->modtime) != 0) { + && (sxp->st.st_mtime != file->modtime +#ifdef ST_MTIME_NSEC + || (NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file)) +#endif + )) { int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode); if (ret < 0) { rsyserr(FERROR_XFER, errno, "failed to set times on %s", @@ -601,7 +605,7 @@ } /* This is only called for SIGINT, SIGHUP, and SIGTERM. */ -RETSIGTYPE sig_int(int sig_num) +void sig_int(int sig_num) { /* KLUGE: if the user hits Ctrl-C while ssh is prompting * for a password, then our cleanup's sending of a SIGUSR1 diff -Nru rsync-3.1.1/rsyncd.conf.5 rsync-3.1.2/rsyncd.conf.5 --- rsync-3.1.1/rsyncd.conf.5 2014-06-22 17:07:36.000000000 +0000 +++ rsync-3.1.2/rsyncd.conf.5 2015-12-21 20:20:56.000000000 +0000 @@ -1,4 +1,4 @@ -.TH "rsyncd.conf" "5" "22 Jun 2014" "" "" +.TH "rsyncd.conf" "5" "21 Dec 2015" "" "" .SH "NAME" rsyncd.conf \- configuration file for rsync in daemon mode .SH "SYNOPSIS" @@ -85,6 +85,8 @@ .PP The first parameters in the file (before a [module] header) are the global parameters. +Rsync also allows for the use of a \(dq\&[global]\(dq\& module name to indicate the +start of one or more global\-parameter sections (the name must be lower case). .PP You may also include any module parameters in the global part of the config file in which case the supplied value will override the @@ -153,6 +155,8 @@ name contains whitespace, each internal sequence of whitespace will be changed into a single space, while leading or trailing whitespace will be discarded. +Also, the name cannot be \(dq\&global\(dq\& as that exact name indicates that +global parameters follow (see above). .PP As with GLOBAL PARAMETERS, you may use references to environment variables in the values of parameters. See the GLOBAL PARAMETERS section for more details. @@ -214,29 +218,16 @@ The default for \(dq\&use chroot\(dq\& is true, and is the safer choice (especially if the module is not read\-only). .IP -When this parameter is enabled, rsync will not attempt to map users and groups -by name (by default), but instead copy IDs as though \fB\-\-numeric\-ids\fP had -been specified. In order to enable name\-mapping, rsync needs to be able to -use the standard library functions for looking up names and IDs (i.e. -\f(CWgetpwuid()\fP -, -\f(CWgetgrgid()\fP -, -\f(CWgetpwname()\fP -, and -\f(CWgetgrnam()\fP -). -This means the rsync -process in the chroot hierarchy will need to have access to the resources -used by these library functions (traditionally /etc/passwd and -/etc/group, but perhaps additional dynamic libraries as well). +When this parameter is enabled, the \(dq\&numeric\-ids\(dq\& option will also default to +being enabled (disabling name lookups). See below for what a chroot needs in +order for name lookups to succeed. .IP -If you copy the necessary resources into the module\(cq\&s chroot area, you +If you copy library resources into the module\(cq\&s chroot area, you should protect them through your OS\(cq\&s normal user/group or ACL settings (to prevent the rsync module\(cq\&s user from being able to change them), and then hide them from the user\(cq\&s view via \(dq\&exclude\(dq\& (see how in the discussion of that parameter). At that point it will be safe to enable the mapping of users -and groups by name using the \(dq\&numeric ids\(dq\& daemon parameter (see below). +and groups by name using this \(dq\&numeric ids\(dq\& daemon parameter. .IP Note also that you are free to setup custom user/group information in the chroot area that is different from your normal system. For example, you @@ -249,11 +240,23 @@ This enabling makes the transfer behave as if the client had passed the \fB\-\-numeric\-ids\fP command\-line option. By default, this parameter is enabled for chroot modules and disabled for non\-chroot modules. +Also keep in mind that uid/gid preservation requires the module to be +running as root (see \(dq\&uid\(dq\&) or for \(dq\&fake super\(dq\& to be configured. .IP A chroot\-enabled module should not have this parameter enabled unless you\(cq\&ve taken steps to ensure that the module has the necessary resources it needs to translate names, and that it is not possible for a user to change those -resources. +resources. That includes being the code being able to call functions like +\f(CWgetpwuid()\fP +, +\f(CWgetgrgid()\fP +, +\f(CWgetpwname()\fP +, and +\f(CWgetgrnam()\fP +). +You should test what libraries and config files are required for your OS +and get those setup before starting to test name mapping in rsync. .IP .IP "\fBmunge symlinks\fP" This parameter tells rsync to modify @@ -1046,7 +1049,7 @@ .SH "VERSION" .PP -This man page is current for version 3.1.1 of rsync. +This man page is current for version 3.1.2 of rsync. .PP .SH "CREDITS" diff -Nru rsync-3.1.1/rsyncd.conf.yo rsync-3.1.2/rsyncd.conf.yo --- rsync-3.1.1/rsyncd.conf.yo 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/rsyncd.conf.yo 2015-12-21 20:00:49.000000000 +0000 @@ -1,5 +1,5 @@ mailto(rsync-bugs@samba.org) -manpage(rsyncd.conf)(5)(22 Jun 2014)()() +manpage(rsyncd.conf)(5)(21 Dec 2015)()() manpagename(rsyncd.conf)(configuration file for rsync in daemon mode) manpagesynopsis() @@ -74,6 +74,8 @@ The first parameters in the file (before a [module] header) are the global parameters. +Rsync also allows for the use of a "[global]" module name to indicate the +start of one or more global-parameter sections (the name must be lower case). You may also include any module parameters in the global part of the config file in which case the supplied value will override the @@ -136,6 +138,8 @@ name contains whitespace, each internal sequence of whitespace will be changed into a single space, while leading or trailing whitespace will be discarded. +Also, the name cannot be "global" as that exact name indicates that +global parameters follow (see above). As with GLOBAL PARAMETERS, you may use references to environment variables in the values of parameters. See the GLOBAL PARAMETERS section for more details. @@ -193,22 +197,16 @@ The default for "use chroot" is true, and is the safer choice (especially if the module is not read-only). -When this parameter is enabled, rsync will not attempt to map users and groups -by name (by default), but instead copy IDs as though bf(--numeric-ids) had -been specified. In order to enable name-mapping, rsync needs to be able to -use the standard library functions for looking up names and IDs (i.e. -code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())). -This means the rsync -process in the chroot hierarchy will need to have access to the resources -used by these library functions (traditionally /etc/passwd and -/etc/group, but perhaps additional dynamic libraries as well). +When this parameter is enabled, the "numeric-ids" option will also default to +being enabled (disabling name lookups). See below for what a chroot needs in +order for name lookups to succeed. -If you copy the necessary resources into the module's chroot area, you +If you copy library resources into the module's chroot area, you should protect them through your OS's normal user/group or ACL settings (to prevent the rsync module's user from being able to change them), and then hide them from the user's view via "exclude" (see how in the discussion of that parameter). At that point it will be safe to enable the mapping of users -and groups by name using the "numeric ids" daemon parameter (see below). +and groups by name using this "numeric ids" daemon parameter. Note also that you are free to setup custom user/group information in the chroot area that is different from your normal system. For example, you @@ -220,11 +218,16 @@ This enabling makes the transfer behave as if the client had passed the bf(--numeric-ids) command-line option. By default, this parameter is enabled for chroot modules and disabled for non-chroot modules. +Also keep in mind that uid/gid preservation requires the module to be +running as root (see "uid") or for "fake super" to be configured. A chroot-enabled module should not have this parameter enabled unless you've taken steps to ensure that the module has the necessary resources it needs to translate names, and that it is not possible for a user to change those -resources. +resources. That includes being the code being able to call functions like +code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())). +You should test what libraries and config files are required for your OS +and get those setup before starting to test name mapping in rsync. dit(bf(munge symlinks)) This parameter tells rsync to modify all symlinks in the same way as the (non-daemon-affecting) @@ -901,7 +904,7 @@ manpagesection(VERSION) -This man page is current for version 3.1.1 of rsync. +This man page is current for version 3.1.2 of rsync. manpagesection(CREDITS) diff -Nru rsync-3.1.1/rsync.h rsync-3.1.2/rsync.h --- rsync-3.1.1/rsync.h 2014-04-13 17:36:59.000000000 +0000 +++ rsync-3.1.2/rsync.h 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Copyright (C) 1996, 2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -892,7 +892,6 @@ typedef struct filter_list_struct { filter_rule *head; filter_rule *tail; - filter_rule *parent_dirscan_head; char *debug_type; } filter_rule_list; diff -Nru rsync-3.1.1/rsync.yo rsync-3.1.2/rsync.yo --- rsync-3.1.1/rsync.yo 2014-06-22 16:50:03.000000000 +0000 +++ rsync-3.1.2/rsync.yo 2015-12-21 20:00:49.000000000 +0000 @@ -1,5 +1,5 @@ mailto(rsync-bugs@samba.org) -manpage(rsync)(1)(22 Jun 2014)()() +manpage(rsync)(1)(21 Dec 2015)()() manpagename(rsync)(a fast, versatile, remote (and local) file-copying tool) manpagesynopsis() @@ -571,7 +571,9 @@ protocol (which normally outputs info messages via stdout). This is mainly intended for debugging in order to avoid changing the data sent via the protocol, since the extra protocol data can change what is being tested. -Keep in mind that a daemon connection does not have a stderr channel to send +The option does not affect the remote side of a transfer without using +bf(--remote-option) -- e.g. bf(-M--msgs2stderr). +Also keep in mind that a daemon connection does not have a stderr channel to send messages back to the client side, so if you are doing any daemon-transfer debugging using this option, you should start up a daemon using bf(--no-detach) so that you can see the stderr output on the daemon side. @@ -864,6 +866,11 @@ but does not conflict with bf(--sparse) (since it is always extending a file's length). +The use of bf(--append) can be dangerous if you aren't 100% sure that the files +that are longer have only grown by the appending of data onto the end. You +should thus use include/exclude/filter rules to ensure that such a transfer is +only affecting files that you know to be growing via appended data. + dit(bf(--append-verify)) This works just like the bf(--append) option, but the existing data on the receiving side is included in the full-file checksum verification step, which will cause a file to be resent if the @@ -2449,7 +2456,7 @@ There is also a bf(--info=progress2) option that outputs statistics based on the whole transfer, rather than individual files. Use this flag without -outputting a filename (e.g. avoid bf(-v) or specify bf(--info=name0) if you +outputting a filename (e.g. avoid bf(-v) or specify bf(--info=name0)) if you want to see how the transfer is doing without scrolling the screen with a lot of names. (You don't need to specify the bf(--progress) option in order to use bf(--info=progress2).) @@ -3403,7 +3410,7 @@ manpagesection(VERSION) -This man page is current for version 3.1.1 of rsync. +This man page is current for version 3.1.2 of rsync. manpagesection(INTERNAL OPTIONS) diff -Nru rsync-3.1.1/sender.c rsync-3.1.2/sender.c --- rsync-3.1.1/sender.c 2014-06-08 17:42:14.000000000 +0000 +++ rsync-3.1.2/sender.c 2015-09-07 17:07:17.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -143,11 +143,12 @@ goto failed; } - if (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime + if (S_ISREG(file->mode) /* Symlinks & devices don't need this check: */ + && (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime #ifdef ST_MTIME_NSEC || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file)) #endif - ) { + )) { rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname); return; } @@ -319,8 +320,7 @@ stats.xferred_files++; stats.total_transferred_size += F_LENGTH(file); - if (!log_before_transfer) - remember_initial_stats(); + remember_initial_stats(); if (!do_xfers) { /* log the transfer */ log_item(FCLIENT, file, iflags, NULL); diff -Nru rsync-3.1.1/socket.c rsync-3.1.2/socket.c --- rsync-3.1.1/socket.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/socket.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1992-2001 Andrew Tridgell * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,7 +161,7 @@ } /* connect() timeout handler based on alarm() */ -static RETSIGTYPE contimeout_handler(UNUSED(int val)) +static void contimeout_handler(UNUSED(int val)) { connect_timeout = -1; } @@ -529,7 +529,7 @@ } -static RETSIGTYPE sigchld_handler(UNUSED(int val)) +static void sigchld_handler(UNUSED(int val)) { #ifdef WNOHANG while (waitpid(-1, NULL, WNOHANG) > 0) {} diff -Nru rsync-3.1.1/support/rrsync rsync-3.1.2/support/rrsync --- rsync-3.1.1/support/rrsync 2014-05-26 19:13:01.000000000 +0000 +++ rsync-3.1.2/support/rrsync 2015-09-13 23:23:54.000000000 +0000 @@ -15,11 +15,21 @@ use constant LOGFILE => 'rrsync.log'; my $Usage = < 0, 'backup-dir' => 2, + 'block-size' => 1, 'bwlimit' => 1, 'checksum-seed' => 1, 'compare-dest' => 2, @@ -82,14 +94,18 @@ 'force' => 0, 'from0' => 0, 'fuzzy' => 0, + 'group' => 0, 'groupmap' => 1, + 'hard-links' => 0, 'iconv' => 1, 'ignore-errors' => 0, 'ignore-existing' => 0, 'ignore-missing-args' => 0, + 'ignore-times' => 0, 'info' => 1, 'inplace' => 0, 'link-dest' => 2, + 'links' => 0, 'list-only' => 0, 'log-file' => 3, 'log-format' => 1, @@ -103,12 +119,16 @@ 'no-relative' => 0, 'no-specials' => 0, 'numeric-ids' => 0, + 'one-file-system' => 0, 'only-write-batch' => 1, + 'owner' => 0, 'partial' => 0, 'partial-dir' => 2, + 'perms' => 0, 'preallocate' => 0, - 'remove-sent-files' => $ro ? -1 : 0, - 'remove-source-files' => $ro ? -1 : 0, + 'recursive' => 0, + 'remove-sent-files' => $only eq 'r' ? -1 : 0, + 'remove-source-files' => $only eq 'r' ? -1 : 0, 'safe-links' => 0, 'sender' => 0, 'server' => 0, @@ -120,6 +140,7 @@ 'super' => 0, 'temp-dir' => 2, 'timeout' => 1, + 'times' => 0, 'use-qsort' => 0, 'usermap' => 1, ); diff -Nru rsync-3.1.1/syscall.c rsync-3.1.2/syscall.c --- rsync-3.1.1/syscall.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/syscall.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * * Copyright (C) 1998 Andrew Tridgell * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/testsuite/chgrp.test rsync-3.1.2/testsuite/chgrp.test --- rsync-3.1.1/testsuite/chgrp.test 2007-09-03 20:43:58.000000000 +0000 +++ rsync-3.1.2/testsuite/chgrp.test 2015-06-10 22:20:01.000000000 +0000 @@ -13,14 +13,14 @@ # Build some hardlinks -mygrps="`rsync_getgroups`" || fail "Can't get groups" +mygrps="`rsync_getgroups`" || test_fail "Can't get groups" mkdir "$fromdir" for g in $mygrps do name="$fromdir/foo-$g" date > "$name" - chgrp "$g" "$name" || fail "Can't chgrp" + chgrp "$g" "$name" || test_fail "Can't chgrp" done sleep 2 diff -Nru rsync-3.1.1/testsuite/duplicates.test rsync-3.1.2/testsuite/duplicates.test --- rsync-3.1.1/testsuite/duplicates.test 2007-09-03 20:43:58.000000000 +0000 +++ rsync-3.1.2/testsuite/duplicates.test 2015-06-10 22:20:01.000000000 +0000 @@ -27,7 +27,7 @@ name1="$fromdir/name1" name2="$fromdir/name2" echo "This is the file" > "$name1" -ln -s "$name1" "$name2" || fail "can't create symlink" +ln -s "$name1" "$name2" || test_fail "can't create symlink" outfile="$scratchdir/rsync.out" diff -Nru rsync-3.1.1/testsuite/hardlinks.test rsync-3.1.2/testsuite/hardlinks.test --- rsync-3.1.1/testsuite/hardlinks.test 2013-06-10 02:40:56.000000000 +0000 +++ rsync-3.1.2/testsuite/hardlinks.test 2015-06-10 22:20:01.000000000 +0000 @@ -29,8 +29,8 @@ name4="$fromdir/name4" echo "This is the file" > "$name1" ln "$name1" "$name2" || test_skipped "Can't create hardlink" -ln "$name2" "$name3" || fail "Can't create hardlink" -cp "$name2" "$name4" || fail "Can't copy file" +ln "$name2" "$name3" || test_fail "Can't create hardlink" +cp "$name2" "$name4" || test_fail "Can't copy file" cat $srcdir/*.c >"$fromdir/text" checkit "$RSYNC -aHivv --debug=HLINK5 '$fromdir/' '$todir/'" "$fromdir" "$todir" @@ -67,7 +67,7 @@ # Create a hard link that has only one part in the hierarchy. echo "This is another file" >"$fromdir/solo" -ln "$fromdir/solo" "$chkdir/solo" || fail "Can't create hardlink" +ln "$fromdir/solo" "$chkdir/solo" || test_fail "Can't create hardlink" # Make sure that the checksum data doesn't slide due to an HLINK_BUMP() change. $RSYNC -aHivc --debug=HLINK5 "$fromdir/" "$chkdir/" | tee "$outfile" diff -Nru rsync-3.1.1/testsuite/relative.test rsync-3.1.2/testsuite/relative.test --- rsync-3.1.1/testsuite/relative.test 2007-09-23 02:18:57.000000000 +0000 +++ rsync-3.1.2/testsuite/relative.test 2015-07-12 21:00:45.000000000 +0000 @@ -33,6 +33,8 @@ ln $deepstr/filelist $deepstr/dir ln ../chk/$deepstr/filelist ../chk/$deepstr/dir +# Work around time rounding/truncating issue by touching both dirs. +touch -r $deepstr/dir $deepstr/dir ../chk/$deepstr/dir runtest "hard links" 'checkit "$RSYNC -avHR ./$deepstr/ \"$todir\"" "$chkdir" "$todir"' cp "$deepdir/text" "$todir/$deepstr/ThisShouldGo" diff -Nru rsync-3.1.1/tls.c rsync-3.1.2/tls.c --- rsync-3.1.1/tls.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/tls.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Trivial ls for comparing two directories after running an rsync. * * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/token.c rsync-3.1.2/token.c --- rsync-3.1.1/token.c 2014-04-19 19:18:19.000000000 +0000 +++ rsync-3.1.2/token.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/trimslash.c rsync-3.1.2/trimslash.c --- rsync-3.1.1/trimslash.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/trimslash.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Simple utility used only by the test harness. * * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/t_stub.c rsync-3.1.2/t_stub.c --- rsync-3.1.1/t_stub.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/t_stub.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * functions, so that module test harnesses can run standalone. * * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/t_unsafe.c rsync-3.1.2/t_unsafe.c --- rsync-3.1.1/t_unsafe.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/t_unsafe.c 2015-08-08 19:47:03.000000000 +0000 @@ -2,7 +2,7 @@ * Test harness for unsafe_symlink(). Not linked into rsync itself. * * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/uidlist.c rsync-3.1.2/uidlist.c --- rsync-3.1.1/uidlist.c 2014-04-30 19:34:15.000000000 +0000 +++ rsync-3.1.2/uidlist.c 2015-08-24 18:54:00.000000000 +0000 @@ -3,7 +3,7 @@ * * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras - * Copyright (C) 2004-2014 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -524,25 +524,49 @@ } #ifdef HAVE_GETGROUPLIST -const char *getallgroups(uid_t uid, gid_t *gid_list, int *size_ptr) +const char *getallgroups(uid_t uid, item_list *gid_list) { struct passwd *pw; + gid_t *gid_array; + int size; + if ((pw = getpwuid(uid)) == NULL) return "getpwuid failed"; + + gid_list->count = 0; /* We're overwriting any items in the list */ + EXPAND_ITEM_LIST(gid_list, gid_t, 32); + size = gid_list->malloced; + /* Get all the process's groups, with the pw_gid group first. */ - if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list, size_ptr) < 0) - return "getgrouplist failed"; + if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list->items, &size) < 0) { + if (size > (int)gid_list->malloced) { + gid_list->count = gid_list->malloced; + EXPAND_ITEM_LIST(gid_list, gid_t, size); + if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list->items, &size) < 0) + size = -1; + } else + size = -1; + if (size < 0) + return "getgrouplist failed"; + } + gid_list->count = size; + gid_array = gid_list->items; + /* Paranoia: is the default group not first in the list? */ - if (gid_list[0] != pw->pw_gid) { + if (gid_array[0] != pw->pw_gid) { int j; - for (j = 0; j < *size_ptr; j++) { - if (gid_list[j] == pw->pw_gid) { - gid_list[j] = gid_list[0]; - gid_list[0] = pw->pw_gid; + for (j = 1; j < size; j++) { + if (gid_array[j] == pw->pw_gid) break; - } } + if (j == size) { /* The default group wasn't found! */ + EXPAND_ITEM_LIST(gid_list, gid_t, size+1); + gid_array = gid_list->items; + } + gid_array[j] = gid_array[0]; + gid_array[0] = pw->pw_gid; } + return NULL; } #endif diff -Nru rsync-3.1.1/util2.c rsync-3.1.2/util2.c --- rsync-3.1.1/util2.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/util2.c 2015-08-08 19:47:03.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +35,9 @@ **/ int msleep(int t) { +#ifdef HAVE_USLEEP + usleep(t*1000); +#else int tdiff = 0; struct timeval tval, t1, t2; @@ -48,11 +51,12 @@ select(0,NULL,NULL, NULL, &tval); gettimeofday(&t2, NULL); - if (t2.tv_sec < t1.tv_sec) - t1 = t2; /* Time went backwards, so start over. */ tdiff = (t2.tv_sec - t1.tv_sec)*1000 + (t2.tv_usec - t1.tv_usec)/1000; + if (tdiff < 0) + t1 = t2; /* Time went backwards, so start over. */ } +#endif return True; } diff -Nru rsync-3.1.1/util.c rsync-3.1.2/util.c --- rsync-3.1.1/util.c 2014-06-16 00:53:34.000000000 +0000 +++ rsync-3.1.2/util.c 2015-12-21 18:54:02.000000000 +0000 @@ -4,7 +4,7 @@ * Copyright (C) 1996-2000 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -190,7 +190,7 @@ if (flags & MKP_DROP_NAME) { end = strrchr(fname, '/'); - if (!end) + if (!end || end == fname) return 0; *end = '\0'; } else @@ -210,8 +210,10 @@ ret++; break; } + if (errno != ENOENT) { - if (errno != EEXIST) + STRUCT_STAT st; + if (errno != EEXIST || (do_stat(fname, &st) == 0 && !S_ISDIR(st.st_mode))) ret = -ret - 1; break; } @@ -1603,6 +1605,14 @@ return ndx; } +/* Make sure there is room for one more item in the item list. If there + * is not, expand the list as indicated by the value of "incr": + * - if incr < 0 then increase the malloced size by -1 * incr + * - if incr >= 0 then either make the malloced size equal to "incr" + * or (if that's not large enough) double the malloced size + * After the size check, the list's count is incremented by 1 and a pointer + * to the "new" list item is returned. + */ void *expand_item_list(item_list *lp, size_t item_size, const char *desc, int incr) { @@ -1613,10 +1623,12 @@ if (incr < 0) new_size += -incr; /* increase slowly */ else if (new_size < (size_t)incr) - new_size += incr; - else + new_size = incr; + else if (new_size) new_size *= 2; - if (new_size < lp->malloced) + else + new_size = 1; + if (new_size <= lp->malloced) overflow_exit("expand_item_list"); /* Using _realloc_array() lets us pass the size, not a type. */ new_ptr = _realloc_array(lp->items, item_size, new_size); diff -Nru rsync-3.1.1/wildtest.c rsync-3.1.2/wildtest.c --- rsync-3.1.1/wildtest.c 2014-01-26 17:29:15.000000000 +0000 +++ rsync-3.1.2/wildtest.c 2015-08-08 19:47:03.000000000 +0000 @@ -1,7 +1,7 @@ /* * Test suite for the wildmatch code. * - * Copyright (C) 2003-2014 Wayne Davison + * Copyright (C) 2003-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru rsync-3.1.1/xattrs.c rsync-3.1.2/xattrs.c --- rsync-3.1.1/xattrs.c 2014-05-26 21:08:31.000000000 +0000 +++ rsync-3.1.2/xattrs.c 2015-08-08 19:47:03.000000000 +0000 @@ -3,7 +3,7 @@ * Written by Jay Fenlason, vaguely based on the ACLs patch. * * Copyright (C) 2004 Red Hat, Inc. - * Copyright (C) 2006-2014 Wayne Davison + * Copyright (C) 2006-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by