diff --git a/.gitignore b/.gitignore index 76693bb..1fea441 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ config.status /support/savetransfer /testsuite/chown-fake.test /testsuite/devices-fake.test +/testsuite/xattrs-hlink.test /patches diff --git a/INSTALL b/INSTALL index 6b10dae..6c016ad 100644 --- a/INSTALL +++ b/INSTALL @@ -17,7 +17,7 @@ for the daemon by editing the NOBODY_USER and NOBODY_GROUP defines in config.h, or just override them in your /etc/rsyncd.conf file. As of 2.4.7, rsync uses Eric Troan's popt option-parsing library. A -cut-down copy of release 1.6.4 is included in the rsync distribution, +cut-down copy of a recent release is included in the rsync distribution, and will be used if there is no popt library on your build host, or if the --with-included-popt option is passed to ./configure. @@ -25,6 +25,17 @@ If you configure using --enable-maintainer-mode, then rsync will try to pop up an xterm on DISPLAY=:0 if it crashes. You might find this useful, but it should be turned off for production builds. +MAKE COMPATIBILITY +------------------ + +Note that Makefile.in has a rule that uses a wildcard in a prerequisite. If +your make has a problem with this rule, you will see an error like this: + + Don't know how to make ./*.c + +You can change the "proto.h-tstamp" target in Makefile.in to list all the *.c +filenames explicitly in order to avoid this issue. + RPM NOTES --------- diff --git a/Makefile.in b/Makefile.in index 7d18a4a..6f753ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -48,7 +48,7 @@ TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxa CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \ trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT) -CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test +CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test # Objects for CHECK_PROGS to clean CHECK_OBJS=tls.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o @@ -123,7 +123,7 @@ gensend: gen conf: cd $(srcdir) && $(MAKE) -f prepare-source.mak conf -configure.sh config.h.in: configure.in aclocal.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 autoconf -o configure.sh @@ -249,6 +249,9 @@ testsuite/chown-fake.test: testsuite/devices-fake.test: ln -s devices.test $(srcdir)/testsuite/devices-fake.test +testsuite/xattrs-hlink.test: + ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test + # This does *not* depend on building or installing: you can use it to # check a version installed from a binary or some other source tree, # if you want. diff --git a/NEWS b/NEWS index 4e97c08..40b7019 100644 --- a/NEWS +++ b/NEWS @@ -1,64 +1,138 @@ -NEWS for rsync 3.0.7 (31 Dec 2009) +NEWS for rsync 3.0.8 (26 Mar 2011) Protocol: 30 (unchanged) -Changes since 3.0.6: +Changes since 3.0.7: BUG FIXES: - - Fixed a bogus free when using --xattrs with --backup. + - Fixed two buffer-overflow issues: one where a directory path that is + exactly MAXPATHLEN was not handled correctly, and one handling a + --backup-dir that is extra extra large. - - Avoid an error when --dry-run was trying to stat a prior hard-link file - that hasn't really been created. + - Fixed a data-corruption issue when preserving hard-links without + preserving file ownership, and doing deletions either before or during + the transfer (CVE-2011-1097). This fixes some assert errors in the + hard-linking code, and some potential failed checksums (via -c) that + should have matched. - - Fixed a problem with --compress (-z) where the receiving side could - return the error "inflate (token) returned -5". + - Fixed a potential crash when an rsync daemon has a filter/exclude list + and the transfer is using ACLs or xattrs. - - Fixed a bug where --delete-during could delete in a directory before it - noticed that the sending side sent an I/O error for that directory (both - sides of the transfer must be at least 3.0.7). + - Fixed a hang if a really large file is being processed by an rsync that + can't handle 64-bit numbers. Rsync will now complain about the file + being too big and skip it. - - Improved --skip-compress's error handling of bad character-sets and got - rid of a lingering debug fprintf(). + - For devices and special files, we now avoid gathering useless ACL and/or + xattr information for files that aren't being copied. (The un-copied + files are still put into the file list, but there's no need to gather + data that is not going to be used.) This ensures that if the user uses + --no-D, that rsync can't possibly complain about being unable to gather + extended information from special files that are in the file list (but + not in the transfer). - - Fixed the daemon's conveyance of io_error value from the sender. + - Properly handle requesting remote filenames that start with a dash. This + avoids a potential error where a filename could be interpreted as a + (usually invalid) option. - - An rsync daemon use seteuid() (when available) if it used setuid(). + - Fixed a bug in the comparing of upper-case letters in file suffixes for + --skip-compress. - - Get the permissions right on a --fake-super transferred directory that - needs more owner permissions to emulate root behavior. + - If an rsync daemon has a module configured without a path setting, rsync + will now disallow access to that module. - - An absolute-path filter rule (i.e. with a '/' modifier) no longer loses - its modifier when sending the filter rules to the remote rsync. + - If the destination arg is an empty string, it will be treated as a + reference to the current directory (as 2.x used to do). - - Improved the "--delete does not work without -r or -d" message. + - If rsync was compiled with a newer time-setting function (such as + lutimes), rsync will fall-back to an older function (such as utimes) on a + system where the newer function is not around. This helps to make the + rsync binary more portable in mixed-OS-release situations. - - Improved rsync's handling of --timeout to avoid a weird timeout case - where the sender could timeout even though it has recently written data - to the socket (but hasn't read data recently, due to the writing). + - Fixed a batch-file writing bug that would not write out the full set of + compatibility flags that the transfer was using. This fixes a potential + protocol problem for a batch file that contains a sender-side I/O error: + it would have been sent in a way that the batch-reader wasn't expecting. - - Some misc manpage improvements. + - Some improvements to the hard-linking code to ensure that device-number + hashing is working right, and to supply more information if the hard-link + code fails. - - Fixed the chmod-temp-dir testsuite on a system without /var/tmp. + - The --inplace code was improved to not search for an impossible checksum + position. The quadruple-verbose chunk[N] message will now mention when + an inplace chunk was handled by a seek rather than a read+write. - - Make sure that a timeout specified in the daemon's config is used as a - maximum timeout value when the user also specifies a timeout. + - Improved ACL mask handling, e.g. for Solaris. - - Improved the error-exit reporting when rsync gets an error trying to - cleanup after an error: the initial error is reported. + - Fixed a bug that prevented --numeric-ids from disabling the translation + of user/group IDs for ACLs. - - Improved configure's detection of IPv6 for solaris and cygwin. + - Fixed an issue where an xattr and/or ACL transfer that used an alt-dest + option (e.g. --link-dest) could output an error trying to itemize the + changes against the alt-dest directory's xattr/ACL info but was instead + trying to access the not-yet-existing new destination directory. - - The AIX sysacls routines will now return ENOSYS if ENOTSUP is missing. + - Improved xattr system-error messages to mention the full path to the + file. - - Made our (only used if missing) getaddrinfo() routine use inet_pton() - (which we also provide) instead of inet_aton(). + - The --link-dest checking for identical symlinks now avoids considering + attribute differences that cannot be changed on the receiver. - - The exit-related debug messages now mention the program's role so it is - clear who output what message. + - Avoid trying to read/write xattrs on certain file types for certain OSes. + Improved configure to set NO_SYMLINK_XATTRS, NO_DEVICE_XATTRS, and/or + NO_SPECIAL_XATTRS defines in config.h. + + - Improved the unsafe-symlink errors messages. + + - Fixed a bug setting xattrs on new files that aren't user writable. + + - Avoid re-setting xattrs on a hard-linked file w/the same xattrs. + + - Fixed a bug with --fake-super when copying files and dirs that aren't + user writable. + + - Fixed a bug where a sparse file could have its last sparse block turned + into a real block when rsync sets the file size (requires ftruncate). + + - If a temp-file name is too long, rsync now avoids truncating the name in + the middle of adjacent high-bit characters. This prevents a potential + filename error if the filesystem doesn't allow a name to contain an + invalid multi-byte sequence. + + - If a muli-protocol socket connection fails (i.e., when contacting a + daemon), we now report all the failures, not just the last one. This + avoids losing a relevant error (e.g. an IPv4 connection-refused error) + that happened before the final error (e.g. an IPv6 protocol-not-supported + error). + + - Generate a transfer error if we try to call chown with a -1 for a uid or + a gid (which is not settable). + + - Fixed the working of --force when used with --one-file-system. + + - Fix the popt arg parsing so that an option that doesn't take an arg will + reject an attempt to supply one (can configure --with-included-popt if + your system's popt library doesn't yet have this fix). + + - A couple minor option tweaks to the support/rrsync script, and also some + regex changes that make vim highlighting happier. + + - Fixed some issues in the support/mnt-excl script. + + - Various manpage improvements. + + ENHANCEMENTS: + + - Added ".hg/" to the default cvs excludes (see -C & --cvs-exclude). DEVELOPER RELATED: - - Got rid of type-punned compiler warnings output by newer gcc versions. + - Use lchmod() whenever it is available (not just on symlinks). + + - A couple fixes to the socketpair_tcp() routine. + + - Updated the helper scripts in the packaging subdirectory. + + - Renamed configure.in to configure.ac. - - The Makefile now ensures that proto.h will be rebuilt if config.h changes. + - Fixed configure's checking for iconv routines for newer OS X versions. - - The testsuite no longer uses "id -u", so it works better on solaris. + - Fixed the testsuite/xattrs.test script on OS X. diff --git a/OLDNEWS b/OLDNEWS index 06a53c7..2c0af86 100644 --- a/OLDNEWS +++ b/OLDNEWS @@ -1,3 +1,69 @@ +NEWS for rsync 3.0.7 (31 Dec 2009) +Protocol: 30 (unchanged) +Changes since 3.0.6: + + BUG FIXES: + + - Fixed a bogus free when using --xattrs with --backup. + + - Avoid an error when --dry-run was trying to stat a prior hard-link file + that hasn't really been created. + + - Fixed a problem with --compress (-z) where the receiving side could + return the error "inflate (token) returned -5". + + - Fixed a bug where --delete-during could delete in a directory before it + noticed that the sending side sent an I/O error for that directory (both + sides of the transfer must be at least 3.0.7). + + - Improved --skip-compress's error handling of bad character-sets and got + rid of a lingering debug fprintf(). + + - Fixed the daemon's conveyance of io_error value from the sender. + + - An rsync daemon use seteuid() (when available) if it used setuid(). + + - Get the permissions right on a --fake-super transferred directory that + needs more owner permissions to emulate root behavior. + + - An absolute-path filter rule (i.e. with a '/' modifier) no longer loses + its modifier when sending the filter rules to the remote rsync. + + - Improved the "--delete does not work without -r or -d" message. + + - Improved rsync's handling of --timeout to avoid a weird timeout case + where the sender could timeout even though it has recently written data + to the socket (but hasn't read data recently, due to the writing). + + - Some misc manpage improvements. + + - Fixed the chmod-temp-dir testsuite on a system without /var/tmp. + + - Make sure that a timeout specified in the daemon's config is used as a + maximum timeout value when the user also specifies a timeout. + + - Improved the error-exit reporting when rsync gets an error trying to + cleanup after an error: the initial error is reported. + + - Improved configure's detection of IPv6 for solaris and cygwin. + + - The AIX sysacls routines will now return ENOSYS if ENOTSUP is missing. + + - Made our (only used if missing) getaddrinfo() routine use inet_pton() + (which we also provide) instead of inet_aton(). + + - The exit-related debug messages now mention the program's role so it is + clear who output what message. + + DEVELOPER RELATED: + + - Got rid of type-punned compiler warnings output by newer gcc versions. + + - The Makefile now ensures that proto.h will be rebuilt if config.h changes. + + - The testsuite no longer uses "id -u", so it works better on solaris. + + NEWS for rsync 3.0.6 (8 May 2009) Protocol: 30 (unchanged) Changes since 3.0.5: @@ -3028,6 +3094,7 @@ Changes since 2.4.6: Partial Protocol History RELEASE DATE VER. DATE OF COMMIT* PROTOCOL + 26 Mar 2011 3.0.8 30 31 Dec 2009 3.0.7 30 08 May 2009 3.0.6 30 28 Dec 2008 3.0.5 30 diff --git a/acls.c b/acls.c index e2bdc4c..e6f6088 100644 --- a/acls.c +++ b/acls.c @@ -31,6 +31,8 @@ extern int list_only; extern int orig_umask; extern int numeric_ids; extern int inc_recurse; +extern int preserve_devices; +extern int preserve_specials; /* Flags used to indicate what items are being transmitted for an entry. */ #define XMIT_USER_OBJ (1<<0) @@ -115,10 +117,11 @@ static int calc_sacl_entries(const rsync_acl *racl) /* A System ACL always gets user/group/other permission entries. */ return racl->names.count #ifdef ACLS_NEED_MASK - + 4; + + 1 #else - + (racl->mask_obj != NO_ENTRY) + 3; + + (racl->mask_obj != NO_ENTRY) #endif + + 3; } /* Extracts and returns the permission bits from the ACL. This cannot be @@ -132,16 +135,21 @@ static int rsync_acl_get_perms(const rsync_acl *racl) /* Removes the permission-bit entries from the ACL because these * can be reconstructed from the file's mode. */ -static void rsync_acl_strip_perms(rsync_acl *racl) +static void rsync_acl_strip_perms(stat_x *sxp) { + rsync_acl *racl = sxp->acc_acl; + racl->user_obj = NO_ENTRY; if (racl->mask_obj == NO_ENTRY) racl->group_obj = NO_ENTRY; else { - if (racl->group_obj == racl->mask_obj) + int group_perms = (sxp->st.st_mode >> 3) & 7; + if (racl->group_obj == group_perms) racl->group_obj = NO_ENTRY; - if (racl->names.count != 0) +#ifndef HAVE_SOLARIS_ACLS + if (racl->names.count != 0 && racl->mask_obj == group_perms) racl->mask_obj = NO_ENTRY; +#endif } racl->other_obj = NO_ENTRY; } @@ -340,15 +348,6 @@ static BOOL unpack_smb_acl(SMB_ACL_T sacl, rsync_acl *racl) /* Truncate the temporary list now that its idas have been saved. */ temp_ida_list.count = 0; -#ifdef ACLS_NEED_MASK - if (!racl->names.count && racl->mask_obj != NO_ENTRY) { - /* Throw away a superfluous mask, but mask off the - * group perms with it first. */ - racl->group_obj &= racl->mask_obj; - racl->mask_obj = NO_ENTRY; - } -#endif - return True; } @@ -540,6 +539,23 @@ static int get_rsync_acl(const char *fname, rsync_acl *racl, int get_acl(const char *fname, stat_x *sxp) { sxp->acc_acl = create_racl(); + + if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) { + /* Everyone supports this. */ + } else if (S_ISLNK(sxp->st.st_mode)) { + return 0; + } else if (IS_SPECIAL(sxp->st.st_mode)) { +#ifndef NO_SPECIAL_ACLS + if (!preserve_specials) +#endif + return 0; + } else if (IS_DEVICE(sxp->st.st_mode)) { +#ifndef NO_DEVICE_ACLS + if (!preserve_devices) +#endif + return 0; + } + if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS, sxp->st.st_mode) < 0) { free_acl(sxp); @@ -561,7 +577,7 @@ int get_acl(const char *fname, stat_x *sxp) /* === Send functions === */ /* Send the ida list over the file descriptor. */ -static void send_ida_entries(const ida_entries *idal, int f) +static void send_ida_entries(int f, const ida_entries *idal) { id_access *ida; size_t count = idal->count; @@ -573,9 +589,9 @@ static void send_ida_entries(const ida_entries *idal, int f) const char *name; if (ida->access & NAME_IS_USER) { xbits |= XFLAG_NAME_IS_USER; - name = add_uid(ida->id); + name = numeric_ids ? NULL : add_uid(ida->id); } else - name = add_gid(ida->id); + name = numeric_ids ? NULL : add_gid(ida->id); write_varint(f, ida->id); if (inc_recurse && name) { int len = strlen(name); @@ -587,8 +603,8 @@ static void send_ida_entries(const ida_entries *idal, int f) } } -static void send_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type, - item_list *racl_list, int f) +static void send_rsync_acl(int f, rsync_acl *racl, SMB_ACL_TYPE_T type, + item_list *racl_list) { int ndx = find_matching_rsync_acl(racl, type, racl_list); @@ -621,7 +637,7 @@ static void send_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type, if (flags & XMIT_OTHER_OBJ) write_varint(f, racl->other_obj); if (flags & XMIT_NAME_LIST) - send_ida_entries(&racl->names, f); + send_ida_entries(f, &racl->names); /* Give the allocated data to the new list object. */ *new_racl = *racl; @@ -631,28 +647,28 @@ static void send_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type, /* Send the ACL from the stat_x structure down the indicated file descriptor. * This also frees the ACL data. */ -void send_acl(stat_x *sxp, int f) +void send_acl(int f, stat_x *sxp) { if (!sxp->acc_acl) { sxp->acc_acl = create_racl(); rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode); } /* Avoid sending values that can be inferred from other data. */ - rsync_acl_strip_perms(sxp->acc_acl); + rsync_acl_strip_perms(sxp); - send_rsync_acl(sxp->acc_acl, SMB_ACL_TYPE_ACCESS, &access_acl_list, f); + send_rsync_acl(f, sxp->acc_acl, SMB_ACL_TYPE_ACCESS, &access_acl_list); if (S_ISDIR(sxp->st.st_mode)) { if (!sxp->def_acl) sxp->def_acl = create_racl(); - send_rsync_acl(sxp->def_acl, SMB_ACL_TYPE_DEFAULT, &default_acl_list, f); + send_rsync_acl(f, sxp->def_acl, SMB_ACL_TYPE_DEFAULT, &default_acl_list); } } /* === Receive functions === */ -static uint32 recv_acl_access(uchar *name_follows_ptr, int f) +static uint32 recv_acl_access(int f, uchar *name_follows_ptr) { uint32 access = read_varint(f); @@ -677,7 +693,7 @@ static uint32 recv_acl_access(uchar *name_follows_ptr, int f) return access; } -static uchar recv_ida_entries(ida_entries *ent, int f) +static uchar recv_ida_entries(int f, ida_entries *ent) { uchar computed_mask_bits = 0; int i, count = read_varint(f); @@ -693,7 +709,7 @@ static uchar recv_ida_entries(ida_entries *ent, int f) for (i = 0; i < count; i++) { uchar has_name; id_t id = read_varint(f); - uint32 access = recv_acl_access(&has_name, f); + uint32 access = recv_acl_access(f, &has_name); if (has_name) { if (access & NAME_IS_USER) @@ -716,7 +732,7 @@ static uchar recv_ida_entries(ida_entries *ent, int f) return computed_mask_bits & ~NO_ENTRY; } -static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f) +static int recv_rsync_acl(int f, item_list *racl_list, SMB_ACL_TYPE_T type, mode_t mode) { uchar computed_mask_bits = 0; acl_duo *duo_item; @@ -731,7 +747,7 @@ static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f) if (ndx != 0) return ndx - 1; - + ndx = racl_list->count; duo_item = EXPAND_ITEM_LIST(racl_list, acl_duo, 1000); duo_item->racl = empty_rsync_acl; @@ -739,22 +755,28 @@ static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f) flags = read_byte(f); if (flags & XMIT_USER_OBJ) - duo_item->racl.user_obj = recv_acl_access(NULL, f); + duo_item->racl.user_obj = recv_acl_access(f, NULL); if (flags & XMIT_GROUP_OBJ) - duo_item->racl.group_obj = recv_acl_access(NULL, f); + duo_item->racl.group_obj = recv_acl_access(f, NULL); if (flags & XMIT_MASK_OBJ) - duo_item->racl.mask_obj = recv_acl_access(NULL, f); + duo_item->racl.mask_obj = recv_acl_access(f, NULL); if (flags & XMIT_OTHER_OBJ) - duo_item->racl.other_obj = recv_acl_access(NULL, f); + duo_item->racl.other_obj = recv_acl_access(f, NULL); if (flags & XMIT_NAME_LIST) - computed_mask_bits |= recv_ida_entries(&duo_item->racl.names, f); + computed_mask_bits |= recv_ida_entries(f, &duo_item->racl.names); #ifdef HAVE_OSX_ACLS /* If we received a superfluous mask, throw it away. */ duo_item->racl.mask_obj = NO_ENTRY; #else - if (duo_item->racl.names.count && duo_item->racl.mask_obj == NO_ENTRY) /* Must be non-empty with lists. */ - duo_item->racl.mask_obj = (computed_mask_bits | duo_item->racl.group_obj) & ~NO_ENTRY; + if (duo_item->racl.names.count && duo_item->racl.mask_obj == NO_ENTRY) { + /* Mask must be non-empty with lists. */ + if (type == SMB_ACL_TYPE_ACCESS) + computed_mask_bits = (mode >> 3) & 7; + else + computed_mask_bits |= duo_item->racl.group_obj & ~NO_ENTRY; + duo_item->racl.mask_obj = computed_mask_bits; + } #endif duo_item->sacl = NULL; @@ -763,12 +785,12 @@ static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f) } /* Receive the ACL info the sender has included for this file-list entry. */ -void receive_acl(struct file_struct *file, int f) +void receive_acl(int f, struct file_struct *file) { - F_ACL(file) = recv_rsync_acl(&access_acl_list, SMB_ACL_TYPE_ACCESS, f); + F_ACL(file) = recv_rsync_acl(f, &access_acl_list, SMB_ACL_TYPE_ACCESS, file->mode); if (S_ISDIR(file->mode)) - F_DIR_DEFACL(file) = recv_rsync_acl(&default_acl_list, SMB_ACL_TYPE_DEFAULT, f); + F_DIR_DEFACL(file) = recv_rsync_acl(f, &default_acl_list, SMB_ACL_TYPE_DEFAULT, 0); } static int cache_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type, item_list *racl_list) @@ -880,12 +902,14 @@ static mode_t change_sacl_perms(SMB_ACL_T sacl, rsync_acl *racl, mode_t old_mode COE2( store_access_in_entry,((mode >> 3) & 7, entry) ); break; case SMB_ACL_MASK: +#ifndef HAVE_SOLARIS_ACLS #ifndef ACLS_NEED_MASK /* mask is only empty when we don't need it. */ if (racl->mask_obj == NO_ENTRY) break; #endif COE2( store_access_in_entry,((mode >> 3) & 7, entry) ); +#endif break; case SMB_ACL_OTHER: COE2( store_access_in_entry,(mode & 7, entry) ); @@ -898,7 +922,7 @@ static mode_t change_sacl_perms(SMB_ACL_T sacl, rsync_acl *racl, mode_t old_mode rsyserr(FERROR_XFER, errno, "change_sacl_perms: %s()", errfun); } - return (mode_t)~0; + return (mode_t)-1; } #ifdef SMB_ACL_LOSES_SPECIAL_MODE_BITS @@ -967,7 +991,7 @@ static int set_rsync_acl(const char *fname, acl_duo *duo_item, if (type == SMB_ACL_TYPE_ACCESS) { cur_mode = change_sacl_perms(duo_item->sacl, &duo_item->racl, cur_mode, mode); - if (cur_mode == (mode_t)~0) + if (cur_mode == (mode_t)-1) return 0; } #endif @@ -983,17 +1007,17 @@ static int set_rsync_acl(const char *fname, acl_duo *duo_item, return 0; } -/* Set ACL on indicated filename. +/* Given a fname, this sets extended access ACL entries, the default ACL (for a + * dir), and the regular mode bits on the file. Call this with fname set to + * NULL to just check if the ACL is different. * - * This sets extended access ACL entries and default ACL. If convenient, - * it sets permission bits along with the access ACL and signals having - * done so by modifying sxp->st.st_mode. + * If the ACL operation has a side-effect of changing the file's mode, the + * sxp->st.st_mode value will be changed to match. * - * Returns 1 for unchanged, 0 for changed, -1 for failed. Call this - * with fname set to NULL to just check if the ACL is unchanged. */ -int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp) + * Returns 0 for an unchanged ACL, 1 for changed, -1 for failed. */ +int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp, mode_t new_mode) { - int unchanged = 1; + int changed = 0; int32 ndx; BOOL eq; @@ -1007,18 +1031,18 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp) acl_duo *duo_item = access_acl_list.items; duo_item += ndx; eq = sxp->acc_acl - && rsync_acl_equal_enough(sxp->acc_acl, &duo_item->racl, file->mode); + && rsync_acl_equal_enough(sxp->acc_acl, &duo_item->racl, new_mode); if (!eq) { - unchanged = 0; + changed = 1; if (!dry_run && fname && set_rsync_acl(fname, duo_item, SMB_ACL_TYPE_ACCESS, - sxp, file->mode) < 0) - unchanged = -1; + sxp, new_mode) < 0) + return -1; } } - if (!S_ISDIR(sxp->st.st_mode)) - return unchanged; + if (!S_ISDIR(new_mode)) + return changed; ndx = F_DIR_DEFACL(file); if (ndx >= 0 && (size_t)ndx < default_acl_list.count) { @@ -1026,16 +1050,15 @@ int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp) duo_item += ndx; eq = sxp->def_acl && rsync_acl_equal(sxp->def_acl, &duo_item->racl); if (!eq) { - if (unchanged > 0) - unchanged = 0; + changed = 1; if (!dry_run && fname && set_rsync_acl(fname, duo_item, SMB_ACL_TYPE_DEFAULT, - sxp, file->mode) < 0) - unchanged = -1; + sxp, new_mode) < 0) + return -1; } } - return unchanged; + return changed; } /* Non-incremental recursion needs to convert all the received IDs. @@ -1078,6 +1101,9 @@ int default_perms_for_dir(const char *dir) if (sacl == NULL) { /* Couldn't get an ACL. Darn. */ switch (errno) { + case EINVAL: + /* If SMB_ACL_TYPE_DEFAULT isn't valid, then the ACLs must be non-POSIX. */ + break; #ifdef ENOTSUP case ENOTSUP: #endif diff --git a/backup.c b/backup.c index 7512d92..d918146 100644 --- a/backup.c +++ b/backup.c @@ -309,8 +309,8 @@ static int keep_backup(const char *fname) const char *sl = F_SYMLINK(file); if (safe_symlinks && unsafe_symlink(sl, fname)) { if (verbose) { - rprintf(FINFO, "ignoring unsafe symlink %s -> %s\n", - full_fname(buf), sl); + rprintf(FINFO, "not backing up unsafe symlink \"%s\" -> \"%s\"\n", + fname, sl); } kept = 1; } else { diff --git a/case_N.h b/case_N.h index eb31663..52bd4ec 100644 --- a/case_N.h +++ b/case_N.h @@ -1,7 +1,7 @@ /* - * End-of-run cleanup helper code used by cleanup.c. + * Allow an arbitrary sequence of case labels. * - * Copyright (C) 2006-2008 Wayne Davison + * Copyright (C) 2006-2010 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 @@ -17,63 +17,60 @@ * with this program; if not, visit the http://fsf.org website. */ -/* This is included by cleanup.c multiple times, once for every segement in - * the _exit_cleanup() code. This produces the next "case N:" statement in - * sequence and increments the cleanup_step variable by 1. This ensures that - * our case statements never get out of whack due to added/removed steps. */ +/* This is included multiple times, once for every segement in a switch statement. + * This produces the next "case N:" statement in sequence. */ -#if !defined EXIT_CLEANUP_CASE_0 -#define EXIT_CLEANUP_CASE_0 +#if !defined CASE_N_STATE_0 +#define CASE_N_STATE_0 case 0: -#elif !defined EXIT_CLEANUP_CASE_1 -#define EXIT_CLEANUP_CASE_1 +#elif !defined CASE_N_STATE_1 +#define CASE_N_STATE_1 case 1: -#elif !defined EXIT_CLEANUP_CASE_2 -#define EXIT_CLEANUP_CASE_2 +#elif !defined CASE_N_STATE_2 +#define CASE_N_STATE_2 case 2: -#elif !defined EXIT_CLEANUP_CASE_3 -#define EXIT_CLEANUP_CASE_3 +#elif !defined CASE_N_STATE_3 +#define CASE_N_STATE_3 case 3: -#elif !defined EXIT_CLEANUP_CASE_4 -#define EXIT_CLEANUP_CASE_4 +#elif !defined CASE_N_STATE_4 +#define CASE_N_STATE_4 case 4: -#elif !defined EXIT_CLEANUP_CASE_5 -#define EXIT_CLEANUP_CASE_5 +#elif !defined CASE_N_STATE_5 +#define CASE_N_STATE_5 case 5: -#elif !defined EXIT_CLEANUP_CASE_6 -#define EXIT_CLEANUP_CASE_6 +#elif !defined CASE_N_STATE_6 +#define CASE_N_STATE_6 case 6: -#elif !defined EXIT_CLEANUP_CASE_7 -#define EXIT_CLEANUP_CASE_7 +#elif !defined CASE_N_STATE_7 +#define CASE_N_STATE_7 case 7: -#elif !defined EXIT_CLEANUP_CASE_8 -#define EXIT_CLEANUP_CASE_8 +#elif !defined CASE_N_STATE_8 +#define CASE_N_STATE_8 case 8: -#elif !defined EXIT_CLEANUP_CASE_9 -#define EXIT_CLEANUP_CASE_9 +#elif !defined CASE_N_STATE_9 +#define CASE_N_STATE_9 case 9: -#elif !defined EXIT_CLEANUP_CASE_10 -#define EXIT_CLEANUP_CASE_10 +#elif !defined CASE_N_STATE_10 +#define CASE_N_STATE_10 case 10: -#elif !defined EXIT_CLEANUP_CASE_11 -#define EXIT_CLEANUP_CASE_11 +#elif !defined CASE_N_STATE_11 +#define CASE_N_STATE_11 case 11: -#elif !defined EXIT_CLEANUP_CASE_12 -#define EXIT_CLEANUP_CASE_12 +#elif !defined CASE_N_STATE_12 +#define CASE_N_STATE_12 case 12: -#elif !defined EXIT_CLEANUP_CASE_13 -#define EXIT_CLEANUP_CASE_13 +#elif !defined CASE_N_STATE_13 +#define CASE_N_STATE_13 case 13: -#elif !defined EXIT_CLEANUP_CASE_14 -#define EXIT_CLEANUP_CASE_14 +#elif !defined CASE_N_STATE_14 +#define CASE_N_STATE_14 case 14: -#elif !defined EXIT_CLEANUP_CASE_15 -#define EXIT_CLEANUP_CASE_15 +#elif !defined CASE_N_STATE_15 +#define CASE_N_STATE_15 case 15: -#elif !defined EXIT_CLEANUP_CASE_16 -#define EXIT_CLEANUP_CASE_16 +#elif !defined CASE_N_STATE_16 +#define CASE_N_STATE_16 case 16: #else #error Need to add more case statements! #endif - cleanup_step++; diff --git a/checksum.c b/checksum.c index 4aaeb95..90d6ee3 100644 --- a/checksum.c +++ b/checksum.c @@ -24,8 +24,6 @@ extern int checksum_seed; extern int protocol_version; -int csum_length = SHORT_SUM_LENGTH; /* initial value */ - /* a simple 32 bit checksum that can be upadted from either end (inspired by Mark Adler's Adler-32 checksum) diff --git a/cleanup.c b/cleanup.c index 9a0bdd7..9382215 100644 --- a/cleanup.c +++ b/cleanup.c @@ -94,7 +94,7 @@ pid_t cleanup_child_pid = -1; **/ NORETURN void _exit_cleanup(int code, const char *file, int line) { - static int cleanup_step = 0; + static int switch_step = 0; static int exit_code = 0, exit_line = 0; static const char *exit_file = NULL; static int unmodified_code = 0; @@ -115,8 +115,9 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* Some of our actions might cause a recursive call back here, so we * keep track of where we are in the cleanup and never repeat a step. */ - switch (cleanup_step) { -#include "case_N.h" /* case 0: cleanup_step++; */ + switch (switch_step) { +#include "case_N.h" /* case 0: */ + switch_step++; exit_code = unmodified_code = code; exit_file = file; @@ -130,6 +131,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (cleanup_child_pid != -1) { int status; @@ -143,6 +145,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (cleanup_got_literal && cleanup_fname && cleanup_new_fname && keep_partial && handle_partial_dir(cleanup_new_fname, PDIR_CREATE)) { @@ -160,12 +163,14 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (!code || am_server || am_receiver) io_flush(FULL_FLUSH); /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (cleanup_fname) do_unlink(cleanup_fname); @@ -191,6 +196,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (verbose > 2) { rprintf(FINFO, @@ -201,6 +207,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line) /* FALLTHROUGH */ #include "case_N.h" + switch_step++; if (am_server && code) msleep(100); diff --git a/clientserver.c b/clientserver.c index 806a6e3..038900e 100644 --- a/clientserver.c +++ b/clientserver.c @@ -259,7 +259,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char if (strncmp(*argv, modname, modlen) == 0 && argv[0][modlen] == '\0') sargs[sargc++] = modname; /* we send "modname/" */ - else + else if (**argv == '-') { + if (asprintf(sargs + sargc++, "./%s", *argv) < 0) + out_of_memory("start_inband_exchange"); + } else sargs[sargc++] = *argv; argv++; argc--; @@ -509,6 +512,11 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host) * supplementary groups. */ module_dir = lp_path(i); + if (*module_dir == '\0') { + rprintf(FLOG, "No path specified for module %s\n", name); + io_printf(f_out, "@ERROR: no path setting.\n"); + return -1; + } if (use_chroot) { if ((p = strstr(module_dir, "/./")) != NULL) { *p = '\0'; /* Temporary... */ diff --git a/compat.c b/compat.c index c2b475b..a7a49cc 100644 --- a/compat.c +++ b/compat.c @@ -24,6 +24,7 @@ int remote_protocol = 0; int file_extra_cnt = 0; /* count of file-list extras that everyone gets */ int inc_recurse = 0; +int compat_flags = 0; int use_safe_inc_flist = 0; extern int verbose; @@ -248,10 +249,9 @@ void setup_protocol(int f_out,int f_in) exit_cleanup(RERR_PROTOCOL); } } else if (protocol_version >= 30) { - int compat_flags; if (am_server) { compat_flags = allow_inc_recurse ? CF_INC_RECURSE : 0; -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES compat_flags |= CF_SYMLINK_TIMES; #endif #ifdef ICONV_OPTION @@ -269,7 +269,7 @@ void setup_protocol(int f_out,int f_in) ? strchr(client_info, 'L') != NULL : !!(compat_flags & CF_SYMLINK_TIMES); } -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES else receiver_symlink_times = 1; #endif @@ -287,7 +287,7 @@ void setup_protocol(int f_out,int f_in) } use_safe_inc_flist = !!(compat_flags & CF_SAFE_FLIST); need_messages_from_generator = 1; -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES } else if (!am_sender) { receiver_symlink_times = 1; #endif diff --git a/configure.in b/configure.ac similarity index 97% rename from configure.in rename to configure.ac index 685970b..ff21b3a 100644 --- a/configure.in +++ b/configure.ac @@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h]) AC_CONFIG_HEADER(config.h) AC_PREREQ(2.59) -RSYNC_VERSION=3.0.7 +RSYNC_VERSION=3.0.8 AC_SUBST(RSYNC_VERSION) AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION]) @@ -46,7 +46,7 @@ AC_DEFINE([_GNU_SOURCE], 1, [Define _GNU_SOURCE so that we get all necessary prototypes]) if test x"$ac_cv_prog_cc_stdc" = x"no"; then - AC_MSG_WARN([rsync requires an ANSI C compiler and you don't seem to have one]) + AC_MSG_WARN([rsync requires an ANSI C compiler and you do not seem to have one]) fi AC_ARG_ENABLE(profile, @@ -193,7 +193,7 @@ ipv6trylibc=yes AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], - [don't even try to use 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 @@ -307,7 +307,7 @@ AC_ARG_ENABLE([locale], AC_HELP_STRING([--disable-locale], [disable locale features])) AH_TEMPLATE([CONFIG_LOCALE], -[Undefine if you don't want locale features. By default this is defined.]) +[Undefine if you do not want locale features. By default this is defined.]) if test x"$enable_locale" != x"no"; then AC_DEFINE(CONFIG_LOCALE) fi @@ -428,8 +428,10 @@ fi AC_SEARCH_LIBS(inet_ntop, resolv) -# Solaris and HP-UX weirdness: -# Search for libiconv_open (not iconv_open) to discover if -liconv is needed! +# For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll +# accept either iconv_open or libiconv_open, since some include files map +# the former to the latter. +AC_SEARCH_LIBS(iconv_open, iconv) AC_SEARCH_LIBS(libiconv_open, iconv) AC_MSG_CHECKING([for iconv declaration]) @@ -571,7 +573,8 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \ strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \ 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) + extattr_get_link sigaction sigprocmask setattrlist \ + utimensat) dnl cygwin iconv.h defines iconv_open as libiconv_open if test x"$ac_cv_func_iconv_open" != x"yes"; then @@ -963,11 +966,14 @@ else AC_MSG_RESULT(Using Linux xattrs) AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs]) AC_DEFINE(SUPPORT_XATTRS, 1) + AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs]) ;; darwin*) AC_MSG_RESULT(Using OS X xattrs) AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs]) AC_DEFINE(SUPPORT_XATTRS, 1) + AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs]) + AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs]) ;; freebsd*) AC_MSG_RESULT(Using FreeBSD extattrs) diff --git a/exclude.c b/exclude.c index 70fa8c8..6101dda 100644 --- a/exclude.c +++ b/exclude.c @@ -37,7 +37,7 @@ extern int sanitize_paths; extern int protocol_version; extern int module_id; -extern char curr_dir[]; +extern char curr_dir[MAXPATHLEN]; extern unsigned int curr_dir_len; extern unsigned int module_dirlen; @@ -924,7 +924,7 @@ static char default_cvsignore[] = " *.a *.olb *.o *.obj *.so *.exe" " *.Z *.elc *.ln core" /* The rest we added to suit ourself. */ - " .svn/ .git/ .bzr/"; + " .svn/ .git/ .hg/ .bzr/"; static void get_cvs_excludes(uint32 mflags) { diff --git a/fileio.c b/fileio.c index 97b346d..71a7d9a 100644 --- a/fileio.c +++ b/fileio.c @@ -27,24 +27,32 @@ extern int sparse_files; -static char last_byte; static OFF_T sparse_seek = 0; -int sparse_end(int f) +int sparse_end(int f, OFF_T size) { int ret; if (!sparse_seek) return 0; - do_lseek(f, sparse_seek-1, SEEK_CUR); - sparse_seek = 0; +#ifdef HAVE_FTRUNCATE + ret = do_ftruncate(f, size); +#else + if (do_lseek(f, sparse_seek-1, SEEK_CUR) != size-1) + ret = -1; + else { + do { + ret = write(f, "", 1); + } while (ret < 0 && errno == EINTR); + + ret = ret <= 0 ? -1 : 0; + } +#endif - do { - ret = write(f, "", 1); - } while (ret < 0 && errno == EINTR); + sparse_seek = 0; - return ret <= 0 ? -1 : 0; + return ret; } @@ -56,10 +64,6 @@ static int write_sparse(int f, char *buf, int len) for (l1 = 0; l1 < len && buf[l1] == 0; l1++) {} for (l2 = 0; l2 < len-l1 && buf[len-(l2+1)] == 0; l2++) {} - /* XXX Riddle me this: why does this function SLOW DOWN when I - * remove the following (unneeded) line?? Core Duo weirdness? */ - last_byte = buf[len-1]; - sparse_seek += l1; if (l1 == len) diff --git a/flist.c b/flist.c index 7139b10..7102b5b 100644 --- a/flist.c +++ b/flist.c @@ -52,12 +52,9 @@ extern int preserve_hard_links; extern int preserve_devices; extern int preserve_specials; extern int delete_during; -extern int uid_ndx; -extern int gid_ndx; extern int eol_nulls; extern int relative_paths; extern int implied_dirs; -extern int file_extra_cnt; extern int ignore_perishable; extern int non_perishable_cnt; extern int prune_empty_dirs; @@ -70,6 +67,7 @@ extern int use_safe_inc_flist; extern int need_unsorted_flist; extern int sender_symlink_iconv; extern int unsort_ndx; +extern uid_t our_uid; extern struct stats stats; extern char *filesfrom_host; @@ -118,7 +116,7 @@ int flist_eof = 0; /* all the file-lists are now known */ * will survive just long enough to be used by send_file_entry(). */ static dev_t tmp_rdev; #ifdef SUPPORT_HARD_LINKS -static int64 tmp_dev, tmp_ino; +static int64 tmp_dev = -1, tmp_ino; #endif static char tmp_sum[MAX_DIGEST_LEN]; @@ -480,7 +478,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, modtime = file->modtime; #ifdef SUPPORT_HARD_LINKS - if (tmp_dev != 0) { + if (tmp_dev != -1) { if (protocol_version >= 30) { struct ht_int64_node *np = idev_find(tmp_dev, tmp_ino); first_hlink_ndx = (int32)(long)np->data - 1; @@ -598,15 +596,17 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, #endif #ifdef SUPPORT_HARD_LINKS - if (tmp_dev != 0 && protocol_version < 30) { + if (tmp_dev != -1 && protocol_version < 30) { + /* Older protocols expect the dev number to be transmitted + * 1-incremented so that it is never zero. */ if (protocol_version < 26) { /* 32-bit dev_t and ino_t */ - write_int(f, (int32)dev); + write_int(f, (int32)(dev+1)); write_int(f, (int32)tmp_ino); } else { /* 64-bit dev_t and ino_t */ if (!(xflags & XMIT_SAME_DEV_pre30)) - write_longint(f, dev); + write_longint(f, dev+1); write_longint(f, tmp_ino); } } @@ -630,8 +630,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file, stats.total_size += F_LENGTH(file); } -static struct file_struct *recv_file_entry(struct file_list *flist, - int xflags, int f) +static struct file_struct *recv_file_entry(int f, struct file_list *flist, int xflags) { static int64 modtime; static mode_t mode; @@ -1051,11 +1050,11 @@ static struct file_struct *recv_file_entry(struct file_list *flist, #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(mode)) - receive_acl(file, f); + receive_acl(f, file); #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) - receive_xattr(file, f ); + receive_xattr(f, file); #endif if (S_ISREG(mode) || S_ISLNK(mode)) @@ -1259,10 +1258,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, if (protocol_version >= 28 ? (!S_ISDIR(st.st_mode) && st.st_nlink > 1) : S_ISREG(st.st_mode)) { - tmp_dev = (int64)st.st_dev + 1; + tmp_dev = (int64)st.st_dev; tmp_ino = (int64)st.st_ino; } else - tmp_dev = 0; + tmp_dev = -1; } #endif @@ -1284,10 +1283,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, } #endif file->mode = st.st_mode; - if (uid_ndx) /* Check uid_ndx instead of preserve_uid for del support */ + if (preserve_uid) F_OWNER(file) = st.st_uid; - if (gid_ndx) /* Check gid_ndx instead of preserve_gid for del support */ + if (preserve_gid) F_GROUP(file) = st.st_gid; + if (am_generator && st.st_uid == our_uid) + file->flags |= FLAG_OWNED_BY_US; if (basename != thisname) file->dirname = lastdir; @@ -1427,6 +1428,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { + sx.st.st_mode = file->mode; sx.xattr = NULL; if (get_xattr(fname, &sx) < 0) { io_error |= IOERR_GENERAL; @@ -1443,13 +1445,13 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(file->mode)) { - send_acl(&sx, f); + send_acl(f, &sx); free_acl(&sx); } #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { - F_XATTR(file) = send_xattr(&sx, f); + F_XATTR(file) = send_xattr(f, &sx); free_xattr(&sx); } #endif @@ -1476,12 +1478,6 @@ static void send_if_directory(int f, struct file_list *flist, unsigned int len = strlen(fbuf); if (len > 1 && fbuf[len-1] == '/') fbuf[--len] = '\0'; - if (len >= MAXPATHLEN - 1) { - io_error |= IOERR_GENERAL; - rprintf(FERROR_XFER, "skipping long-named directory: %s\n", - full_fname(fbuf)); - return; - } save_filters = push_local_filters(fbuf, len); send_directory(f, flist, fbuf, len, flags); pop_local_filters(save_filters); @@ -1640,21 +1636,29 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len, } p = fbuf + len; - if (len != 1 || *fbuf != '/') + if (len == 1 && *fbuf == '/') + remainder = MAXPATHLEN - 1; + else if (len < MAXPATHLEN-1) { *p++ = '/'; - *p = '\0'; - remainder = MAXPATHLEN - (p - fbuf); + *p = '\0'; + remainder = MAXPATHLEN - (len + 1); + } else + remainder = 0; for (errno = 0, di = readdir(d); di; errno = 0, di = readdir(d)) { char *dname = d_name(di); if (dname[0] == '.' && (dname[1] == '\0' || (dname[1] == '.' && dname[2] == '\0'))) continue; - if (strlcpy(p, dname, remainder) >= remainder) { + unsigned name_len = strlcpy(p, dname, remainder); + if (name_len >= remainder) { + char save = fbuf[len]; + fbuf[len] = '\0'; io_error |= IOERR_GENERAL; rprintf(FERROR_XFER, - "cannot send long-named file %s\n", - full_fname(fbuf)); + "filename overflows max-path len by %u: %s/%s\n", + name_len - remainder + 1, fbuf, dname); + fbuf[len] = save; continue; } if (dname[0] == '\0') { @@ -2355,7 +2359,7 @@ struct file_list *recv_file_list(int f) } flist_expand(flist, 1); - file = recv_file_entry(flist, flags, f); + file = recv_file_entry(f, flist, flags); if (inc_recurse && S_ISDIR(file->mode)) { flist_expand(dir_flist, 1); @@ -3039,13 +3043,14 @@ char *f_name(const struct file_struct *f, char *fbuf) * of the dirname string, and also indicates that "dirname" is a MAXPATHLEN * buffer (the functions we call will append names onto the end, but the old * dir value will be restored on exit). */ -struct file_list *get_dirlist(char *dirname, int dlen, int ignore_filter_rules) +struct file_list *get_dirlist(char *dirname, int dlen, int flags) { struct file_list *dirlist; char dirbuf[MAXPATHLEN]; int save_recurse = recurse; int save_xfer_dirs = xfer_dirs; int save_prune_empty_dirs = prune_empty_dirs; + int senddir_fd = flags & GDL_IGNORE_FILTER_RULES ? -2 : -1; if (dlen < 0) { dlen = strlcpy(dirbuf, dirname, MAXPATHLEN); @@ -3058,7 +3063,7 @@ struct file_list *get_dirlist(char *dirname, int dlen, int ignore_filter_rules) recurse = 0; xfer_dirs = 1; - send_directory(ignore_filter_rules ? -2 : -1, dirlist, dirname, dlen, FLAG_CONTENT_DIR); + send_directory(senddir_fd, dirlist, dirname, dlen, FLAG_CONTENT_DIR); xfer_dirs = save_xfer_dirs; recurse = save_recurse; if (do_progress) diff --git a/generator.c b/generator.c index 9f3586f..4f74597 100644 --- a/generator.c +++ b/generator.c @@ -44,8 +44,6 @@ extern int preserve_hard_links; extern int preserve_executability; extern int preserve_perms; extern int preserve_times; -extern int uid_ndx; -extern int gid_ndx; extern int delete_mode; extern int delete_before; extern int delete_during; @@ -76,7 +74,7 @@ extern int fuzzy_basis; extern int always_checksum; extern int checksum_len; extern char *partial_dir; -extern char *basis_dir[]; +extern char *basis_dir[MAX_BASIS_DIRS+1]; extern int compare_dest; extern int copy_dest; extern int link_dest; @@ -169,19 +167,12 @@ static enum delret delete_item(char *fbuf, uint16 mode, uint16 flags) do_chmod(fbuf, mode | S_IWUSR); if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) { - int save_uid_ndx = uid_ndx; /* This only happens on the first call to delete_item() since * delete_dir_contents() always calls us w/DEL_DIR_IS_EMPTY. */ - if (!uid_ndx) - uid_ndx = ++file_extra_cnt; ignore_perishable = 1; /* If DEL_RECURSE is not set, this just reports emptiness. */ ret = delete_dir_contents(fbuf, flags); ignore_perishable = 0; - if (!save_uid_ndx) { - --file_extra_cnt; - uid_ndx = 0; - } if (ret == DR_NOT_EMPTY || ret == DR_AT_LIMIT) goto check_ret; /* OK: try to delete the directory. */ @@ -294,7 +285,7 @@ static enum delret delete_dir_contents(char *fname, uint16 flags) } strlcpy(p, fp->basename, remainder); - if (!(fp->mode & S_IWUSR) && !am_root && (uid_t)F_OWNER(fp) == our_uid) + if (!(fp->mode & S_IWUSR) && !am_root && fp->flags & FLAG_OWNED_BY_US) do_chmod(fname, fp->mode | S_IWUSR); /* Save stack by recursing to ourself directly. */ if (S_ISDIR(fp->mode)) { @@ -472,7 +463,6 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev) struct file_list *dirlist; char delbuf[MAXPATHLEN]; int dlen, i; - int save_uid_ndx = uid_ndx; if (!fbuf) { change_local_filter_dir(NULL, 0, 0); @@ -504,9 +494,6 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev) return; } - if (!uid_ndx) - uid_ndx = ++file_extra_cnt; - dirlist = get_dirlist(fbuf, dlen, 0); /* If an item in dirlist is not found in flist, delete it @@ -526,7 +513,7 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev) * a delete_item call with a DEL_MAKE_ROOM flag. */ if (flist_find_ignore_dirness(cur_flist, fp) < 0) { int flags = DEL_RECURSE; - if (!(fp->mode & S_IWUSR) && !am_root && (uid_t)F_OWNER(fp) == our_uid) + if (!(fp->mode & S_IWUSR) && !am_root && fp->flags & FLAG_OWNED_BY_US) flags |= DEL_NO_UID_WRITE; f_name(fp, delbuf); if (delete_during == 2) { @@ -538,11 +525,6 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev) } flist_free(dirlist); - - if (!save_uid_ndx) { - --file_extra_cnt; - uid_ndx = 0; - } } /* This deletes any files on the receiving side that are not present on the @@ -582,45 +564,100 @@ static void do_delete_pass(void) rprintf(FINFO, " \r"); } -int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) +static inline int time_differs(struct file_struct *file, stat_x *sxp) { -#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES - if (S_ISLNK(file->mode)) { - ; - } else -#endif - if (preserve_times && cmp_time(sxp->st.st_mtime, file->modtime) != 0) - return 0; + return cmp_time(sxp->st.st_mtime, file->modtime); +} - if (preserve_perms) { - if (!BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS)) - return 0; - } else if (preserve_executability - && ((sxp->st.st_mode & 0111 ? 1 : 0) ^ (file->mode & 0111 ? 1 : 0))) - return 0; +static inline int perms_differ(struct file_struct *file, stat_x *sxp) +{ + if (preserve_perms) + return !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS); + + if (preserve_executability) + return (sxp->st.st_mode & 0111 ? 1 : 0) ^ (file->mode & 0111 ? 1 : 0); + + return 0; +} +static inline int ownership_differs(struct file_struct *file, stat_x *sxp) +{ if (am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file)) - return 0; + return 1; if (gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file)) - return 0; + return 1; + + return 0; +} #ifdef SUPPORT_ACLS - if (preserve_acls && !S_ISLNK(file->mode)) { +static inline int acls_differ(const char *fname, struct file_struct *file, stat_x *sxp) +{ + if (preserve_acls) { if (!ACL_READY(*sxp)) get_acl(fname, sxp); - if (set_acl(NULL, file, sxp) == 0) - return 0; + if (set_acl(NULL, file, sxp, file->mode)) + return 1; } + + return 0; +} #endif + #ifdef SUPPORT_XATTRS +static inline int xattrs_differ(const char *fname, struct file_struct *file, stat_x *sxp) +{ if (preserve_xattrs) { if (!XATTR_READY(*sxp)) get_xattr(fname, sxp); if (xattr_diff(file, sxp, 0)) - return 0; + return 1; } + + return 0; +} +#endif + +int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp) +{ + if (S_ISLNK(file->mode)) { +#ifdef CAN_SET_SYMLINK_TIMES + if (preserve_times & PRESERVE_LINK_TIMES && time_differs(file, sxp)) + return 0; +#endif +#ifdef CAN_CHMOD_SYMLINK + if (perms_differ(file, sxp)) + return 0; +#endif +#ifndef CAN_CHOWN_SYMLINK + if (ownership_differs(file, sxp)) + return 0; +#endif +#if defined SUPPORT_ACLS && 0 /* no current symlink-ACL support */ + if (acls_differ(fname, file, sxp)) + return 0; +#endif +#if defined SUPPORT_XATTRS && !defined NO_SYMLINK_XATTRS + if (xattrs_differ(fname, file, sxp)) + return 0; #endif + } else { + if (preserve_times && time_differs(file, sxp)) + return 0; + if (perms_differ(file, sxp)) + return 0; + if (ownership_differs(file, sxp)) + return 0; +#ifdef SUPPORT_ACLS + if (acls_differ(fname, file, sxp)) + return 0; +#endif +#ifdef SUPPORT_XATTRS + if (xattrs_differ(fname, file, sxp)) + return 0; +#endif + } return 1; } @@ -631,12 +668,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre { if (statret >= 0) { /* A from-dest-dir statret can == 1! */ int keep_time = !preserve_times ? 0 - : S_ISDIR(file->mode) ? preserve_times > 1 : -#if defined HAVE_LUTIMES && defined HAVE_UTIMES - 1; -#else - !S_ISLNK(file->mode); -#endif + : S_ISDIR(file->mode) ? preserve_times & PRESERVE_DIR_TIMES + : S_ISLNK(file->mode) ? preserve_times & PRESERVE_LINK_TIMES + : 1; if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size) iflags |= ITEM_REPORT_SIZE; @@ -668,7 +702,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre if (preserve_acls && !S_ISLNK(file->mode)) { if (!ACL_READY(*sxp)) get_acl(fnamecmp, sxp); - if (set_acl(NULL, file, sxp) == 0) + if (set_acl(NULL, file, sxp, file->mode)) iflags |= ITEM_REPORT_ACL; } #endif @@ -761,6 +795,12 @@ static void sum_sizes_sqroot(struct sum_struct *sum, int64 len) int s2length; int64 l; + if (len < 0) { + /* The file length overflowed our int64 var, so we can't process this file. */ + sum->count = -1; /* indicate overflow error */ + return; + } + if (block_size) blength = block_size; else if (len <= BLOCK_SIZE * BLOCK_SIZE) @@ -1300,6 +1340,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, skip_dir = NULL; } +#ifdef SUPPORT_ACLS + sx.acc_acl = sx.def_acl = NULL; +#endif +#ifdef SUPPORT_XATTRS + sx.xattr = NULL; +#endif if (daemon_filter_list.head && (*fname != '.' || fname[1])) { if (check_filter(&daemon_filter_list, FLOG, fname, is_dir) < 0) { if (is_dir < 0) @@ -1317,12 +1363,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } } -#ifdef SUPPORT_ACLS - sx.acc_acl = sx.def_acl = NULL; -#endif -#ifdef SUPPORT_XATTRS - sx.xattr = NULL; -#endif if (dry_run > 1 || (dry_missing_dir && is_below(file, dry_missing_dir))) { parent_is_dry_missing: if (fuzzy_dirlist) { @@ -1361,7 +1401,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (need_fuzzy_dirlist && S_ISREG(file->mode)) { strlcpy(fnamecmpbuf, dn, sizeof fnamecmpbuf); - fuzzy_dirlist = get_dirlist(fnamecmpbuf, -1, 1); + fuzzy_dirlist = get_dirlist(fnamecmpbuf, -1, GDL_IGNORE_FILTER_RULES); need_fuzzy_dirlist = 0; } @@ -1402,9 +1442,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } + fnamecmp = fname; + if (is_dir) { + mode_t added_perms; if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR) goto cleanup; + if (am_root < 0) { + /* For --fake-super, the dir must be useable by the copying + * user, just like it would be for root. */ + added_perms = S_IRUSR|S_IWUSR|S_IXUSR; + } else + added_perms = 0; if (is_dir < 0) { /* In inc_recurse mode we want to make sure any missing * directories get created while we're still processing @@ -1415,7 +1464,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, && (S_ISDIR(sx.st.st_mode) || delete_item(fname, sx.st.st_mode, del_opts | DEL_FOR_DIR) != 0)) goto cleanup; /* Any errors get reported later. */ - if (do_mkdir(fname, file->mode & 0700) == 0) + if (do_mkdir(fname, (file->mode|added_perms) & 0700) == 0) file->flags |= FLAG_DIR_CREATED; goto cleanup; } @@ -1449,17 +1498,19 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, itemizing = 0; code = FNONE; statret = 1; - } else if (j >= 0) + } else if (j >= 0) { statret = 1; + fnamecmp = fnamecmpbuf; + } } if (itemizing && f_out != -1) { - itemize(fname, file, ndx, statret, &sx, + itemize(fnamecmp, file, ndx, statret, &sx, statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL); } - if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) { + if (real_ret != 0 && do_mkdir(fname,file->mode|added_perms) < 0 && errno != EEXIST) { if (!relative_paths || errno != ENOENT - || create_directory_path(fname) < 0 - || (do_mkdir(fname, file->mode) < 0 && errno != EEXIST)) { + || create_directory_path(fname) < 0 + || (do_mkdir(fname, file->mode|added_perms) < 0 && errno != EEXIST)) { rsyserr(FERROR_XFER, errno, "recv_generator: mkdir %s failed", full_fname(fname)); @@ -1471,13 +1522,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } } -#ifdef SUPPORT_XATTRS - if (preserve_xattrs && statret == 1) - copy_xattrs(fnamecmpbuf, fname); -#endif - if (set_file_attrs(fname, file, real_ret ? NULL : &real_sx, NULL, 0) - && verbose && code != FNONE && f_out != -1) - rprintf(code, "%s/\n", fname); /* We need to ensure that the dirs in the transfer have writable * permissions during the time we are putting files within them. @@ -1494,6 +1538,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } #endif +#ifdef SUPPORT_XATTRS + if (preserve_xattrs && statret == 1) + copy_xattrs(fnamecmpbuf, fname); +#endif + if (set_file_attrs(fname, file, real_ret ? NULL : &real_sx, NULL, 0) + && verbose && code != FNONE && f_out != -1) + rprintf(code, "%s/\n", fname); + if (real_ret != 0 && one_file_system) real_sx.st.st_dev = filesystem_dev; if (inc_recurse) { @@ -1532,11 +1584,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, const char *sl = F_SYMLINK(file); if (safe_symlinks && unsafe_symlink(sl, fname)) { if (verbose) { - if (solo_file) + if (solo_file) { + /* fname contains the destination path, but we + * want to report the source path. */ fname = f_name(file, NULL); + } rprintf(FINFO, - "ignoring unsafe symlink %s -> \"%s\"\n", - full_fname(fname), sl); + "ignoring unsafe symlink \"%s\" -> \"%s\"\n", + fname, sl); } return; } @@ -1730,7 +1785,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } - fnamecmp = fname; fnamecmp_type = FNAMECMP_FNAME; if (statret == 0 && !S_ISREG(sx.st.st_mode)) { @@ -2184,7 +2238,7 @@ void generate_files(int f_out, const char *local_name) } solo_file = local_name; dir_tweaking = !(list_only || solo_file || dry_run); - need_retouch_dir_times = preserve_times > 1; + need_retouch_dir_times = preserve_times & PRESERVE_DIR_TIMES; loopchk_limit = allowed_lull ? allowed_lull * 5 : 200; symlink_timeset_failed_flags = ITEM_REPORT_TIME | (protocol_version >= 30 || !am_server ? ITEM_REPORT_TIMEFAIL : 0); diff --git a/hashtable.c b/hashtable.c index ed29ee9..0524e24 100644 --- a/hashtable.c +++ b/hashtable.c @@ -41,7 +41,7 @@ struct hashtable *hashtable_create(int size, int key64) tbl->size = size; tbl->entries = 0; tbl->node_size = node_size; - tbl->key64 = key64; + tbl->key64 = key64 ? 1 : 0; return tbl; } @@ -60,6 +60,11 @@ void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing) struct ht_int32_node *node; uint32 ndx; + if (key64 ? key == 0 : (int32)key == 0) { + rprintf(FERROR, "Internal hashtable error: illegal key supplied!\n"); + exit_cleanup(RERR_MESSAGEIO); + } + if (allocate_if_missing && tbl->entries > HASH_LOAD_LIMIT(tbl->size)) { void *old_nodes = tbl->nodes; int size = tbl->size * 2; @@ -142,7 +147,7 @@ void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing) if (key64) ((struct ht_int64_node*)node)->key = key; else - node->key = key; + node->key = (int32)key; tbl->entries++; return node; } diff --git a/hlink.c b/hlink.c index 5ab9bb8..fb090a9 100644 --- a/hlink.c +++ b/hlink.c @@ -37,7 +37,7 @@ extern int remove_source_files; extern int stdout_format_has_i; extern int maybe_ATTRS_REPORT; extern int unsort_ndx; -extern char *basis_dir[]; +extern char *basis_dir[MAX_BASIS_DIRS+1]; extern struct file_list *cur_flist; #ifdef SUPPORT_HARD_LINKS @@ -57,7 +57,7 @@ static struct file_list *hlink_flist; void init_hard_links(void) { if (am_sender || protocol_version < 30) - dev_tbl = hashtable_create(16, SIZEOF_INT64 == 8); + dev_tbl = hashtable_create(16, 1); else if (inc_recurse) prior_hlinks = hashtable_create(1024, 0); } @@ -67,11 +67,12 @@ struct ht_int64_node *idev_find(int64 dev, int64 ino) static struct ht_int64_node *dev_node = NULL; struct hashtable *tbl; - if (!dev_node || dev_node->key != dev) { + /* Note that some OSes have a dev == 0, so increment to avoid storing a 0. */ + if (!dev_node || dev_node->key != dev+1) { /* We keep a separate hash table of inodes for every device. */ - dev_node = hashtable_find(dev_tbl, dev, 1); + dev_node = hashtable_find(dev_tbl, dev+1, 1); if (!(tbl = dev_node->data)) - tbl = dev_node->data = hashtable_create(512, SIZEOF_INT64 == 8); + tbl = dev_node->data = hashtable_create(512, 1); } else tbl = dev_node->data; @@ -533,8 +534,19 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx, if (inc_recurse) { int gnum = F_HL_GNUM(file); struct ht_int32_node *node = hashtable_find(prior_hlinks, gnum, 0); - assert(node != NULL && node->data != NULL); - assert(CVAL(node->data, 0) == 0); + if (node == NULL) { + rprintf(FERROR, "Unable to find a hlink node for %d (%s)\n", gnum, f_name(file, prev_name)); + exit_cleanup(RERR_MESSAGEIO); + } + if (node->data == NULL) { + rprintf(FERROR, "Hlink node data for %d is NULL (%s)\n", gnum, f_name(file, prev_name)); + exit_cleanup(RERR_MESSAGEIO); + } + if (CVAL(node->data, 0) != 0) { + rprintf(FERROR, "Hlink node data for %d already has path=%s (%s)\n", + gnum, (char*)node->data, f_name(file, prev_name)); + exit_cleanup(RERR_MESSAGEIO); + } free(node->data); if (!(node->data = strdup(our_name))) out_of_memory("finish_hard_link"); diff --git a/io.c b/io.c index f9fa7c7..0041000 100644 --- a/io.c +++ b/io.c @@ -36,7 +36,6 @@ extern int bwlimit; extern size_t bwlimit_writemax; extern int io_timeout; -extern int allowed_lull; extern int am_server; extern int am_daemon; extern int am_sender; @@ -47,7 +46,7 @@ extern int eol_nulls; extern int flist_eof; extern int list_only; extern int read_batch; -extern int csum_length; +extern int compat_flags; extern int protect_args; extern int checksum_seed; extern int protocol_version; @@ -60,7 +59,8 @@ extern int filesfrom_convert; extern iconv_t ic_send, ic_recv; #endif -const char phase_unknown[] = "unknown"; +int csum_length = SHORT_SUM_LENGTH; /* initial value */ +int allowed_lull = 0; int ignore_timeout = 0; int batch_fd = -1; int msgdone_cnt = 0; @@ -1901,7 +1901,7 @@ void start_write_batch(int fd) * is involved. */ write_int(batch_fd, protocol_version); if (protocol_version >= 30) - write_byte(batch_fd, inc_recurse); + write_byte(batch_fd, compat_flags); write_int(batch_fd, checksum_seed); if (am_sender) diff --git a/lib/sysacls.c b/lib/sysacls.c index 19d4d7a..52314bc 100644 --- a/lib/sysacls.c +++ b/lib/sysacls.c @@ -2781,6 +2781,11 @@ int no_acl_syscall_error(int err) return 1; } #endif + if (err == EINVAL) { + /* If the type of SMB_ACL_TYPE_ACCESS or SMB_ACL_TYPE_DEFAULT + * isn't valid, then the ACLs must be non-POSIX. */ + return 1; + } return 0; } diff --git a/log.c b/log.c index 05de68a..46161fe 100644 --- a/log.c +++ b/log.c @@ -35,8 +35,6 @@ extern int msg_fd_out; extern int allow_8bit_chars; extern int protocol_version; extern int preserve_times; -extern int uid_ndx; -extern int gid_ndx; extern int progress_is_active; extern int stdout_format_has_i; extern int stdout_format_has_o_or_i; @@ -52,9 +50,9 @@ extern char *logfile_name; extern iconv_t ic_chck; #endif #ifdef ICONV_OPTION -extern iconv_t ic_send, ic_recv; +extern iconv_t ic_recv; #endif -extern char curr_dir[]; +extern char curr_dir[MAXPATHLEN]; extern char *full_module_path; extern unsigned int module_dirlen; diff --git a/main.c b/main.c index f0ad96a..b6cc6bd 100644 --- a/main.c +++ b/main.c @@ -64,13 +64,14 @@ extern int write_batch; extern int batch_fd; extern int filesfrom_fd; extern int connect_timeout; +extern dev_t filesystem_dev; extern pid_t cleanup_child_pid; extern unsigned int module_dirlen; extern struct stats stats; extern char *filesfrom_host; extern char *partial_dir; extern char *dest_option; -extern char *basis_dir[]; +extern char *basis_dir[MAX_BASIS_DIRS+1]; extern char *rsync_path; extern char *shell_cmd; extern char *batch_name; @@ -428,7 +429,11 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in rprintf(FERROR, "internal: args[] overflowed in do_cmd()\n"); exit_cleanup(RERR_SYNTAX); } - args[argc++] = *remote_argv++; + if (**remote_argv == '-') { + if (asprintf(args + argc++, "./%s", *remote_argv++) < 0) + out_of_memory("do_cmd"); + } else + args[argc++] = *remote_argv++; remote_argc--; } } @@ -508,6 +513,10 @@ static char *get_local_name(struct file_list *flist, char *dest_path) if (!dest_path || list_only) return NULL; + /* Treat an empty string as a copy into the current directory. */ + if (!*dest_path) + dest_path = "."; + if (daemon_filter_list.head) { char *slash = strrchr(dest_path, '/'); if (slash && (slash[1] == '\0' || (slash[1] == '.' && slash[2] == '\0'))) @@ -534,6 +543,7 @@ static char *get_local_name(struct file_list *flist, char *dest_path) full_fname(dest_path)); exit_cleanup(RERR_FILESELECT); } + filesystem_dev = st.st_dev; /* ensures --force works right w/-x */ return NULL; } if (file_total > 1) { diff --git a/match.c b/match.c index 45c512c..658d786 100644 --- a/match.c +++ b/match.c @@ -90,8 +90,7 @@ static void build_hash_table(struct sum_struct *s) static OFF_T last_match; -/** - * Transmit a literal and/or match token. +/* Transmit a literal and/or match token. * * This delightfully-named function is called either when we find a * match and need to transmit all the unmatched data leading up to it, @@ -99,9 +98,9 @@ static OFF_T last_match; * transmit it. As a result of this second case, it is called even if * we have not matched at all! * - * @param i If >0, the number of a matched token. If 0, indicates we - * have only literal data. - **/ + * If i >= 0, the number of a matched token. If < 0, indicates we have + * only literal data. A -1 will send a 0-token-int too, and a -2 sends + * only literal data, w/o any token-int. */ static void matched(int f, struct sum_struct *s, struct map_struct *buf, OFF_T offset, int32 i) { @@ -141,8 +140,8 @@ static void matched(int f, struct sum_struct *s, struct map_struct *buf, static void hash_search(int f,struct sum_struct *s, struct map_struct *buf, OFF_T len) { - OFF_T offset, end; - int32 k, want_i, backup; + OFF_T offset, aligned_offset, end; + int32 k, want_i, aligned_i, backup; char sum2[SUM_LENGTH]; uint32 s1, s2, sum; int more; @@ -167,7 +166,7 @@ static void hash_search(int f,struct sum_struct *s, if (verbose > 3) rprintf(FINFO, "sum=%.8x k=%ld\n", sum, (long)k); - offset = 0; + offset = aligned_offset = aligned_i = 0; end = len + 1 - s->sums[s->count-1].len; @@ -232,27 +231,28 @@ static void hash_search(int f,struct sum_struct *s, /* When updating in-place, the best possible match is * one with an identical offset, so we prefer that over - * the following want_i optimization. */ + * the adjacent want_i optimization. */ if (updating_basis_file) { - int32 i2; - for (i2 = i; i2 >= 0; i2 = s->sums[i2].chain) { - if (s->sums[i2].offset != offset) - continue; - if (i2 != i) { - if (sum != s->sums[i2].sum1) - break; - if (memcmp(sum2, s->sums[i2].sum2, - s->s2length) != 0) - break; - i = i2; + /* All the generator's chunks start at blength boundaries. */ + while (aligned_offset < offset) { + aligned_offset += s->blength; + aligned_i++; + } + if (offset == aligned_offset) { + if (i != aligned_i) { + if (sum != s->sums[aligned_i].sum1 + || l != s->sums[aligned_i].len + || memcmp(sum2, s->sums[aligned_i].sum2, s->s2length) != 0) + goto check_want_i; + i = aligned_i; } - /* This chunk was at the same offset on - * both the sender and the receiver. */ + /* This identical chunk is in the same spot in the old and new file. */ s->sums[i].flags |= SUMFLG_SAME_OFFSET; - goto set_want_i; + want_i = i; } } + check_want_i: /* we've found a match, but now check to see * if want_i can hint at a better match. */ if (i != want_i && want_i < s->count @@ -264,7 +264,6 @@ static void hash_search(int f,struct sum_struct *s, * will be happy */ i = want_i; } - set_want_i: want_i = i + 1; matched(f,s,buf,offset,i); diff --git a/options.c b/options.c index 2daaa67..b010067 100644 --- a/options.c +++ b/options.c @@ -3,7 +3,7 @@ * * Copyright (C) 1998-2001 Andrew Tridgell * Copyright (C) 2000, 2001, 2002 Martin Pool - * Copyright (C) 2002-2009 Wayne Davison + * Copyright (C) 2002-2011 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 @@ -85,7 +85,6 @@ int numeric_ids = 0; int allow_8bit_chars = 0; int force_delete = 0; int io_timeout = 0; -int allowed_lull = 0; int prune_empty_dirs = 0; int use_qsort = 0; char *files_from = NULL; @@ -254,13 +253,13 @@ static void print_rsync_version(enum logcode f) #ifdef ICONV_OPTION iconv = ""; #endif -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES symtimes = ""; #endif rprintf(f, "%s version %s protocol version %d%s\n", RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol); - rprintf(f, "Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.\n"); + rprintf(f, "Copyright (C) 1996-2011 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", @@ -487,7 +486,7 @@ static struct poptOption long_options[] = { {"xattrs", 'X', POPT_ARG_NONE, 0, 'X', 0, 0 }, {"no-xattrs", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, {"no-X", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, - {"times", 't', POPT_ARG_VAL, &preserve_times, 2, 0, 0 }, + {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 1, 0, 0 }, @@ -531,8 +530,8 @@ static struct poptOption long_options[] = { {"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 }, {"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 }, {"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 }, - {"no-one-file-system",'x',POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, - {"no-x", 'x', POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, + {"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, + {"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 }, {"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 }, {"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 }, {"ignore-non-existing",0,POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 }, @@ -1065,7 +1064,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) preserve_links = 1; #endif preserve_perms = 1; - preserve_times = 2; + preserve_times = 1; preserve_gid = 1; preserve_uid = 1; preserve_devices = 1; @@ -1492,17 +1491,18 @@ int parse_arguments(int *argc_p, const char ***argv_p) return 0; } if (backup_dir) { - backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf); - backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len; - if (backup_dir_remainder < 32) { + size_t len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf); + if (len > sizeof backup_dir_buf - 128) { snprintf(err_buf, sizeof err_buf, "the --backup-dir path is WAY too long.\n"); return 0; } + backup_dir_len = (int)len; if (backup_dir_buf[backup_dir_len - 1] != '/') { backup_dir_buf[backup_dir_len++] = '/'; backup_dir_buf[backup_dir_len] = '\0'; } + backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len; if (verbose > 1 && !am_sender) rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf); } else if (!backup_suffix_len && (!am_server || !am_sender)) { @@ -1515,13 +1515,18 @@ int parse_arguments(int *argc_p, const char ***argv_p) parse_rule(&filter_list, backup_dir_buf, 0, 0); } + if (preserve_times) { + preserve_times = PRESERVE_FILE_TIMES; + if (!omit_dir_times) + preserve_times |= PRESERVE_DIR_TIMES; +#ifdef CAN_SET_SYMLINK_TIMES + preserve_times |= PRESERVE_LINK_TIMES; +#endif + } + if (make_backups && !backup_dir) { omit_dir_times = 0; /* Implied, so avoid -O to sender. */ - if (preserve_times > 1) - preserve_times = 1; - } else if (omit_dir_times) { - if (preserve_times > 1) - preserve_times = 1; + preserve_times &= ~PRESERVE_DIR_TIMES; } if (stdout_format) { @@ -1831,7 +1836,7 @@ void server_options(char **args, int *argc_p) argstr[x++] = '.'; if (allow_inc_recurse) argstr[x++] = 'i'; -#if defined HAVE_LUTIMES && defined HAVE_UTIMES +#ifdef CAN_SET_SYMLINK_TIMES argstr[x++] = 'L'; #endif #ifdef ICONV_OPTION diff --git a/packaging/cull_options b/packaging/cull_options index 3ef470d..add2b98 100755 --- a/packaging/cull_options +++ b/packaging/cull_options @@ -7,7 +7,7 @@ use strict; our %short_no_arg; our %short_with_num; our %long_opt = ( - 'no-i-r' => 0, + 'daemon' => -1, 'fake-super' => 0, 'log-file' => 3, ); @@ -24,7 +24,7 @@ while () { undef $last_long_opt; } elsif (/\Qargs[ac++]\E = "--([^"=]+)"/) { $last_long_opt = $1; - $long_opt{$1} = 0; + $long_opt{$1} = 0 unless exists $long_opt{$1}; } elsif (defined($last_long_opt) && /\Qargs[ac++]\E = ([^["\s]+);/ && $1 ne 'dest_option') { $long_opt{$last_long_opt} = 2; diff --git a/packaging/extern-squish b/packaging/extern-squish deleted file mode 100755 index eb8b32e..0000000 --- a/packaging/extern-squish +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl -# This script finds extraneous "extern" variables in the *.c files. -# Run it from inside the main rsync directory. - -use strict; - -my @files = glob('*.c'); - -foreach my $fn (@files) { - open(IN, '<', $fn) or die; - undef $/; $_ = ; $/ = "\n"; - close IN; - my @externs = /^extern .*?([^[\s(*;&.]+)(?:\[.*?\])?;/mg; - foreach my $find (@externs) { - my @matches = /(?; + exit 1 unless /^y/i; + $_[0] = $master_branch = $cur_branch; # Updates caller's $master_branch too. + } + + if ($check_patches_dir && -d 'patches/.git') { + ($cur_branch) = check_git_status($fatal_unless_clean, 'patches'); + if ($cur_branch ne $master_branch) { + print "The *patches* checkout is on branch $cur_branch, not branch $master_branch.\n"; + print "Do you want to change it to branch $master_branch? [n] "; + $_ = ; + exit 1 unless /^y/i; + system "cd patches && git checkout '$master_branch'"; + } + } +} + +sub check_git_status +{ + 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/; + if ($fatal_unless_clean && !$is_clean) { + if ($subdir eq '.') { + $subdir = ''; + } else { + $subdir = " *$subdir*"; + } + die "The$subdir checkout is not clean:\n", $status; + } + ($cur_branch, $is_clean, $status); +} + +1; diff --git a/packaging/lsb/rsync.spec b/packaging/lsb/rsync.spec index 57bc7c0..35febab 100644 --- a/packaging/lsb/rsync.spec +++ b/packaging/lsb/rsync.spec @@ -1,6 +1,6 @@ Summary: A fast, versatile, remote (and local) file-copying tool Name: rsync -Version: 3.0.7 +Version: 3.0.8 %define fullversion %{version} Release: 1 %define srcdir src @@ -66,8 +66,8 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man5/rsyncd.conf.5* %changelog -* Thu Dec 31 2009 Wayne Davison -Released 3.0.7. +* Sat Mar 26 2011 Wayne Davison +Released 3.0.8. * Fri Mar 21 2008 Wayne Davison Added installation of /etc/xinetd.d/rsync file and some commented-out diff --git a/packaging/nightly-rsync b/packaging/nightly-rsync index af9f53a..3aaabcb 100755 --- a/packaging/nightly-rsync +++ b/packaging/nightly-rsync @@ -3,8 +3,8 @@ use strict; # This script expects the directory ~/samba-rsync-ftp to exist and to be a # copy of the /home/ftp/pub/rsync dir on samba.org. It also requires a -# pristine CVS checkout of rsync (don't use your normal rsync build dir -# unless you're 100% sure that there are not unchecked-in changes). +# git checkout of rsync (feel free to use your normal rsync build dir as +# long as it doesn't have any uncommitted changes). # # If this is run with -ctu, it will make an updated "nightly" tar file in # the nightly dir. It will also remove any old tar files, regenerate the @@ -56,6 +56,58 @@ if ($make_tar) { } close IN; + my $confversion; + open(IN, '<', 'configure.ac') or die "Unable to open configure.ac: $!\n"; + while () { + if (/^RSYNC_VERSION=(.*)/) { + $confversion = $1; + last; + } + } + close IN; + die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion; + + open(IN, '<', 'OLDNEWS') or die "Unable to open OLDNEWS: $!\n"; + $_ = ; + my($lastversion) = /(\d+\.\d+\.\d+)/; + my $last_protocol_version; + while () { + if (my($ver,$pdate,$pver) = /^\s+\S\S\s\S\S\S\s\d\d\d\d\s+(\d+\.\d+\.\d+)\s+(\d\d \w\w\w \d\d\d\d\s+)?(\d+)$/) { + $last_protocol_version = $pver if $ver eq $lastversion; + } + } + close IN; + die "Unable to determine protocol_version for $lastversion.\n" unless defined $last_protocol_version; + + my($protocol_version,$subprotocol_version); + open(IN, '<', 'rsync.h') or die "Unable to open rsync.h: $!\n"; + while () { + if (/^#define\s+PROTOCOL_VERSION\s+(\d+)/) { + $protocol_version = $1; + } elsif (/^#define\s+SUBPROTOCOL_VERSION\s+(\d+)/) { + $subprotocol_version = $1; + } + } + close IN; + die "Unable to determine the current PROTOCOL_VERSION.\n" unless defined $protocol_version; + die "Unable to determine the current SUBPROTOCOL_VERSION.\n" unless defined $subprotocol_version; + + if ($confversion =~ /dev|pre/) { + if ($last_protocol_version ne $protocol_version) { + if ($subprotocol_version == 0) { + die "SUBPROTOCOL_VERSION must not be 0 for a non-final release with a changed PROTOCOL_VERSION.\n"; + } + } else { + if ($subprotocol_version != 0) { + die "SUBPROTOCOL_VERSION must be 0 when the PROTOCOL_VERSION hasn't changed from the last release.\n"; + } + } + } else { + if ($subprotocol_version != 0) { + die "SUBPROTOCOL_VERSION must be 0 for a final release.\n"; + } + } + print "Creating $name.tar.gz\n"; system "rsync -a @extra_files $name/"; system "git archive --format=tar --prefix=$name/ HEAD | tar xf -"; diff --git a/packaging/patch-update b/packaging/patch-update index 15d1b6c..dba8e47 100755 --- a/packaging/patch-update +++ b/packaging/patch-update @@ -1,11 +1,12 @@ -#!/usr/bin/perl -w -# This script is used to turn one or more of the "patch/*" branches +#!/usr/bin/perl +# This script is used to turn one or more of the "patch/BASE/*" branches # into one or more diffs in the "patches" directory. Pass the option # --gen if you want generated files in the diffs. Pass the name of # one or more diffs if you want to just update a subset of all the # diffs. use strict; +use warnings; use Getopt::Long; my $patches_dir = 'patches'; @@ -30,10 +31,19 @@ if (defined $incl_generated_files) { die "No '$patches_dir' directory was found.\n" unless -d $patches_dir; die "No '.git' directory present in the current dir.\n" unless -d '.git'; -my($status, $is_clean, $starting_branch) = &check_git_status; -if (!$skip_branch_check && !$is_clean) { - die "The checkout is not clean:\n", $status; +require 'packaging/git-status.pl'; +check_git_state($master_branch, !$skip_branch_check, 1); + +my $master_commit; +open PIPE, '-|', "git log -1 --no-color $master_branch" or die $!; +while () { + if (/^commit (\S+)/) { + $master_commit = $1; + last; + } } +close PIPE; +die "Unable to determine commit hash for master branch: $master_branch\n" unless defined $master_commit; my @extra_files; open(IN, '<', 'Makefile.in') or die "Couldn't open Makefile.in: $!\n"; @@ -60,7 +70,7 @@ my %patches; # Start by finding all patches so that we can load all possible parents. open(PIPE, '-|', 'git', 'branch', '-l') or die $!; while () { - if (m# patch/(.*)#) { + if (m# patch/\Q$master_branch\E/(.*)#o) { $patches{$1} = 1; } } @@ -70,7 +80,7 @@ my @patches = sort keys %patches; my(%parent, %description); foreach my $patch (@patches) { - my $branch = "patch/$patch"; + my $branch = "patch/$master_branch/$patch"; my $desc = ''; open(PIPE, '-|', 'git', 'diff', '-U1000', "$master_branch...$branch", '--', "PATCH.$patch") or die $!; while () { @@ -114,7 +124,7 @@ if ($incl_generated_files) { } sleep 1 while $last_touch >= time; -system "git checkout $starting_branch" and exit 1; +system "git checkout $master_branch" and exit 1; exit; @@ -124,24 +134,27 @@ sub update_patch my($patch) = @_; my $parent = $parent{$patch}; + my $based_on; if (defined $parent) { unless ($completed{$parent}++) { update_patch($parent); } - $parent = "patch/$parent"; + $based_on = $parent = "patch/$master_branch/$parent"; } else { $parent = $master_branch; + $based_on = $master_commit; } print "======== $patch ========\n"; sleep 1 while $incl_generated_files && $last_touch >= time; - system "git checkout patch/$patch" and return 0; + system "git checkout patch/$master_branch/$patch" and return 0; - my $ok = system("git merge $parent") == 0; + my $ok = system("git merge $based_on") == 0; if (!$ok || $launch_shell) { - print qq|"git merge $parent" incomplete -- please fix.\n| if !$ok; - $ENV{PS1} = "[$parent] patch/$patch: "; + my($parent_dir) = $parent =~ m{([^/]+)$}; + print qq|"git merge $based_on" incomplete -- please fix.\n| if !$ok; + $ENV{PS1} = "[$parent_dir] $patch: "; while (1) { if (system($ENV{SHELL}) != 0) { print "Abort? [n/y] "; @@ -149,21 +162,21 @@ sub update_patch next unless /^y/i; return 0; } - ($status, $is_clean) = &check_git_status; + my($cur_branch, $is_clean, $status) = check_git_status(0); last if $is_clean; print $status; } } open(OUT, '>', "$patches_dir/$patch.diff") or die $!; - print OUT $description{$patch}, "\n"; + print OUT $description{$patch}, "\nbased-on: $based_on\n"; if ($incl_generated_files) { system "$make_gen_cmd && rsync -a @extra_files $tmp_dir/$patch/" and exit 1; } $last_touch = time; - open(PIPE, '-|', 'git', 'diff', $parent) or die $!; + open(PIPE, '-|', 'git', 'diff', $based_on) or die $!; DIFF: while () { while (m{^diff --git a/PATCH}) { while () { @@ -200,22 +213,18 @@ sub update_patch exit; -sub check_git_status -{ - open(IN, '-|', 'git status') or die $!; - my $status = join('', ); - close IN; - my $is_clean = $status =~ /\nnothing to commit \(working directory clean\)/; - my($starting_branch) = $status =~ /^# On branch (.+)\n/; - ($status, $is_clean, $starting_branch); -} - sub usage { die <); -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 branch.\n" unless $status =~ /^# On branch $master_branch\n/; +require 'packaging/git-status.pl'; +check_git_state($master_branch, 1, 1); my $confversion; -open(IN, '<', 'configure.in') or die $!; +open(IN, '<', 'configure.ac') or die $!; while () { if (/^RSYNC_VERSION=(.*)/) { $confversion = $1; @@ -75,12 +73,31 @@ while () { } } close IN; -die "Unable to find RSYNC_VERSION in configure.in\n" unless defined $confversion; +die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion; open(IN, '<', 'OLDNEWS') or die $!; $_ = ; -close IN; my($lastversion) = /(\d+\.\d+\.\d+)/; +my($last_protocol_version, %pdate); +while () { + if (my($ver,$pdate,$pver) = /^\s+\S\S\s\S\S\S\s\d\d\d\d\s+(\d+\.\d+\.\d+)\s+(\d\d \w\w\w \d\d\d\d\s+)?(\d+)$/) { + $pdate{$ver} = $pdate if defined $pdate; + $last_protocol_version = $pver if $ver eq $lastversion; + } +} +close IN; +die "Unable to determine protocol_version for $lastversion.\n" unless defined $last_protocol_version; + +my $protocol_version; +open(IN, '<', 'rsync.h') or die $!; +while () { + if (/^#define\s+PROTOCOL_VERSION\s+(\d+)/) { + $protocol_version = $1; + last; + } +} +close IN; +die "Unable to determine the current PROTOCOL_VERSION.\n" unless defined $protocol_version; my $version = $confversion; $version =~ s/dev/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e; @@ -118,6 +135,23 @@ chomp($_ = ); $release = $_ if $_ ne ''; $release .= ".$pre" if $pre; +(my $finalversion = $version) =~ s/pre\d+//; +my($proto_changed,$proto_change_date); +if ($protocol_version eq $last_protocol_version) { + $proto_changed = 'unchanged'; + $proto_change_date = "\t\t"; +} else { + $proto_changed = 'changed'; + if (!defined($proto_change_date = $pdate{$finalversion})) { + while (1) { + print "On what date did the protocol change to $protocol_version get checked in? (dd Mmm yyyy) "; + chomp($_ = ); + last if /^\d\d \w\w\w \d\d\d\d$/; + } + $proto_change_date = "$_\t"; + } +} + my($srcdir,$srcdiffdir,$lastsrcdir,$skipping); if ($lastversion =~ /pre/) { if (!$pre) { @@ -146,9 +180,9 @@ print "\n", $break, < "; $_ = ; -(my $finalversion = $version) =~ s/pre\d+//; my %specvars = ( 'Version:' => $finalversion, 'Release:' => $release, '%define fullversion' => "\%{version}$pre", 'Released' => "$version.", '%define srcdir' => $srcdir ); my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'), glob('*.yo'), - qw( configure.in rsync.h NEWS OLDNEWS options.c ) ); + qw( configure.ac rsync.h NEWS OLDNEWS options.c ) ); foreach my $fn (@tweak_files) { open(IN, '<', $fn) or die $!; @@ -184,18 +217,19 @@ foreach my $fn (@tweak_files) { s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m or die "Unable to update current version info in $fn\n"; } elsif ($fn eq 'rsync.h') { - s/(#define\s+SUBPROTOCOL_VERSION)\s+\d+/$1 0/ + s{(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)} + { $1 . ' ' . get_subprotocol_version($2) }e or die "Unable to find SUBPROTOCOL_VERSION define in $fn\n"; - next if $pre; } elsif ($fn eq 'NEWS') { - s/^(NEWS for rsync \Q$finalversion\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/mi - or die "The first line of $fn is not in the right format. It must be:\n" - . "NEWS for rsync $finalversion (UNRELEASED)\n"; - next if $pre; + s{^(NEWS for rsync \Q$finalversion\E )(\(UNRELEASED\))\s*(\nProtocol: )(\d+) (\([^)]+\))\n} + { $1 . ($pre ? $2 : "($today)") . "$3$protocol_version ($proto_changed)\n" }ei + or die "The first 2 lines of $fn are not in the right format. They must be:\n" + . "NEWS for rsync $finalversion (UNRELEASED)\n" + . "Protocol: $protocol_version ($proto_changed)\n"; } elsif ($fn eq 'OLDNEWS') { - s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$finalversion\E)/\t$ztoday$1/m + s{^(\t\S\S\s\S\S\S\s\d\d\d\d)(\t\Q$finalversion\E\t).*} + { ($pre ? $1 : "\t$ztoday") . $2 . $proto_change_date . $protocol_version }em or die "Unable to find \"?? ??? $year\t$finalversion\" line in $fn\n"; - next if $pre; } elsif ($fn eq 'options.c') { if (s/(Copyright \(C\) 2002-)(\d+)( Wayne Davison)/$1$year$3/ && $2 ne $year) { @@ -229,7 +263,7 @@ print $break, < "; $_ = ; +# We want to use our passphrase-providing "gpg" script, so modify the PATH. +$ENV{PATH} = "$curdir/packaging/bin:$path"; + my $passphrase; while (1) { ReadMode('noecho'); @@ -281,17 +322,23 @@ while (1) { umask $oldmask; $ENV{'GPG_PASSFILE'} = $passfile; - # We want to use our passphrase-providing "gpg" script, so modify the PATH. - $ENV{PATH} = "packaging/bin:$path"; $_ = `git tag -s -m 'Version $version.' v$version 2>&1`; - $ENV{PATH} = $path; - unlink($passfile); print $_; next if /bad passphrase/; - last unless /failed/; - exit 1; + exit 1 if /failed/; + + if (-d 'patches/.git') { + $_ = `cd patches && git tag -s -m 'Version $version.' v$version 2>&1`; + print $_; + exit 1 if /bad passphrase|failed/; + } + + unlink($passfile); + last; } +$ENV{PATH} = $path; + # Extract the generated files from the old tar. @_ = @extra_files; map { s#^#rsync-$lastversion/# } @_; @@ -299,7 +346,7 @@ system "tar xzf $lasttar_file @_"; rename("rsync-$lastversion", 'a'); print "Creating $diff_file ...\n"; -system "./config.status Makefile; make gen; rsync -a @extra_files b/"; +system "$make_gen_cmd && rsync -a @extra_files b/" and exit 1; my $sed_script = 's:^((---|\+\+\+) [ab]/[^\t]+)\t.*:\1:'; system "(git diff v$lastversion v$version; diff -upN a b | sed -r '$sed_script') | gzip -9 >$diff_file"; system "rm -rf a"; @@ -354,6 +401,15 @@ EOT exit; +sub get_subprotocol_version +{ + my($subver) = @_; + if ($pre && $proto_changed eq 'changed') { + return $subver == 0 ? 1 : $subver; + } + 0; +} + sub usage { die < 1 } qw( t_stub.c t_unsafe.c tls.c trimslash.c ); +my %add_compat_c = map { $_ => 1 } qw( t_stub.c tls.c trimslash.c wildtest.c ); +my %add_util_c = map { $_ => 1 } qw( t_stub.c t_unsafe.c ); +my %sizes; + +open(IN, '<', 'syscall.c') or die $!; +undef $/; my $syscall_c = ; $/ = "\n"; +close IN; +$syscall_c =~ s/^extern\s.*//mg; + +open(IN, '<', 'lib/compat.c') or die $!; +undef $/; my $compat_c = ; $/ = "\n"; +close IN; +$compat_c =~ s/^extern\s.*//mg; + +open(IN, '<', 'util.c') or die $!; +undef $/; my $util_c = ; $/ = "\n"; +close IN; +$util_c =~ s/^extern\s.*//mg; + +my @files = glob('*.c'); + +foreach my $fn (@files) { + open(IN, '<', $fn) or die $!; + undef $/; $_ = ; $/ = "\n"; + close IN; + + my @vars = /^(?!(?:extern|enum)\s)([a-zA-Z]\S*\s+.*);/mg; + my @externs = /^extern\s+(.*);/mg; + + $_ .= $syscall_c if $add_syscall_c{$fn}; + $_ .= $compat_c if $add_compat_c{$fn}; + $_ .= $util_c if $add_util_c{$fn}; + s/INFO_GTE/info_levels/g; + s/DEBUG_GTE/debug_levels/g; + + check_vars($fn, 'var', @vars); + check_vars($fn, 'extern', @externs); +} + +exit; + +# The file's contents are in $_. +sub check_vars +{ + my $fn = shift; + my $type = shift; + + foreach my $line (@_) { + $line =~ s/\s*\{.*\}//; + $line =~ s/\s*\(.*\)//; + foreach my $item (split(/\s*,\s*/, $line)) { + $item =~ s/\s*=.*//; + my $sz = $item =~ s/(\[.*?\])// ? $1 : ''; + my($var) = $item =~ /([^*\s]+)$/; + if (!defined $var) { + print "Bogus match? ($item)\n"; + next; + } + if ($sz) { + if (defined $sizes{$var}) { + if ($sizes{$var} ne $sz) { + print $fn, ' has inconsistent size for "', $var, + "\": $sizes{$var} vs $sz\n"; + } + } else { + $sizes{$var} = $sz; + } + } + my @matches = /(?os->nextCharArg = origOptString + (*origOptString == '='); + con->os->nextCharArg = origOptString; } /*@=branchstate@*/ if (opt == NULL) return POPT_ERROR_BADOPT; /* XXX can't happen */ - if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) { - if (poptSaveInt((int *)opt->arg, opt->argInfo, 1L)) - return POPT_ERROR_BADOPERATION; - } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) { + if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE + || (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) { + if (longArg || (con->os->nextCharArg && con->os->nextCharArg[0] == '=')) + return POPT_ERROR_UNWANTEDARG; if (opt->arg) { - if (poptSaveInt((int *)opt->arg, opt->argInfo, (long)opt->val)) + long val = (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL ? opt->val : 1; + if (poptSaveInt((int *)opt->arg, opt->argInfo, val)) return POPT_ERROR_BADOPERATION; } - } else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) { + } else { con->os->nextArg = _free(con->os->nextArg); /*@-usedef@*/ /* FIX: W2DO? */ if (longArg) { @@ -881,7 +882,7 @@ int poptGetNextOpt(poptContext con) longArg = expandNextArg(con, longArg); con->os->nextArg = longArg; } else if (con->os->nextCharArg) { - longArg = expandNextArg(con, con->os->nextCharArg); + longArg = expandNextArg(con, con->os->nextCharArg + (con->os->nextCharArg[0] == '=')); con->os->nextArg = longArg; con->os->nextCharArg = NULL; } else { @@ -1202,6 +1203,8 @@ const char * poptStrerror(const int error) switch (error) { case POPT_ERROR_NOARG: return POPT_("missing argument"); + case POPT_ERROR_UNWANTEDARG: + return POPT_("option does not take an argument"); case POPT_ERROR_BADOPT: return POPT_("unknown option"); case POPT_ERROR_BADOPERATION: diff --git a/popt/popt.h b/popt/popt.h index 4f85d9e..8d85f73 100644 --- a/popt/popt.h +++ b/popt/popt.h @@ -82,6 +82,7 @@ /*@{*/ #define POPT_ERROR_NOARG -10 /*!< missing argument */ #define POPT_ERROR_BADOPT -11 /*!< unknown option */ +#define POPT_ERROR_UNWANTEDARG -12 /*!< option does not take an argument */ #define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */ #define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */ #define POPT_ERROR_ERRNO -16 /*!< errno set, use strerror(errno) */ diff --git a/prepare-source.mak b/prepare-source.mak index 277dd6f..054bab7 100644 --- a/prepare-source.mak +++ b/prepare-source.mak @@ -1,7 +1,7 @@ conf: configure.sh config.h.in -configure.sh: configure.in aclocal.m4 +configure.sh: configure.ac aclocal.m4 autoconf -o configure.sh -config.h.in: configure.in aclocal.m4 +config.h.in: configure.ac aclocal.m4 autoheader && touch config.h.in diff --git a/receiver.c b/receiver.c index 39c5e49..d90fa25 100644 --- a/receiver.c +++ b/receiver.c @@ -24,6 +24,7 @@ extern int verbose; extern int dry_run; extern int do_xfers; +extern int am_root; extern int am_server; extern int do_progress; extern int inc_recurse; @@ -53,7 +54,7 @@ extern mode_t orig_umask; extern struct stats stats; extern char *tmpdir; extern char *partial_dir; -extern char *basis_dir[]; +extern char *basis_dir[MAX_BASIS_DIRS+1]; extern struct file_list *cur_flist, *first_flist, *dir_flist; extern struct filter_list_struct daemon_filter_list; @@ -63,31 +64,29 @@ static flist_ndx_list batch_redo_list; /* We're either updating the basis file or an identical copy: */ static int updating_basis_or_equiv; -/* - * get_tmpname() - create a tmp filename for a given filename +#define TMPNAME_SUFFIX ".XXXXXX" +#define TMPNAME_SUFFIX_LEN ((int)sizeof TMPNAME_SUFFIX - 1) + +/* get_tmpname() - create a tmp filename for a given filename * - * If a tmpdir is defined, use that as the directory to - * put it in. Otherwise, the tmp filename is in the same - * directory as the given name. Note that there may be no - * directory at all in the given name! + * If a tmpdir is defined, use that as the directory to put it in. Otherwise, + * the tmp filename is in the same directory as the given name. Note that + * there may be no directory at all in the given name! * - * The tmp filename is basically the given filename with a - * dot prepended, and .XXXXXX appended (for mkstemp() to - * put its unique gunk in). Take care to not exceed - * either the MAXPATHLEN or NAME_MAX, esp. the last, as - * the basename basically becomes 8 chars longer. In that - * case, the original name is shortened sufficiently to - * make it all fit. + * The tmp filename is basically the given filename with a dot prepended, and + * .XXXXXX appended (for mkstemp() to put its unique gunk in). We take care + * to not exceed either the MAXPATHLEN or NAME_MAX, especially the last, as + * the basename basically becomes 8 characters longer. In such a case, the + * original name is shortened sufficiently to make it all fit. * - * Of course, there's no real reason for the tmp name to - * look like the original, except to satisfy us humans. - * As long as it's unique, rsync will work. - */ - + * Of course, the only reason the file is based on the original name is to + * make it easier to figure out what purpose a temp file is serving when a + * transfer is in progress. */ int get_tmpname(char *fnametmp, const char *fname) { int maxname, added, length = 0; const char *f; + char *suf; if (tmpdir) { /* Note: this can't overflow, so the return value is safe */ @@ -107,8 +106,9 @@ int get_tmpname(char *fnametmp, const char *fname) fnametmp[length++] = '.'; /* The maxname value is bufsize, and includes space for the '\0'. - * (Note that NAME_MAX get -8 for the leading '.' above.) */ - maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8); + * NAME_MAX needs an extra -1 for the name's leading dot. */ + maxname = MIN(MAXPATHLEN - length - TMPNAME_SUFFIX_LEN, + NAME_MAX - 1 - TMPNAME_SUFFIX_LEN); if (maxname < 1) { rprintf(FERROR_XFER, "temporary filename too long: %s\n", fname); @@ -119,7 +119,17 @@ int get_tmpname(char *fnametmp, const char *fname) added = strlcpy(fnametmp + length, f, maxname); if (added >= maxname) added = maxname - 1; - memcpy(fnametmp + length + added, ".XXXXXX", 8); + suf = fnametmp + length + added; + + /* Trim any dangling high-bit chars if the first-trimmed char (if any) is + * also a high-bit char, just in case we cut into a multi-byte sequence. + * We are guaranteed to stop because of the leading '.' we added. */ + if ((int)f[added] & 0x80) { + while ((int)suf[-1] & 0x80) + suf--; + } + + memcpy(suf, TMPNAME_SUFFIX, TMPNAME_SUFFIX_LEN+1); return 1; } @@ -131,15 +141,25 @@ int get_tmpname(char *fnametmp, const char *fname) int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file) { int fd; + mode_t added_perms; if (!get_tmpname(fnametmp, fname)) return -1; + if (am_root < 0) { + /* For --fake-super, the file must be useable by the copying + * user, just like it would be for root. */ + added_perms = S_IRUSR|S_IWUSR; + } else { + /* For a normal copy, we need to be able to tweak things like xattrs. */ + added_perms = S_IWUSR; + } + /* We initially set the perms without the setuid/setgid bits or group * access to ensure that there is no race condition. They will be * correctly updated after the right owner and group info is set. * (Thanks to snabb@epipe.fi for pointing this out.) */ - fd = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); + fd = do_mkstemp(fnametmp, (file->mode|added_perms) & INITACCESSPERMS); #if 0 /* In most cases parent directories will already exist because their @@ -149,7 +169,7 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file) && create_directory_path(fnametmp) == 0) { /* Get back to name with XXXXXX in it. */ get_tmpname(fnametmp, fname); - fd = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); + fd = do_mkstemp(fnametmp, (file->mode|added_perms) & INITACCESSPERMS); } #endif @@ -249,8 +269,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, if (verbose > 3) { rprintf(FINFO, - "chunk[%d] of size %ld at %.0f offset=%.0f\n", - i, (long)len, (double)offset2, (double)offset); + "chunk[%d] of size %ld at %.0f offset=%.0f%s\n", + i, (long)len, (double)offset2, (double)offset, + updating_basis_or_equiv && offset == offset2 ? " (seek)" : ""); } if (mapbuf) { @@ -285,8 +306,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, goto report_write_error; #ifdef HAVE_FTRUNCATE - if (inplace && fd != -1 - && ftruncate(fd, offset) < 0) { + if (inplace && fd != -1 && do_ftruncate(fd, offset) < 0) { rsyserr(FERROR_XFER, errno, "ftruncate failed on %s", full_fname(fname)); } @@ -295,7 +315,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, if (do_progress) end_progress(total_size); - if (fd != -1 && offset > 0 && sparse_end(fd) != 0) { + if (fd != -1 && offset > 0 && sparse_end(fd, offset) != 0) { report_write_error: rsyserr(FERROR_XFER, errno, "write failed on %s", full_fname(fname)); @@ -483,14 +503,15 @@ int recv_files(int f_in, char *local_name) rprintf(FINFO, "recv_files(%s)\n", fname); #ifdef SUPPORT_XATTRS - if (iflags & ITEM_REPORT_XATTR && do_xfers) + if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers) recv_xattr_request(file, f_in); #endif if (!(iflags & ITEM_TRANSFER)) { maybe_log_item(file, iflags, itemizing, xname); #ifdef SUPPORT_XATTRS - if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers) + if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers + && !BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE)) set_file_attrs(fname, file, NULL, fname, 0); #endif continue; diff --git a/rsync.c b/rsync.c index e14760f..143eb38 100644 --- a/rsync.c +++ b/rsync.c @@ -42,8 +42,6 @@ extern int am_generator; extern int am_starting_up; extern int allow_8bit_chars; extern int protocol_version; -extern int uid_ndx; -extern int gid_ndx; extern int inc_recurse; extern int inplace; extern int flist_eof; @@ -425,7 +423,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, set_xattr(fname, file, fnamecmp, sxp); #endif - if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && preserve_times == 1)) + if (!preserve_times + || (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode)) + || (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode))) flags |= ATTRS_SKIP_MTIME; if (!(flags & ATTRS_SKIP_MTIME) && cmp_time(sxp->st.st_mtime, file->modtime) != 0) { @@ -444,7 +444,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file); change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file); -#if !defined HAVE_LCHOWN && !defined CHOWN_MODIFIES_SYMLINK +#ifndef CAN_CHOWN_SYMLINK if (S_ISLNK(sxp->st.st_mode)) { ; } else @@ -463,9 +463,9 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, } } if (am_root >= 0) { - if (do_lchown(fname, - change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid, - change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid) != 0) { + uid_t uid = change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid; + gid_t gid = change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid; + if (do_lchown(fname, uid, gid) != 0) { /* We shouldn't have attempted to change uid * or gid unless have the privilege. */ rsyserr(FERROR_XFER, errno, "%s %s failed", @@ -473,6 +473,10 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, full_fname(fname)); goto cleanup; } + if (uid == (uid_t)-1 && sxp->st.st_uid != (uid_t)-1) + rprintf(FERROR_XFER, "uid 4294967295 (-1) is impossible to set on %s\n", full_fname(fname)); + if (gid == (gid_t)-1 && sxp->st.st_gid != (gid_t)-1) + rprintf(FERROR_XFER, "gid 4294967295 (-1) is impossible to set on %s\n", full_fname(fname)); /* A lchown had been done, so we need to re-stat if * the destination had the setuid or setgid bits set * (due to the side effect of the chown call). */ @@ -491,8 +495,10 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, * If set_acl() changes permission bits in the process of setting * an access ACL, it changes sxp->st.st_mode so we know whether we * need to chmod(). */ - if (preserve_acls && !S_ISLNK(new_mode) && set_acl(fname, file, sxp) == 0) - updated = 1; + if (preserve_acls && !S_ISLNK(new_mode)) { + if (set_acl(fname, file, sxp, new_mode) > 0) + updated = 1; + } #endif #ifdef HAVE_CHMOD diff --git a/rsync.h b/rsync.h index d804d49..f66d149 100644 --- a/rsync.h +++ b/rsync.h @@ -65,6 +65,7 @@ /* These flags are used in the live flist data. */ #define FLAG_TOP_DIR (1<<0) /* sender/receiver/generator */ +#define FLAG_OWNED_BY_US (1<<0) /* generator: set by make_file() for aux flists only */ #define FLAG_FILE_SENT (1<<1) /* sender/receiver/generator */ #define FLAG_DIR_CREATED (1<<1) /* generator */ #define FLAG_CONTENT_DIR (1<<2) /* sender/receiver/generator */ @@ -83,8 +84,12 @@ /* These flags are passed to functions but not stored. */ -#define FLAG_DIVERT_DIRS (1<<16)/* sender */ +#define FLAG_DIVERT_DIRS (1<<16) /* sender, but must be unique */ +/* These flags are for get_dirlist(). */ +#define GDL_IGNORE_FILTER_RULES (1<<0) + +/* Some helper macros for matching bits. */ #define BITS_SET(val,bits) (((val) & (bits)) == (bits)) #define BITS_SETnUNSET(val,onbits,offbits) (((val) & ((onbits)|(offbits))) == (onbits)) #define BITS_EQUAL(b1,b2,mask) (((unsigned)(b1) & (unsigned)(mask)) \ @@ -95,7 +100,7 @@ /* This is used when working on a new protocol version in CVS, and should * be a new non-zero value for each CVS change that affects the protocol. - * It must ALWAYS be 0 when the protocol goes final! */ + * It must ALWAYS be 0 when the protocol goes final (and NEVER before)! */ #define SUBPROTOCOL_VERSION 0 /* We refuse to interoperate with versions that are not in this range. @@ -335,6 +340,18 @@ enum msgcode { #include #endif +#if defined HAVE_LUTIMES || defined HAVE_UTIMENSAT +#define CAN_SET_SYMLINK_TIMES 1 +#endif + +#if defined HAVE_LCHOWN || defined CHOWN_MODIFIES_SYMLINK +#define CAN_CHOWN_SYMLINK 1 +#endif + +#if defined HAVE_LCHMOD || defined HAVE_SETATTRLIST +#define CAN_CHMOD_SYMLINK 1 +#endif + #ifdef HAVE_SYS_SELECT_H #include #endif @@ -430,6 +447,8 @@ typedef unsigned int mode_t; #endif #ifndef HAVE_OFF_T typedef long off_t; +#undef SIZEOF_OFF_T +#define SIZEOF_OFF_T SIZEOF_LONG #endif #ifndef HAVE_SIZE_T typedef unsigned int size_t; @@ -1067,6 +1086,10 @@ extern int errno; #define IS_SPECIAL(mode) (S_ISSOCK(mode) || S_ISFIFO(mode)) #define IS_DEVICE(mode) (S_ISCHR(mode) || S_ISBLK(mode)) +#define PRESERVE_FILE_TIMES (1<<0) +#define PRESERVE_DIR_TIMES (1<<1) +#define PRESERVE_LINK_TIMES (1<<2) + /* Initial mask on permissions given to temporary files. Mask off setuid bits and group access because of potential race-condition security holes, and mask other access because mode 707 is bizarre */ diff --git a/rsync.yo b/rsync.yo index 41f9043..2b32232 100644 --- a/rsync.yo +++ b/rsync.yo @@ -1,5 +1,5 @@ mailto(rsync-bugs@samba.org) -manpage(rsync)(1)(31 Dec 2009)()() +manpage(rsync)(1)(26 Mar 2011)()() manpagename(rsync)(a fast, versatile, remote (and local) file-copying tool) manpagesynopsis() @@ -688,6 +688,12 @@ specify a backup suffix using the bf(--suffix) option (otherwise the files backed up in the specified directory will keep their original filenames). +Note that if you specify a relative path, the backup directory will be +relative to the destination directory, so you probably want to specify +either an absolute path or a path that starts with "../". If an rsync +daemon is the receiver, the backup dir cannot go outside the module's path +hierarchy, so take extra care not to delete it or copy into it. + dit(bf(--suffix=SUFFIX)) This option allows you to override the default backup suffix used with the bf(--backup) (bf(-b)) option. The default suffix is a ~ if no -bf(-backup-dir) was specified, otherwise it is an empty string. @@ -713,24 +719,36 @@ its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is complete, rsync instead writes the updated data directly to the destination file. -This has several effects: (1) in-use binaries cannot be updated (either the -OS will prevent this from happening, or binaries that attempt to swap-in -their data will misbehave or crash), (2) the file's data will be in an -inconsistent state during the transfer, (3) a file's data may be left in an -inconsistent state after the transfer if the transfer is interrupted or if -an update fails, (4) a file that does not have write permissions can not be -updated, and (5) the efficiency of rsync's delta-transfer algorithm may be -reduced if some data in the destination file is overwritten before it can -be copied to a position later in the file (one exception to this is if you -combine this option with bf(--backup), since rsync is smart enough to use -the backup file as the basis file for the transfer). +This has several effects: + +quote(itemization( + it() Hard links are not broken. This means the new data will be visible + through other hard links to the destination file. Moreover, attempts to + copy differing source files onto a multiply-linked destination file will + result in a "tug of war" with the destination data changing back and forth. + it() In-use binaries cannot be updated (either the OS will prevent this from + happening, or binaries that attempt to swap-in their data will misbehave or + crash). + it() The file's data will be in an inconsistent state during the transfer + and will be left that way if the transfer is interrupted or if an update + fails. + it() A file that rsync cannot write to cannot be updated. While a super user + can update any file, a normal user needs to be granted write permission for + the open of the file for writing to be successful. + it() The efficiency of rsync's delta-transfer algorithm may be reduced if + some data in the destination file is overwritten before it can be copied to + a position later in the file. This does not apply if you use bf(--backup), + since rsync is smart enough to use the backup file as the basis file for the + transfer. +)) WARNING: you should not use this option to update files that are being accessed by others, so be careful when choosing to use this for a copy. This option is useful for transferring large files with block-based changes or appended data, and also on systems that are disk bound, not network -bound. +bound. It can also help keep a copy-on-write filesystem snapshot from +diverging the entire contents of a file that only has minor changes. The option implies bf(--partial) (since an interrupted transfer does not delete the file), but conflicts with bf(--partial-dir) and bf(--delay-updates). @@ -814,6 +832,17 @@ bf(--force) or bf(--delete) is in effect). See also bf(--keep-dirlinks) for an analogous option for the receiving side. +bf(--copy-dirlinks) applies to all symlinks to directories in the source. If +you want to follow only a few specified symlinks, a trick you can use is to +pass them as additional source args with a trailing slash, using bf(--relative) +to make the paths match up right. For example: + +quote(tt(rsync -r --relative src/./ src/./follow-me/ dest/)) + +This works because rsync calls bf(lstat)(2) on the source arg as given, and the +trailing slash makes bf(lstat)(2) follow the symlink, giving rise to a directory +in the file-list which overrides the symlink found during the scan of "src/./". + dit(bf(-K, --keep-dirlinks)) This option causes the receiving side to treat a symlink to a directory as though it were a real directory, but only if it matches a real directory from the sender. Without this option, the @@ -837,17 +866,25 @@ to modify your receiving hierarchy. See also bf(--copy-dirlinks) for an analogous option for the sending side. dit(bf(-H, --hard-links)) This tells rsync to look for hard-linked files in -the transfer and link together the corresponding files on the receiving -side. Without this option, hard-linked files in the transfer are treated +the source and link together the corresponding files on the destination. +Without this option, hard-linked files in the source are treated as though they were separate files. -When you are updating a non-empty destination, this option only ensures -that files that are hard-linked together on the source are hard-linked -together on the destination. It does NOT currently endeavor to break -already existing hard links on the destination that do not exist between -the source files. Note, however, that if one or more extra-linked files -have content changes, they will become unlinked when updated (assuming you -are not using the bf(--inplace) option). +This option does NOT necessarily ensure that the pattern of hard links on the +destination exactly matches that on the source. Cases in which the +destination may end up with extra hard links include the following: + +quote(itemization( + it() If the destination contains extraneous hard-links (more linking than + what is present in the source file list), the copying algorithm will not + break them explicitly. However, if one or more of the paths have content + differences, the normal file-update process will break those extra links + (unless you are using the bf(--inplace) option). + it() If you specify a bf(--link-dest) directory that contains hard links, + the linking of the destination files against the bf(--link-dest) files can + cause some paths in the destination to become linked together due to the + bf(--link-dest) associations. +)) Note that rsync can only detect hard links between files that are inside the transfer set. If rsync updates a file that has extra hard-link @@ -860,7 +897,10 @@ see the bf(--inplace) option for more caveats). If incremental recursion is active (see bf(--recursive)), rsync may transfer a missing hard-linked file before it finds that another link for that contents exists elsewhere in the hierarchy. This does not affect the accuracy of -the transfer, just its efficiency. One way to avoid this is to disable +the transfer (i.e. which files are hard-linked together), just its efficiency +(i.e. copying the data for a new, early copy of a hard-linked file that could +have been found later in the transfer in another member of the hard-linked +set of files). One way to avoid this inefficiency is to disable incremental recursion using the bf(--no-inc-recursive) option. dit(bf(-p, --perms)) This option causes the receiving rsync to set the @@ -938,14 +978,18 @@ The source and destination systems must have compatible ACL entries for this option to work properly. See the bf(--fake-super) option for a way to backup and restore ACLs that are not compatible. -dit(bf(-X, --xattrs)) This option causes rsync to update the remote -extended attributes to be the same as the local ones. +dit(bf(-X, --xattrs)) This option causes rsync to update the destination +extended attributes to be the same as the source ones. For systems that support extended-attribute namespaces, a copy being done by a super-user copies all namespaces except system.*. A normal user only copies the user.* namespace. To be able to backup and restore non-user namespaces as a normal user, see the bf(--fake-super) option. +Note that this option does not copy rsyncs special xattr values (e.g. those +used by bf(--fake-super)) unless you repeat the option (e.g. -XX). This +"copy all xattrs" mode cannot be used with bf(--fake-super). + dit(bf(--chmod)) This option tells rsync to apply one or more comma-separated "chmod" strings to the permission of the files in the transfer. The resulting value is treated as though it were the permissions @@ -955,7 +999,10 @@ can seem to have no effect on existing files if bf(--perms) is not enabled. In addition to the normal parsing rules specified in the bf(chmod)(1) manpage, you can specify an item that should only apply to a directory by prefixing it with a 'D', or specify an item that should only apply to a -file by prefixing it with a 'F'. For example: +file by prefixing it with a 'F'. For example, the following will ensure +that all directories get marked set-gid, that no files are other-writable, +that both are user-writable and group-writable, and that both have +consistent executability across all bits: quote(--chmod=Dg+s,ug+w,Fo-w,+X) @@ -1056,10 +1103,6 @@ dit(bf(-S, --sparse)) Try to handle sparse files efficiently so they take up less space on the destination. Conflicts with bf(--inplace) because it's not possible to overwrite data in a sparse fashion. -NOTE: Don't use this option when the destination is a Solaris "tmpfs" -filesystem. It seems to have problems seeking over null regions, -and ends up corrupting the files. - dit(bf(-n, --dry-run)) This makes rsync perform a trial run that doesn't make any changes (and produces mostly the same output as a real run). It is most commonly used in combination with the bf(-v, --verbose) and/or @@ -1322,7 +1365,7 @@ initial items are marked as perishable -- see the FILTER RULES section): quote(quote(tt(RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* -*.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/))) +*.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .hg/ .bzr/))) then, files listed in a $HOME/.cvsignore are added to the list and any files listed in the CVSIGNORE environment variable (all cvsignore names @@ -1452,6 +1495,12 @@ bf(--files-from) filenames are being sent from one host to another, the filenames will be translated from the sending host's charset to the receiving host's charset. +NOTE: sorting the list of files in the --files-from input helps rsync to be +more efficient, as it will avoid re-visiting the path elements that are shared +between adjacent entries. If the input is not sorted, some path elements +(implied directories) may end up being scanned multiple times, and rsync will +eventually unduplicate them after they get turned into file-list elements. + dit(bf(-0, --from0)) This tells rsync that the rules/filenames it reads from a file are terminated by a null ('\0') character, not a NL, CR, or CR+LF. This affects bf(--exclude-from), bf(--include-from), bf(--files-from), and any @@ -1610,7 +1659,7 @@ You may specify an empty string to indicate that no file should be skipped. Simple character-class matching is supported: each must consist of a list of letters inside the square brackets (e.g. no special classes, such as -"[:alpha:]", are supported). +"[:alpha:]", are supported, and '-' has no special meaning). The characters asterisk (*) and question-mark (?) have no special meaning. @@ -1619,10 +1668,26 @@ matches 2 suffixes): verb( --skip-compress=gz/jpg/mp[34]/7z/bz2) -The default list of suffixes that will not be compressed is this (several -of these are newly added for 3.0.0): - -verb( gz/zip/z/rpm/deb/iso/bz2/t[gb]z/7z/mp[34]/mov/avi/ogg/jpg/jpeg) +The default list of suffixes that will not be compressed is this (in this +version of rsync): + +bf(7z) +bf(avi) +bf(bz2) +bf(deb) +bf(gz) +bf(iso) +bf(jpeg) +bf(jpg) +bf(mov) +bf(mp3) +bf(mp4) +bf(ogg) +bf(rpm) +bf(tbz) +bf(tgz) +bf(z) +bf(zip) This list will be replaced by your bf(--skip-compress) list in all but one situation: a copy from a daemon rsync will add your skipped suffixes to @@ -2021,7 +2086,8 @@ transfer that may be interrupted. dit(bf(--password-file)) This option allows you to provide a password in a file for accessing an rsync daemon. The file must not be world readable. -It should contain just the password as a single line. +It should contain just the password as the first line of the file (all +other lines are ignored). This option does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell's documentation. @@ -2464,10 +2530,14 @@ itemization( also disabled). it() You may also specify any of the modifiers for the "+" or "-" rules (above) in order to have the rules that are read in from the file - default to having that modifier set. For instance, "merge,-/ .excl" would + default to having that modifier set (except for the bf(!) modifier, which + would not be useful). For instance, "merge,-/ .excl" would treat the contents of .excl as absolute-path excludes, while "dir-merge,s .filt" and ":sC" would each make all their - per-directory rules apply only on the sending side. + per-directory rules apply only on the sending side. If the merge rule + specifies sides to affect (via the bf(s) or bf(r) modifier or both), + then the rules in the file must not specify sides (via a modifier or + a rule prefix such as bf(hide)). ) Per-directory rules are inherited in all subdirectories of the directory @@ -2881,7 +2951,7 @@ dit(bf(CVSIGNORE)) The CVSIGNORE environment variable supplements any ignore patterns in .cvsignore files. See the bf(--cvs-exclude) option for more details. dit(bf(RSYNC_ICONV)) Specify a default bf(--iconv) setting using this -environment variable. +environment variable. (First supported in 3.0.0.) dit(bf(RSYNC_RSH)) The RSYNC_RSH environment variable allows you to override the default shell used as the transport for rsync. Command line options are permitted after the command name, just as in the bf(-e) option. @@ -2926,7 +2996,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/) manpagesection(VERSION) -This man page is current for version 3.0.7 of rsync. +This man page is current for version 3.0.8 of rsync. manpagesection(INTERNAL OPTIONS) diff --git a/rsync3.txt b/rsync3.txt index 42d77dc..967aa4b 100644 --- a/rsync3.txt +++ b/rsync3.txt @@ -1,6 +1,6 @@ -*- indented-text -*- -Notes towards a new version of rsync +Notes towards a new version of rsync Martin Pool , September 2001. @@ -13,7 +13,7 @@ Good things about the current implementation: - Fairly reliable. - - The choice of runnning over a plain TCP socket or tunneling over + - The choice of running over a plain TCP socket or tunneling over ssh. - rsync operations are idempotent: you can always run the same @@ -51,7 +51,7 @@ Bad things about the current implementation: hard to modify/extend - Both the program and the protocol assume a single non-interactive - one-way transfer + one-way transfer - A list of all files are held in memory for the entire transfer, which cripples scalability to large file trees @@ -88,7 +88,7 @@ Protocol philosophy: Questionable features: - These are neat, but not necessarily clean or worth preserving. + These are neat, but not necessarily clean or worth preserving. - The remote rsync can be wrapped by some other program, such as in tridge's rsync-mail scripts. The general feature of sending and @@ -100,7 +100,7 @@ Desirable features: These don't really require architectural changes; they're just something to keep in mind. - + - Synchronize ACLs and extended attributes - Anonymous servers should be efficient @@ -122,7 +122,7 @@ Desirable features: Alternatively, as long as transfers are idempotent, we can just restart the whole thing. [NFSv4] - - Scripting support. + - Scripting support. - Propagate atimes and do not modify them. This is very ugly on Unix. It might be better to try to add O_NOATIME to kernels, and @@ -224,7 +224,7 @@ Scripting hooks: - What basis file to use - Logging - + - Whether to allow transfers (for public servers) - Authentication @@ -275,7 +275,7 @@ Pie-in-the-sky features: These might have a severe impact on the protocol, and are not clearly in our core requirements. It looks like in many of them - having scripting hooks will allow us + having scripting hooks will allow us - Transport over UDP multicast. The hard part is handling multiple destinations which have different basis files. We can look at @@ -344,7 +344,7 @@ In favour of using a new protocol: - If we start from scratch, it can be documented as we go, and we can avoid design decisions that make the protocol complex or - implementation-bound. + implementation-bound. Error handling: @@ -365,7 +365,7 @@ Concurrency: - We can do nonblocking network IO, but not so for disk. - It makes sense to on the destination be generating signatures and - applying patches at the same time. + applying patches at the same time. - Can structure this with nonblocking, threads, separate processes, etc. @@ -381,7 +381,7 @@ Uses: http://www.ietf.org/proceedings/00jul/00july-133.htm#P24510_1276764 - Sync with PDA - + - Network backup systems - CVS filemover @@ -419,7 +419,7 @@ Filesystem migration: Atomic updates: The NFSv4 working group wants atomic migration. Most of the - responsibility for this lies on the NFS server or OS. + responsibility for this lies on the NFS server or OS. If migrating a whole tree, then we could do a nearly-atomic rename at the end. This ties in to having separate basis and destination @@ -427,11 +427,11 @@ Atomic updates: There's no way in Unix to replace a whole set of files atomically. However, if we get them all onto the destination machine and then do - the updates quickly it would greatly reduce the window. + the updates quickly it would greatly reduce the window. Scalability: - + We should aim to work well on machines in use in a year or two. That probably means transfers of many millions of files in one batch, and gigabytes or terabytes of data. @@ -466,4 +466,4 @@ Related work: - http://freshmeat.net/search/?site=Freshmeat&q=mirror§ion=projects - BitTorrent -- p2p mirroring - http://bitconjurer.org/BitTorrent/ \ No newline at end of file + http://bitconjurer.org/BitTorrent/ diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo index 8c9bf8e..b749e09 100644 --- a/rsyncd.conf.yo +++ b/rsyncd.conf.yo @@ -1,5 +1,5 @@ mailto(rsync-bugs@samba.org) -manpage(rsyncd.conf)(5)(31 Dec 2009)()() +manpage(rsyncd.conf)(5)(26 Mar 2011)()() manpagename(rsyncd.conf)(configuration file for rsync in daemon mode) manpagesynopsis() @@ -310,7 +310,7 @@ was run as root. This complements the "uid" parameter. The default is gid -2, which is normally the group "nobody". dit(bf(fake super)) Setting "fake super = yes" for a module causes the -daemon side to behave as if the bf(--fake-user) command-line option had +daemon side to behave as if the bf(--fake-super) command-line option had been specified. This allows the full attributes of a file to be stored without having to have the daemon actually running as root. @@ -700,7 +700,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/) manpagesection(VERSION) -This man page is current for version 3.0.7 of rsync. +This man page is current for version 3.0.8 of rsync. manpagesection(CREDITS) diff --git a/socket.c b/socket.c index 3e70af2..89a636f 100644 --- a/socket.c +++ b/socket.c @@ -39,12 +39,11 @@ extern int connect_timeout; static struct sigaction sigact; #endif -/** - * Establish a proxy connection on an open socket to a web proxy by - * using the CONNECT method. If proxy_user and proxy_pass are not NULL, - * they are used to authenticate to the proxy using the "Basic" - * proxy-authorization protocol - **/ +static int sock_exec(const char *prog); + +/* Establish a proxy connection on an open socket to a web proxy by using the + * CONNECT method. If proxy_user and proxy_pass are not NULL, they are used to + * authenticate to the proxy using the "Basic" proxy-authorization protocol. */ static int establish_proxy_connection(int fd, char *host, int port, char *proxy_user, char *proxy_pass) { @@ -125,10 +124,8 @@ static int establish_proxy_connection(int fd, char *host, int port, } -/** - * Try to set the local address for a newly-created socket. Return -1 - * if this fails. - **/ +/* Try to set the local address for a newly-created socket. + * Return -1 if this fails. */ int try_bind_local(int s, int ai_family, int ai_socktype, const char *bind_addr) { @@ -165,31 +162,27 @@ static RETSIGTYPE contimeout_handler(UNUSED(int val)) connect_timeout = -1; } -/** - * Open a socket to a tcp remote host with the specified port . +/* Open a socket to a tcp remote host with the specified port. * * Based on code from Warren. Proxy support by Stephen Rothwell. * getaddrinfo() rewrite contributed by KAME.net. * - * Now that we support IPv6 we need to look up the remote machine's - * address first, using @p af_hint to set a preference for the type - * of address. Then depending on whether it has v4 or v6 addresses we - * try to open a connection. + * Now that we support IPv6 we need to look up the remote machine's address + * first, using af_hint to set a preference for the type of address. Then + * depending on whether it has v4 or v6 addresses we try to open a connection. * - * The loop allows for machines with some addresses which may not be - * reachable, perhaps because we can't e.g. route ipv6 to that network - * but we can get ip4 packets through. + * The loop allows for machines with some addresses which may not be reachable, + * perhaps because we can't e.g. route ipv6 to that network but we can get ip4 + * packets through. * - * @param bind_addr Local address to use. Normally NULL to bind - * the wildcard address. + * bind_addr: local address to use. Normally NULL to bind the wildcard address. * - * @param af_hint Address family, e.g. AF_INET or AF_INET6. - **/ + * af_hint: address family, e.g. AF_INET or AF_INET6. */ int open_socket_out(char *host, int port, const char *bind_addr, int af_hint) { int type = SOCK_STREAM; - int error, s; + int error, s, j, addr_cnt, *errnos; struct addrinfo hints, *res0, *res; char portbuf[10]; char *h, *cp; @@ -251,12 +244,17 @@ int open_socket_out(char *host, int port, const char *bind_addr, return -1; } + for (res = res0, addr_cnt = 0; res; res = res->ai_next, addr_cnt++) {} + errnos = new_array0(int, addr_cnt); + if (!errnos) + out_of_memory("open_socket_out"); + s = -1; /* Try to connect to all addresses for this machine until we get * through. It might e.g. be multi-homed, or have both IPv4 and IPv6 * addresses. We need to create a socket for each record, since the * address record tells us what protocol to use to try to connect. */ - for (res = res0; res; res = res->ai_next) { + for (res = res0, j = 0; res; res = res->ai_next, j++) { s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s < 0) continue; @@ -287,8 +285,10 @@ int open_socket_out(char *host, int port, const char *bind_addr, if (connect_timeout > 0) alarm(0); - if (s < 0) + if (s < 0) { + errnos[j] = errno; continue; + } if (proxied && establish_proxy_connection(s, host, port, @@ -300,16 +300,26 @@ int open_socket_out(char *host, int port, const char *bind_addr, break; } freeaddrinfo(res0); + if (s < 0) { - rsyserr(FERROR, errno, "failed to connect to %s", h); - return -1; + char buf[2048]; + for (res = res0, j = 0; res; res = res->ai_next, j++) { + if (errnos[j] == 0) + continue; + if (inet_ntop(res->ai_family, res->ai_addr->sa_data + 2, buf, sizeof buf) == NULL) + strlcpy(buf, "*inet_ntop failed*", sizeof buf); + rsyserr(FERROR, errnos[j], "failed to connect to %s (%s)", h, buf); + } + s = -1; } + + free(errnos); + return s; } -/** - * Open an outgoing socket, but allow for it to be intercepted by +/* Open an outgoing socket, but allow for it to be intercepted by * $RSYNC_CONNECT_PROG, which will execute a program across a TCP * socketpair rather than really opening a socket. * @@ -318,8 +328,7 @@ int open_socket_out(char *host, int port, const char *bind_addr, * * This is based on the Samba LIBSMB_PROG feature. * - * @param bind_addr Local address to use. Normally NULL to get the stack default. - **/ + * bind_addr: local address to use. Normally NULL to get the stack default. */ int open_socket_out_wrapped(char *host, int port, const char *bind_addr, int af_hint) { @@ -372,9 +381,7 @@ int open_socket_out_wrapped(char *host, int port, const char *bind_addr, } - -/** - * Open one or more sockets for incoming data using the specified type, +/* Open one or more sockets for incoming data using the specified type, * port, and address. * * The getaddrinfo() call may return several address results, e.g. for @@ -383,9 +390,7 @@ int open_socket_out_wrapped(char *host, int port, const char *bind_addr, * We return an array of file-descriptors to the sockets, with a trailing * -1 value to indicate the end of the list. * - * @param bind_addr Local address to bind, or NULL to allow it to - * default. - **/ + * bind_addr: local address to bind, or NULL to allow it to default. */ static int *open_socket_in(int type, int port, const char *bind_addr, int af_hint) { @@ -490,9 +495,7 @@ static int *open_socket_in(int type, int port, const char *bind_addr, } -/* - * Determine if a file descriptor is in fact a socket - */ +/* Determine if a file descriptor is in fact a socket. */ int is_a_socket(int fd) { int v; @@ -660,13 +663,11 @@ struct #ifdef SO_RCVTIMEO {"SO_RCVTIMEO", SOL_SOCKET, SO_RCVTIMEO, 0, OPT_INT}, #endif - {NULL,0,0,0,0}}; - + {NULL,0,0,0,0} +}; -/** - * Set user socket options - **/ +/* Set user socket options. */ void set_socket_options(int fd, char *options) { char *tok; @@ -732,15 +733,10 @@ void set_socket_options(int fd, char *options) } -/** - * This is like socketpair but uses tcp. It is used by the Samba - * regression test code. - * - * The function guarantees that nobody else can attach to the socket, - * or if they do that this function fails and the socket gets closed - * returns 0 on success, -1 on failure the resulting file descriptors - * are symmetrical. - **/ +/* This is like socketpair but uses tcp. The function guarantees that nobody + * else can attach to the socket, or if they do that this function fails and + * the socket gets closed. Returns 0 on success, -1 on failure. The resulting + * file descriptors are symmetrical. Currently only for RSYNC_CONNECT_PROG. */ static int socketpair_tcp(int fd[2]) { int listener; @@ -761,16 +757,12 @@ static int socketpair_tcp(int fd[2]) sock2.sin_len = sizeof sock2; #endif sock2.sin_family = PF_INET; + sock2.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - bind(listener, (struct sockaddr *)&sock2, sizeof sock2); - - if (listen(listener, 1) != 0) - goto failed; - - if (getsockname(listener, (struct sockaddr *)&sock, &socklen) != 0) - goto failed; - - if ((fd[1] = socket(PF_INET, SOCK_STREAM, 0)) == -1) + if (bind(listener, (struct sockaddr *)&sock2, sizeof sock2) != 0 + || listen(listener, 1) != 0 + || getsockname(listener, (struct sockaddr *)&sock, &socklen) != 0 + || (fd[1] = socket(PF_INET, SOCK_STREAM, 0)) == -1) goto failed; set_nonblocking(fd[1]); @@ -783,7 +775,7 @@ static int socketpair_tcp(int fd[2]) } else connect_done = 1; - if ((fd[0] = accept(listener, (struct sockaddr *)&sock, &socklen)) == -1) + if ((fd[0] = accept(listener, (struct sockaddr *)&sock2, &socklen)) == -1) goto failed; close(listener); @@ -811,17 +803,13 @@ static int socketpair_tcp(int fd[2]) } - -/** - * Run a program on a local tcp socket, so that we can talk to it's - * stdin and stdout. This is used to fake a connection to a daemon - * for testing -- not for the normal case of running SSH. +/* Run a program on a local tcp socket, so that we can talk to it's stdin and + * stdout. This is used to fake a connection to a daemon for testing -- not + * for the normal case of running SSH. * - * @return a socket which is attached to a subprocess running - * "prog". stdin and stdout are attached. stderr is left attached to - * the original stderr - **/ -int sock_exec(const char *prog) + * Retruns a socket which is attached to a subprocess running "prog". stdin and + * stdout are attached. stderr is left attached to the original stderr. */ +static int sock_exec(const char *prog) { pid_t pid; int fd[2]; diff --git a/support/lsh b/support/lsh index 2017126..65488dc 100755 --- a/support/lsh +++ b/support/lsh @@ -13,7 +13,7 @@ do_cd=y # Default path is user's home dir, just like ssh. while : ; do case "$1" in -l) user="$2"; shift; shift ;; - -l*) user=`echo $1 | sed 's/^-l//'`; shift ;; + -l*) user=`echo "$1" | sed 's/^-l//'`; shift ;; --no-cd) do_cd=n; shift ;; -*) shift ;; localhost) shift; break ;; @@ -22,9 +22,9 @@ while : ; do done if [ "$user" ]; then - prefix="sudo -H -u $user" + prefix="sudo -H -u '$user'" if [ $do_cd = y ]; then - home=`perl -e "print((getpwnam("$user"))[7])"` + home=`perl -e "print((getpwnam('$user'))[7])"` # Yeah, this may fail, but attempts to get sudo to cd are harder. cd $home fi diff --git a/support/mnt-excl b/support/mnt-excl index 5514d96..e741865 100755 --- a/support/mnt-excl +++ b/support/mnt-excl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # This script takes a command-line arg of a source directory # that will be passed to rsync, and generates a set of excludes # that will exclude all mount points from the list. This is @@ -18,19 +18,24 @@ # easily adapted to read /etc/mtab or similar. # # ADDENDUM: The addition of the --filter option (which has support for -# absolute-anchored excludes) has made this script less useful than it -# was. Beginning with 2.6.4, you can achieve the effect of this script -# through this command: +# absolute-anchored excludes) can make this screen unneeded in some +# scenarios. If you don't need delete protection on the receiving side +# (or if the destination path is identical to the source path), then you +# can exclude some absolute paths from the transfer based on the mount +# dirs. For instance: # -# awk '{print $2}' /proc/mounts | rsync -f 'merge,/- -' host:/dir /dest/ +# awk '{print $2}' /proc/mounts | grep -v '^/$' | \ +# rsync -avf 'merge,/- -' /dir host:/dest/ use strict; +use warnings; use Cwd 'abs_path'; my $file = '/proc/mounts'; my $dir = shift || '/'; -$dir = abs_path($dir); -$dir =~ s#([^/]*)$##; +my $trailing_slash = $dir =~ m{./$} ? '/' : ''; +$dir = abs_path($dir) . $trailing_slash; +$dir =~ s{([^/]*)$}{}; my $trailing = $1; $trailing = '' if $trailing eq '.' || !-d "$dir$trailing"; $trailing .= '/' if $trailing ne ''; @@ -38,7 +43,7 @@ $trailing .= '/' if $trailing ne ''; open(IN, $file) or die "Unable to open $file: $!\n"; while () { $_ = (split)[1]; - next unless s#^\Q$dir$trailing\E##o && $_ ne ''; + next unless s{^\Q$dir$trailing\E}{}o && $_ ne ''; print "- /$trailing$_\n"; } close IN; diff --git a/support/rrsync b/support/rrsync index 0d138f1..216521d 100644 --- a/support/rrsync +++ b/support/rrsync @@ -92,7 +92,6 @@ our %long_opt = ( 'max-size' => 1, 'min-size' => 1, 'modify-window' => 1, - 'no-i-r' => 0, 'no-implied-dirs' => 0, 'no-r' => 0, 'no-relative' => 0, @@ -109,6 +108,7 @@ our %long_opt = ( 'size-only' => 0, 'skip-compress' => 1, 'specials' => 0, + 'stats' => 0, 'suffix' => 1, 'super' => 0, 'temp-dir' => 2, @@ -175,10 +175,10 @@ while ($command =~ /((?:[^\s\\]+|\\.[^\s\\]*)+)/g) { } else { if ($subdir ne '/') { # Validate args to ensure they don't try to leave our restricted dir. - s#//+#/#g; - s#^/##; - s#^$#.#; - die "Do not use .. in any path!\n" if m#(^|/)\\?\.\\?\.(\\?/|$)#; + s{//+}{/}g; + s{^/}{}; + s{^$}{.}; + die "$0: do not use .. in any path!\n" if m{(^|/)\\?\.\\?\.(\\?/|$)}; } push(@args, bsd_glob($_, GLOB_LIMIT|GLOB_NOCHECK|GLOB_BRACE|GLOB_QUOTE)); } @@ -205,10 +205,10 @@ sub check_arg my($opt, $arg, $type) = @_; $arg =~ s/\\(.)/$1/g; if ($subdir ne '/' && ($type == 3 || ($type == 2 && !$am_sender))) { - $arg =~ s#//#/#g; + $arg =~ s{//}{/}g; die "Do not use .. in --$opt; anchor the path at the root of your restricted dir.\n" - if $arg =~ m#(^|/)\.\.(/|$)#; - $arg =~ s#^/#$subdir/#; + if $arg =~ m{(^|/)\.\.(/|$)}; + $arg =~ s{^/}{$subdir/}; } $arg; } diff --git a/syscall.c b/syscall.c index cfabc3e..c85f73e 100644 --- a/syscall.c +++ b/syscall.c @@ -152,10 +152,11 @@ int do_chmod(const char *path, mode_t mode) int code; if (dry_run) return 0; RETURN_ERROR_IF_RO_OR_LO; - if (S_ISLNK(mode)) { #ifdef HAVE_LCHMOD - code = lchmod(path, mode & CHMOD_BITS); -#elif defined HAVE_SETATTRLIST + code = lchmod(path, mode & CHMOD_BITS); +#else + if (S_ISLNK(mode)) { +# if defined HAVE_SETATTRLIST struct attrlist attrList; uint32_t m = mode & CHMOD_BITS; /* manpage is wrong: not mode_t! */ @@ -163,11 +164,12 @@ int do_chmod(const char *path, mode_t mode) attrList.bitmapcount = ATTR_BIT_MAP_COUNT; attrList.commonattr = ATTR_CMN_ACCESSMASK; code = setattrlist(path, &attrList, &m, sizeof m, FSOPT_NOFOLLOW); -#else +# else code = 1; -#endif +# endif } else code = chmod(path, mode & CHMOD_BITS); /* DISCOURAGED FUNCTION */ +#endif /* !HAVE_LCHMOD */ if (code != 0 && (preserve_perms || preserve_executability)) return code; return 0; @@ -181,6 +183,22 @@ int do_rename(const char *fname1, const char *fname2) return rename(fname1, fname2); } +#ifdef HAVE_FTRUNCATE +int do_ftruncate(int fd, OFF_T size) +{ + int ret; + + if (dry_run) return 0; + RETURN_ERROR_IF_RO_OR_LO; + + do { + ret = ftruncate(fd, size); + } while (ret < 0 && errno == EINTR); + + return ret; +} +#endif + void trim_trailing_slashes(char *name) { int l; @@ -282,3 +300,77 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence) return lseek(fd, offset, whence); #endif } + +#ifdef HAVE_UTIMENSAT +int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec) +{ + struct timespec t[2]; + + if (dry_run) return 0; + RETURN_ERROR_IF_RO_OR_LO; + + t[0].tv_sec = 0; + t[0].tv_nsec = UTIME_NOW; + t[1].tv_sec = modtime; + t[1].tv_nsec = mod_nsec; + return utimensat(AT_FDCWD, fname, t, AT_SYMLINK_NOFOLLOW); +} +#endif + +#ifdef HAVE_LUTIMES +int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec) +{ + struct timeval t[2]; + + if (dry_run) return 0; + RETURN_ERROR_IF_RO_OR_LO; + + t[0].tv_sec = time(NULL); + t[0].tv_usec = 0; + t[1].tv_sec = modtime; + t[1].tv_usec = mod_nsec / 1000; + return lutimes(fname, t); +} +#endif + +#ifdef HAVE_UTIMES +int do_utimes(const char *fname, time_t modtime, uint32 mod_nsec) +{ + struct timeval t[2]; + + if (dry_run) return 0; + RETURN_ERROR_IF_RO_OR_LO; + + t[0].tv_sec = time(NULL); + t[0].tv_usec = 0; + t[1].tv_sec = modtime; + t[1].tv_usec = mod_nsec / 1000; + return utimes(fname, t); +} + +#elif defined HAVE_UTIME +int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec)) +{ +#ifdef HAVE_STRUCT_UTIMBUF + struct utimbuf tbuf; +#else + time_t t[2]; +#endif + + if (dry_run) return 0; + RETURN_ERROR_IF_RO_OR_LO; + +# ifdef HAVE_STRUCT_UTIMBUF + tbuf.actime = time(NULL); + tbuf.modtime = modtime; + return utime(fname, &tbuf); +# else + t[0] = time(NULL); + t[1] = modtime; + return utime(fname, t); +# endif +} + +#else +#error Need utimes or utime function. +#endif diff --git a/t_stub.c b/t_stub.c index 103e846..fd57bcc 100644 --- a/t_stub.c +++ b/t_stub.c @@ -26,6 +26,7 @@ int module_id = -1; int relative_paths = 0; int human_readable = 0; int module_dirlen = 0; +int preserve_times = 0; int preserve_xattrs = 0; mode_t orig_umask = 002; char *partial_dir; diff --git a/testsuite/devices.test b/testsuite/devices.test index 1e7b776..5981e03 100644 --- a/testsuite/devices.test +++ b/testsuite/devices.test @@ -117,7 +117,7 @@ cD$all_plus char3 cS$all_plus fifo EOT if test ! -r "$fromdir/block2.5"; then - sed -e '/block2\.5/d' <"$chkfile" >"$chkfile.new" + grep -v block2.5 <"$chkfile" >"$chkfile.new" mv "$chkfile.new" "$chkfile" fi diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed" @@ -128,7 +128,7 @@ echo "" ( cd "$todir" && rsync_ls_lR . ) > "$tmpdir/ls-to" diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" -if test -b "$fromdir/block2.5"; then +if test -r "$fromdir/block2.5"; then set -x $RSYNC -aii --link-dest="$todir" "$fromdir/" "$chkdir/" \ | tee "$outfile" @@ -143,7 +143,7 @@ hD$allspace char2 hD$allspace char3 hS$allspace fifo EOT - diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed" + diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed" fi # The script would have aborted on error, so getting here means we've won. diff --git a/testsuite/hardlinks.test b/testsuite/hardlinks.test index 1737b35..a0db2d0 100644 --- a/testsuite/hardlinks.test +++ b/testsuite/hardlinks.test @@ -28,7 +28,7 @@ name2="$fromdir/name2" name3="$fromdir/name3" name4="$fromdir/name4" echo "This is the file" > "$name1" -ln "$name1" "$name2" || fail "Can't create hardlink" +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" cat $srcdir/*.c >"$fromdir/text" diff --git a/testsuite/itemize.test b/testsuite/itemize.test index bdb08c2..0dbb5a4 100644 --- a/testsuite/itemize.test +++ b/testsuite/itemize.test @@ -17,7 +17,7 @@ outfile="$scratchdir/rsync.out" makepath "$fromdir/foo" makepath "$fromdir/bar/baz" -cp -p "$srcdir/configure.in" "$fromdir/foo/config1" +cp -p "$srcdir/configure.ac" "$fromdir/foo/config1" cp -p "$srcdir/config.h.in" "$fromdir/foo/config2" cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync" chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync" @@ -66,7 +66,7 @@ diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed" # Ensure there are no accidental directory-time problems. $RSYNC -a -f '-! */' "$fromdir/" "$todir" -cp -p "$srcdir/configure.in" "$fromdir/foo/config2" +cp -p "$srcdir/configure.ac" "$fromdir/foo/config2" chmod 601 "$fromdir/foo/config2" $RSYNC -iplrH "$fromdir/" "$todir/" \ | tee "$outfile" @@ -99,7 +99,7 @@ cLc$T.$dots foo/sym -> ../bar/baz/rsync EOT diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed" -cp -p "$srcdir/configure.in" "$fromdir/foo/config2" +cp -p "$srcdir/configure.ac" "$fromdir/foo/config2" chmod 600 "$fromdir/foo/config2" # Lack of -t is for unchanged hard-link stress-test! $RSYNC -vvplrH "$fromdir/" "$todir/" \ diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns index 412ea3b..fbca180 100644 --- a/testsuite/rsync.fns +++ b/testsuite/rsync.fns @@ -27,6 +27,7 @@ chkdir="$tmpdir/chk" all_plus='+++++++++' allspace=' ' dots='.....' # trailing dots after changes +tab_ch=' ' # a single tab character # Berkley's nice. PATH="$PATH:/usr/ucb" @@ -223,7 +224,7 @@ checkit() { eval "$1" status=$? if [ $status != 0 ]; then - failed="YES"; + failed="$failed status=$status" fi echo "-------------" @@ -231,7 +232,7 @@ checkit() { echo "" ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from" ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to" - diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES + diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed="$failed dir-diff" echo "-------------" echo "check how the files compare with diff:" @@ -239,15 +240,16 @@ checkit() { if [ "x$4" != x ]; then echo " === Skipping (as directed) ===" else - diff -r $diffopt "$2" "$3" || failed=YES + diff -r $diffopt "$2" "$3" || failed="$failed file-diff" fi echo "-------------" if [ -z "$failed" ] ; then return 0 - else - return 1 fi + + echo "Failed: $failed" + return 1 } diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test index 2975b4a..50e262b 100644 --- a/testsuite/xattrs.test +++ b/testsuite/xattrs.test @@ -6,6 +6,7 @@ # Test that rsync handles basic xattr preservation. . $srcdir/testsuite/rsync.fns +lnkdir="$tmpdir/lnk" $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync is configured without xattr support" @@ -18,8 +19,9 @@ case "`xattr 2>&1`" in xattr -s "$xnam" "$xval" "${@}" } xls() { - xattr -l "${@}" + xattr -l "${@}" | sed "s/^[ $tab_ch]*//" } + RSYNC_PREFIX='rsync' RUSR='rsync.nonuser' ;; *) @@ -32,11 +34,12 @@ case "`xattr 2>&1`" in xls() { getfattr -d "${@}" } + RSYNC_PREFIX='user.rsync' RUSR='user.rsync' ;; esac -makepath "$fromdir/foo/bar" +makepath "$lnkdir" "$fromdir/foo/bar" echo now >"$fromdir/file0" echo something >"$fromdir/file1" echo else >"$fromdir/file2" @@ -48,7 +51,10 @@ makepath "$chkdir/foo" echo wow >"$chkdir/file1" cp_touch "$fromdir/foo/file3" "$chkdir/foo" -files='foo file0 file1 file2 foo/file3 file4 foo/bar/file5' +dirs='foo foo/bar' +files='file0 file1 file2 foo/file3 file4 foo/bar/file5' + +uid_gid=`"$TOOLDIR/tls" "$fromdir/foo" | sed 's/^.* \([0-9][0-9]*\)\.\([0-9][0-9]*\) .*/\1:\2/'` cd "$fromdir" @@ -68,54 +74,101 @@ xset user.dir1 'need to test directory xattrs too' foo xset user.dir2 'another xattr' foo xset user.dir3 'this is one last one for the moment' foo +xset user.dir4 'another dir test' foo/bar +xset user.dir5 'one last one' foo/bar + xset user.foo 'new foo' foo/file3 foo/bar/file5 xset user.bar 'new bar' foo/file3 foo/bar/file5 xset user.long 'this is also a long attribute that will be truncated in the initial data send' foo/file3 foo/bar/file5 xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' foo/file3 foo/bar/file5 +xset user.dir0 'old extra value' "$chkdir/foo" +xset user.dir1 'old dir value' "$chkdir/foo" + xset user.short 'old short' "$chkdir/file1" xset user.extra 'remove me' "$chkdir/file1" xset user.foo 'old foo' "$chkdir/foo/file3" xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' "$chkdir/foo/file3" -xls $files >"$scratchdir/xattrs.txt" +case $0 in +*hlink*) + ln foo/bar/file5 foo/bar/file6 || test_skipped "Can't create hardlink" + files="$files foo/bar/file6" + dashH='-H' + altDest='--link-dest' + ;; +*) + dashH='' + altDest='--copy-dest' + ;; +esac + +xls $dirs $files >"$scratchdir/xattrs.txt" # OK, let's try a simple xattr copy. -checkit "$RSYNC -avX --super . '$chkdir/'" "$fromdir" "$chkdir" +checkit "$RSYNC -avX $dashH --super . '$chkdir/'" "$fromdir" "$chkdir" cd "$chkdir" -xls $files | diff $diffopt "$scratchdir/xattrs.txt" - +xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - cd "$fromdir" -checkit "$RSYNC -aiX --super --copy-dest=../chk . ../to" "$fromdir" "$todir" +if [ "$dashH" ]; then + for fn in $files; do + name=`basename $fn` + ln $fn ../lnk/$name + done +fi + +checkit "$RSYNC -aiX $dashH --super $altDest=../chk . ../to" "$fromdir" "$todir" cd "$todir" -xls $files | diff $diffopt "$scratchdir/xattrs.txt" - +xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - + +[ "$dashH" ] && rm -rf "$lnkdir" cd "$fromdir" rm -rf "$todir" xset user.nice 'this is nice, but different' file1 -checkit "$RSYNC -aiX --fake-super . ../chk" "$fromdir" "$chkdir" +xls $dirs $files >"$scratchdir/xattrs.txt" -cd "$chkdir" -xls $files >"$scratchdir/xattrs.txt" - -cd "$fromdir" -checkit "$RSYNC -aiX --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir" +checkit "$RSYNC -aiX $dashH --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir" cd "$todir" -xls $files | diff $diffopt "$scratchdir/xattrs.txt" - +xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - -sed -n -e '/\.\/file1$/d' -e '/^[^ ][^ ]* *[^ ][^ ]* *[^ ][^ ]* *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff" +sed -n -e '/^[^ ][^ ]* *[^ ][^ ]* *[^ ][^ ]* *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff-all" +fgrep -v './file1' "$scratchdir/ls-diff-all" >"$scratchdir/ls-diff" || : if [ -s "$scratchdir/ls-diff" ]; then echo "Missing hard links on:" cat "$scratchdir/ls-diff" exit 1 fi +if [ ! -s "$scratchdir/ls-diff-all" ]; then + echo "Too many hard links on file1!" + exit 1 +fi + +cd "$chkdir" +chmod go-rwx . $dirs $files + +xset user.nice 'this is nice, but different' file1 +xset $RSYNC_PREFIX.%stat "40000 0,0 $uid_gid" $dirs +xset $RSYNC_PREFIX.%stat "100000 0,0 $uid_gid" $files + +xls $dirs $files >"$scratchdir/xattrs.txt" + +cd "$fromdir" +rm -rf "$todir" + +# When run by a non-root tester, this checks if no-user-perm files/dirs can be copied. +checkit "$RSYNC -aiX $dashH --fake-super --chmod=a= . ../to" "$chkdir" "$todir" # 2>"$scratchdir/errors.txt" + +cd "$todir" +xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - cd "$fromdir" rm -rf "$todir" "$chkdir" @@ -124,10 +177,13 @@ $RSYNC -aX file1 file2 $RSYNC -aX file1 file2 ../chk/ $RSYNC -aX --del ../chk/ . $RSYNC -aX file1 ../lnk/ +[ "$dashH" ] && ln "$chkdir/file1" ../lnk/extra-link xls file1 file2 >"$scratchdir/xattrs.txt" -checkit "$RSYNC -aiiX --copy-dest=../lnk . ../to" "$chkdir" "$todir" +checkit "$RSYNC -aiiX $dashH $altDest=../lnk . ../to" "$chkdir" "$todir" + +[ "$dashH" ] && rm ../lnk/extra-link cd "$todir" xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" - diff --git a/token.c b/token.c index 3e068a9..843055f 100644 --- a/token.c +++ b/token.c @@ -192,6 +192,8 @@ void set_compression(const char *fname) return; while (1) { + if (isUpper(<r)) + ltr = toLower(<r); while (node->letter != ltr) { if (node->letter > ltr) return; diff --git a/uidlist.c b/uidlist.c index dd26a55..e43ae5c 100644 --- a/uidlist.c +++ b/uidlist.c @@ -39,8 +39,6 @@ extern int numeric_ids; # endif #endif -#define GID_NONE ((gid_t)-1) - struct idlist { struct idlist *next; const char *name; @@ -103,12 +101,12 @@ static gid_t map_gid(gid_t id, const char *name) static int is_in_group(gid_t gid) { #ifdef HAVE_GETGROUPS - static gid_t last_in = GID_NONE, last_out; - static int ngroups = -2; + static gid_t last_in; + static int ngroups = -2, last_out = -1; static GETGROUPS_T *gidset; int n; - if (gid == last_in) + if (gid == last_in && last_out >= 0) return last_out; if (ngroups < -1) { gid_t mygid = MY_GID(); diff --git a/util.c b/util.c index f02a6a1..a694fde 100644 --- a/util.c +++ b/util.c @@ -24,10 +24,10 @@ #include "ifuncs.h" extern int verbose; -extern int dry_run; extern int module_id; extern int modify_window; extern int relative_paths; +extern int preserve_times; extern int human_readable; extern int preserve_xattrs; extern char *module_dir; @@ -123,12 +123,11 @@ NORETURN void overflow_exit(const char *str) exit_cleanup(RERR_MALLOC); } +/* 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, mode_t mode) { -#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES - if (S_ISLNK(mode)) - return 1; -#endif + static int switch_step = 0; if (verbose > 2) { rprintf(FINFO, "set modtime of %s to (%ld) %s", @@ -136,38 +135,49 @@ int set_modtime(const char *fname, time_t modtime, mode_t mode) asctime(localtime(&modtime))); } - if (dry_run) - return 0; + switch (switch_step) { +#ifdef HAVE_UTIMENSAT +#include "case_N.h" + if (do_utimensat(fname, modtime, 0) == 0) + break; + if (errno != ENOSYS) + return -1; + switch_step++; + /* FALLTHROUGH */ +#endif - { -#ifdef HAVE_UTIMES - struct timeval t[2]; - t[0].tv_sec = time(NULL); - t[0].tv_usec = 0; - t[1].tv_sec = modtime; - t[1].tv_usec = 0; -# ifdef HAVE_LUTIMES - if (S_ISLNK(mode)) { - if (lutimes(fname, t) < 0) - return errno == ENOSYS ? 1 : -1; - return 0; +#ifdef HAVE_LUTIMES +#include "case_N.h" + if (do_lutimes(fname, modtime, 0) == 0) + break; + if (errno != ENOSYS) + return -1; + switch_step++; + /* FALLTHROUGH */ +#endif + +#include "case_N.h" + switch_step++; + if (preserve_times & PRESERVE_LINK_TIMES) { + preserve_times &= ~PRESERVE_LINK_TIMES; + if (S_ISLNK(mode)) + return 1; } -# endif - return utimes(fname, t); -#elif defined HAVE_STRUCT_UTIMBUF - struct utimbuf tbuf; - tbuf.actime = time(NULL); - tbuf.modtime = modtime; - return utime(fname,&tbuf); -#elif defined HAVE_UTIME - time_t t[2]; - t[0] = time(NULL); - t[1] = modtime; - return utime(fname,t); + /* FALLTHROUGH */ + +#include "case_N.h" +#ifdef HAVE_UTIMES + if (do_utimes(fname, modtime, 0) == 0) + break; #else -#error No file-time-modification routine found! + if (do_utime(fname, modtime, 0) == 0) + break; #endif + + return -1; } + + return 0; } /* This creates a new directory with default permissions. Since there diff --git a/xattrs.c b/xattrs.c index 1f3dcb3..7b5c1b1 100644 --- a/xattrs.c +++ b/xattrs.c @@ -32,6 +32,9 @@ extern int am_generator; extern int read_only; extern int list_only; extern int preserve_xattrs; +extern int preserve_links; +extern int preserve_devices; +extern int preserve_specials; extern int checksum_seed; #define RSYNC_XAL_INITIAL 5 @@ -138,7 +141,7 @@ static ssize_t get_xattr_names(const char *fname) got_error: rsyserr(FERROR_XFER, errno, "get_xattr_names: llistxattr(\"%s\",%.0f) failed", - fname, arg); + full_fname(fname), arg); return -1; } list_len = sys_llistxattr(fname, NULL, 0); @@ -174,7 +177,7 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr return NULL; rsyserr(FERROR_XFER, errno, "get_xattr_data: lgetxattr(\"%s\",\"%s\",0) failed", - fname, name); + full_fname(fname), name); return NULL; } @@ -191,11 +194,11 @@ static char *get_xattr_data(const char *fname, const char *name, size_t *len_ptr if (len == (size_t)-1) { rsyserr(FERROR_XFER, errno, "get_xattr_data: lgetxattr(\"%s\",\"%s\",%ld)" - " failed", fname, name, (long)datum_len); + " failed", full_fname(fname), name, (long)datum_len); } else { rprintf(FERROR_XFER, "get_xattr_data: lgetxattr(\"%s\",\"%s\",%ld)" - " returned %ld\n", fname, name, + " returned %ld\n", full_fname(fname), name, (long)datum_len, (long)len); } free(ptr); @@ -283,6 +286,26 @@ int get_xattr(const char *fname, stat_x *sxp) { sxp->xattr = new(item_list); *sxp->xattr = empty_xattr; + + if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) { + /* Everyone supports this. */ + } else if (S_ISLNK(sxp->st.st_mode)) { +#ifndef NO_SYMLINK_XATTRS + if (!preserve_links) +#endif + return 0; + } else if (IS_SPECIAL(sxp->st.st_mode)) { +#ifndef NO_SPECIAL_XATTRS + if (!preserve_specials) +#endif + return 0; + } else if (IS_DEVICE(sxp->st.st_mode)) { +#ifndef NO_DEVICE_XATTRS + if (!preserve_devices) +#endif + return 0; + } + if (rsync_xal_get(fname, sxp->xattr) < 0) { free_xattr(sxp); return -1; @@ -321,8 +344,8 @@ int copy_xattrs(const char *source, const char *dest) if (sys_lsetxattr(dest, name, ptr, datum_len) < 0) { int save_errno = errno ? errno : EINVAL; rsyserr(FERROR_XFER, errno, - "rsync_xal_set: lsetxattr(\"%s\",\"%s\") failed", - dest, name); + "copy_xattrs: lsetxattr(\"%s\",\"%s\") failed", + full_fname(dest), name); errno = save_errno; return -1; } @@ -383,7 +406,7 @@ static void rsync_xal_store(item_list *xalp) } /* Send the make_xattr()-generated xattr list for this flist entry. */ -int send_xattr(stat_x *sxp, int f) +int send_xattr(int f, stat_x *sxp) { int ndx = find_matching_xattr(sxp->xattr); @@ -574,7 +597,7 @@ int recv_xattr_request(struct file_struct *file, int f_in) if (F_XATTR(file) < 0) { rprintf(FERROR, "recv_xattr_request: internal data error!\n"); - exit_cleanup(RERR_STREAMIO); + exit_cleanup(RERR_PROTOCOL); } lst += F_XATTR(file); @@ -590,12 +613,12 @@ int recv_xattr_request(struct file_struct *file, int f_in) if (!cnt || rxa->num != num) { rprintf(FERROR, "[%s] could not find xattr #%d for %s\n", who_am_i(), num, f_name(file, NULL)); - exit_cleanup(RERR_STREAMIO); + exit_cleanup(RERR_PROTOCOL); } if (!XATTR_ABBREV(*rxa) || rxa->datum[0] != XSTATE_ABBREV) { rprintf(FERROR, "[%s] internal abbrev error on %s (%s, len=%ld)!\n", who_am_i(), f_name(file, NULL), rxa->name, (long)rxa->datum_len); - exit_cleanup(RERR_STREAMIO); + exit_cleanup(RERR_PROTOCOL); } if (am_sender) { @@ -625,7 +648,7 @@ int recv_xattr_request(struct file_struct *file, int f_in) /* ------------------------------------------------------------------------- */ /* receive and build the rsync_xattr_lists */ -void receive_xattr(struct file_struct *file, int f) +void receive_xattr(int f, struct file_struct *file) { static item_list temp_xattr = EMPTY_ITEM_LIST; int count, num; @@ -639,14 +662,14 @@ void receive_xattr(struct file_struct *file, int f) if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) { rprintf(FERROR, "receive_xattr: xa index %d out of" " range for %s\n", ndx, f_name(file, NULL)); - exit_cleanup(RERR_STREAMIO); + exit_cleanup(RERR_PROTOCOL); } if (ndx != 0) { F_XATTR(file) = ndx - 1; return; } - + if ((count = read_varint(f)) != 0) { (void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count); temp_xattr.count = 0; @@ -807,7 +830,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp, else if (sys_lsetxattr(fname, name, ptr, len) < 0) { rsyserr(FERROR_XFER, errno, "rsync_xal_set: lsetxattr(\"%s\",\"%s\") failed", - fname, name); + full_fname(fname), name); ret = -1; } else /* make sure caller sets mtime */ sxp->st.st_mtime = (time_t)-1; @@ -828,7 +851,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp, if (sys_lsetxattr(fname, name, rxas[i].datum, rxas[i].datum_len) < 0) { rsyserr(FERROR_XFER, errno, "rsync_xal_set: lsetxattr(\"%s\",\"%s\") failed", - fname, name); + full_fname(fname), name); ret = -1; } else /* make sure caller sets mtime */ sxp->st.st_mtime = (time_t)-1; @@ -857,8 +880,8 @@ static int rsync_xal_set(const char *fname, item_list *xalp, if (i == xalp->count) { if (sys_lremovexattr(fname, name) < 0) { rsyserr(FERROR_XFER, errno, - "rsync_xal_clear: lremovexattr(\"%s\",\"%s\") failed", - fname, name); + "rsync_xal_set: lremovexattr(\"%s\",\"%s\") failed", + full_fname(fname), name); ret = -1; } else /* make sure caller sets mtime */ sxp->st.st_mtime = (time_t)-1; @@ -883,6 +906,25 @@ int set_xattr(const char *fname, const struct file_struct *file, return -1; } +#ifdef NO_SPECIAL_XATTRS + if (IS_SPECIAL(sxp->st.st_mode)) { + errno = ENOTSUP; + return -1; + } +#endif +#ifdef NO_DEVICE_XATTRS + if (IS_DEVICE(sxp->st.st_mode)) { + errno = ENOTSUP; + return -1; + } +#endif +#ifdef NO_SYMLINK_XATTRS + if (S_ISLNK(sxp->st.st_mode)) { + errno = ENOTSUP; + return -1; + } +#endif + ndx = F_XATTR(file); return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp); } @@ -901,7 +943,7 @@ int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t if (sys_lsetxattr(fname, name, buf, buf_len) < 0) { rsyserr(FERROR_XFER, errno, "set_xattr_acl: lsetxattr(\"%s\",\"%s\") failed", - fname, name); + full_fname(fname), name); return -1; } return 0; diff -upN a/config.h.in b/config.h.in --- a/config.h.in +++ b/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in. Generated from configure.in by autoheader. */ +/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD @@ -12,7 +12,7 @@ /* Define to 1 if chown modifies symlinks. */ #undef CHOWN_MODIFIES_SYMLINK -/* Undefine if you don't want locale features. By default this is defined. */ +/* Undefine if you do not want locale features. By default this is defined. */ #undef CONFIG_LOCALE /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP @@ -400,7 +400,7 @@ /* Define to 1 if the system has the type `struct stat64'. */ #undef HAVE_STRUCT_STAT64 -/* Define to 1 if `struct stat' is a member of `st_rdev'. */ +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if you have the "struct utimbuf" type */ @@ -480,6 +480,9 @@ /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME +/* Define to 1 if you have the `utimensat' function. */ +#undef HAVE_UTIMENSAT + /* Define to 1 if you have the `utimes' function. */ #undef HAVE_UTIMES @@ -552,6 +555,15 @@ /* unprivileged user--e.g. nobody */ #undef NOBODY_USER +/* True if device files do not support xattrs */ +#undef NO_DEVICE_XATTRS + +/* True if special files do not support xattrs */ +#undef NO_SPECIAL_XATTRS + +/* True if symlinks do not support xattrs */ +#undef NO_SYMLINK_XATTRS + /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT diff -upN a/configure.sh b/configure.sh --- a/configure.sh +++ b/configure.sh @@ -1,11 +1,13 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64. +# Generated by GNU Autoconf 2.67. +# # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## @@ -314,7 +316,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -354,19 +356,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -524,10 +526,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -749,8 +752,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -795,7 +799,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -821,7 +825,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1025,7 +1029,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1041,7 +1045,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1071,8 +1075,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1080,7 +1084,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1098,13 +1102,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1127,7 +1131,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1141,8 +1145,8 @@ target=$target_alias 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 + $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 @@ -1157,9 +1161,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1198,11 +1202,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1242,7 +1246,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1304,7 +1308,7 @@ Optional Features: --enable-maintainer-mode turn on extra debug features --disable-largefile omit support for large files - --disable-ipv6 don't even try to use IPv6 + --disable-ipv6 do not even try to use IPv6 --disable-locale disable locale features --disable-iconv-open disable all use of iconv_open() function --disable-iconv disable rsync's --iconv option @@ -1329,7 +1333,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1400,9 +1404,9 @@ test -n "$ac_init_help" && exit $ac_stat if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.64 +generated by GNU Autoconf 2.67 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1447,7 +1451,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1472,7 +1476,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1484,7 +1488,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1526,7 +1530,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1572,7 +1576,7 @@ fi # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1585,7 +1589,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1615,10 +1619,10 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1654,7 +1658,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -1681,7 +1685,7 @@ $as_echo "$as_me: WARNING: $2: proceedin esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1868,7 +1872,7 @@ rm -f conftest.val fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -1881,7 +1885,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1935,7 +1939,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1991,7 +1995,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2054,7 +2058,7 @@ This file contains any messages produced running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2164,11 +2168,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2202,11 +2204,9 @@ $as_echo "$as_me: WARNING: cache variabl ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2219,11 +2219,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2237,11 +2235,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2296,7 +2292,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2307,18 +2308,22 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -2388,7 +2393,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2406,7 +2411,7 @@ ac_config_headers="$ac_config_headers co -RSYNC_VERSION=3.0.7 +RSYNC_VERSION=3.0.8 { $as_echo "$as_me:${as_lineno-$LINENO}: Configuring rsync $RSYNC_VERSION" >&5 $as_echo "$as_me: Configuring rsync $RSYNC_VERSION" >&6;} @@ -2421,16 +2426,22 @@ LDFLAGS=${LDFLAGS-""} ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2444,7 +2455,7 @@ ac_configure="$SHELL $ac_aux_dir/configu # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -2455,16 +2466,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2489,7 +2500,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -2497,7 +2508,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2837,8 +2848,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2859,32 +2870,30 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + int main () { -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2946,62 +2955,28 @@ test "$ac_cv_exeext" = no && ac_cv_exeex else ac_file='' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -3031,16 +3006,75 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } fi -rm -f conftest$ac_cv_exeext +rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : @@ -3083,8 +3117,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3346,7 +3380,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3362,11 +3396,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -3405,7 +3439,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3421,18 +3455,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -3492,7 +3526,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -3558,7 +3592,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -3964,8 +3998,8 @@ $as_echo "#define _GNU_SOURCE 1" >>confd if test x"$ac_cv_prog_cc_stdc" = x"no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: rsync requires an ANSI C compiler and you don't seem to have one" >&5 -$as_echo "$as_me: WARNING: rsync requires an ANSI C compiler and you don't seem to have one" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: rsync requires an ANSI C compiler and you do not seem to have one" >&5 +$as_echo "$as_me: WARNING: rsync requires an ANSI C compiler and you do not seem to have one" >&2;} fi # Check whether --enable-profile was given. @@ -4032,7 +4066,7 @@ if test "${with_rsyncd_conf+set}" = set; RSYNCD_SYSCONF="$with_rsyncd_conf" ;; *) - as_fn_error "You must specify an absolute path to --with-rsyncd-conf=PATH" "$LINENO" 5 + as_fn_error $? "You must specify an absolute path to --with-rsyncd-conf=PATH" "$LINENO" 5 ;; esac else @@ -4846,8 +4880,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -5077,8 +5110,8 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUI ;; #( *) - as_fn_error "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac ac_header_dirent=no @@ -5086,7 +5119,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/di as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5113,8 +5146,7 @@ fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF @@ -5326,8 +5358,7 @@ for ac_header in sys/fcntl.h sys/select. do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -5451,9 +5482,8 @@ else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -5485,9 +5515,8 @@ else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long=0 fi @@ -5519,9 +5548,8 @@ else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -5553,9 +5581,8 @@ else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (short) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short=0 fi @@ -5587,9 +5614,8 @@ else if test "$ac_cv_type_int16_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int16_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int16_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int16_t=0 fi @@ -5621,9 +5647,8 @@ else if test "$ac_cv_type_uint16_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (uint16_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (uint16_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uint16_t=0 fi @@ -5655,9 +5680,8 @@ else if test "$ac_cv_type_int32_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int32_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int32_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int32_t=0 fi @@ -5689,9 +5713,8 @@ else if test "$ac_cv_type_uint32_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (uint32_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (uint32_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_uint32_t=0 fi @@ -5723,9 +5746,8 @@ else if test "$ac_cv_type_int64_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int64_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int64_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int64_t=0 fi @@ -5757,9 +5779,8 @@ else if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (off_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off_t=0 fi @@ -5791,9 +5812,8 @@ else if test "$ac_cv_type_off64_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (off64_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (off64_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_off64_t=0 fi @@ -5825,9 +5845,8 @@ else if test "$ac_cv_type_time_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (time_t) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_time_t=0 fi @@ -6183,7 +6202,7 @@ rm -f core conftest.err conftest.$ac_obj done if test "x$rsync_cv_socklen_t_equiv" = x; then - as_fn_error "Cannot find a type to use in place of socklen_t" "$LINENO" 5 + as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 fi fi @@ -6510,8 +6529,65 @@ if test "$ac_res" != no; then : fi -# Solaris and HP-UX weirdness: -# Search for libiconv_open (not iconv_open) to discover if -liconv is needed! +# For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll +# accept either iconv_open or libiconv_open, since some include files map +# the former to the latter. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5 +$as_echo_n "checking for library containing iconv_open... " >&6; } +if test "${ac_cv_search_iconv_open+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char iconv_open (); +int +main () +{ +return iconv_open (); + ; + return 0; +} +_ACEOF +for ac_lib in '' iconv; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_iconv_open=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_iconv_open+set}" = set; then : + break +fi +done +if test "${ac_cv_search_iconv_open+set}" = set; then : + +else + ac_cv_search_iconv_open=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_iconv_open" >&5 +$as_echo "$ac_cv_search_iconv_open" >&6; } +ac_res=$ac_cv_search_iconv_open +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libiconv_open" >&5 $as_echo_n "checking for library containing libiconv_open... " >&6; } if test "${ac_cv_search_libiconv_open+set}" = set; then : @@ -6661,7 +6737,7 @@ done cv=`echo "struct addrinfo" | sed 'y%./+- %__p__%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5 $as_echo_n "checking for struct addrinfo... " >&6; } -if { as_var=ac_cv_type_$cv; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_type_$cv+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6713,7 +6789,7 @@ fi cv=`echo "struct sockaddr_storage" | sed 'y%./+- %__p__%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 $as_echo_n "checking for struct sockaddr_storage... " >&6; } -if { as_var=ac_cv_type_$cv; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_type_$cv+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6905,7 +6981,7 @@ fi cv=`echo "struct stat64" | sed 'y%./+- %__p__%'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 $as_echo_n "checking for struct stat64... " >&6; } -if { as_var=ac_cv_type_$cv; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_type_$cv+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7097,8 +7173,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7286,8 +7361,7 @@ if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -7355,12 +7429,12 @@ for ac_func in waitpid wait4 getcwd strd strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \ 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 + extattr_get_link sigaction sigprocmask setattrlist \ + utimensat 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" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -7382,8 +7456,7 @@ for ac_func in getpgrp tcgetpgrp 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" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -8065,8 +8138,7 @@ for ac_func in _acl __acl _facl __facl 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" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -8276,7 +8348,7 @@ $as_echo "#define HAVE_ACL_GET_PERM_NP 1 fi else if test x"$enable_acl_support" = x"yes"; then - as_fn_error "Failed to find ACL support" "$LINENO" 5 + as_fn_error $? "Failed to find ACL support" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: No ACL support found" >&5 $as_echo "No ACL support found" >&6; } @@ -8314,6 +8386,9 @@ $as_echo "#define HAVE_LINUX_XATTRS 1" > $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h + +$as_echo "#define NO_SYMLINK_XATTRS 1" >>confdefs.h + ;; darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using OS X xattrs" >&5 @@ -8323,6 +8398,12 @@ $as_echo "#define HAVE_OSX_XATTRS 1" >>c $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h + +$as_echo "#define NO_DEVICE_XATTRS 1" >>confdefs.h + + +$as_echo "#define NO_SPECIAL_XATTRS 1" >>confdefs.h + ;; freebsd*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using FreeBSD extattrs" >&5 @@ -8335,7 +8416,7 @@ $as_echo "#define HAVE_FREEBSD_XATTRS 1" ;; *) if test x"$enable_xattr_support" = x"yes"; then - as_fn_error "Failed to find extended attribute support" "$LINENO" 5 + as_fn_error $? "Failed to find extended attribute support" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: No extended attribute support found" >&5 $as_echo "No extended attribute support found" >&6; } @@ -8467,6 +8548,7 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -8629,19 +8711,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -8837,7 +8919,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -8891,7 +8973,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -8930,6 +9012,7 @@ Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit + --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -8949,12 +9032,13 @@ Report bugs to the package provider." _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.64, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -8970,11 +9054,16 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -8988,12 +9077,15 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -9006,7 +9098,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -9015,7 +9107,7 @@ Try \`$0 --help' for more information."; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -9071,7 +9163,7 @@ do "popt/dummy") CONFIG_FILES="$CONFIG_FILES popt/dummy" ;; "shconfig") CONFIG_FILES="$CONFIG_FILES shconfig" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -9108,7 +9200,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -9125,7 +9217,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -9139,18 +9231,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -9172,7 +9264,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -9186,7 +9278,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -9239,20 +9331,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/n else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -9280,7 +9380,7 @@ for ac_last_try in false false :; do if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -9365,7 +9465,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -9378,7 +9478,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -9406,7 +9506,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -9433,7 +9533,7 @@ $as_echo "$as_me: creating $ac_file" >&6 case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -9564,22 +9664,22 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -9590,19 +9690,19 @@ which seems to be undefined. Please mak $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; @@ -9617,7 +9717,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -9638,7 +9738,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff -upN a/proto.h b/proto.h --- a/proto.h +++ b/proto.h @@ -3,11 +3,11 @@ int allow_access(char *addr, char *host, char *allow_list, char *deny_list); void free_acl(stat_x *sxp); int get_acl(const char *fname, stat_x *sxp); -void send_acl(stat_x *sxp, int f); -void receive_acl(struct file_struct *file, int f); +void send_acl(int f, stat_x *sxp); +void receive_acl(int f, struct file_struct *file); void cache_tmp_acl(struct file_struct *file, stat_x *sxp); void uncache_tmp_acls(void); -int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp); +int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp, mode_t new_mode); void match_acl_ids(void); int default_perms_for_dir(const char *dir); void base64_encode(const char *buf, int len, char *out, int pad); @@ -73,7 +73,7 @@ char *get_rule_prefix(int match_flags, c unsigned int *plen_ptr); void send_filter_list(int f_out); void recv_filter_list(int f_in); -int sparse_end(int f); +int sparse_end(int f, OFF_T size); int flush_write_file(int f); int write_file(int f, char *buf, int len); struct map_struct *map_file(int fd, OFF_T len, int32 read_size, @@ -100,7 +100,7 @@ int f_name_cmp(const struct file_struct int f_name_has_prefix(const struct file_struct *f1, const struct file_struct *f2); char *f_name_buf(void); char *f_name(const struct file_struct *f, char *fbuf); -struct file_list *get_dirlist(char *dirname, int dlen, int ignore_filter_rules); +struct file_list *get_dirlist(char *dirname, int dlen, int flags); int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp); void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statret, stat_x *sxp, int32 iflags, uchar fnamecmp_type, @@ -294,7 +294,6 @@ int open_socket_out_wrapped(char *host, int is_a_socket(int fd); void start_accept_loop(int port, int (*fn)(int, int)); void set_socket_options(int fd, char *options); -int sock_exec(const char *prog); int do_unlink(const char *fname); int do_symlink(const char *fname1, const char *fname2); int do_link(const char *fname1, const char *fname2); @@ -304,6 +303,7 @@ int do_rmdir(const char *pathname); int do_open(const char *pathname, int flags, mode_t mode); int do_chmod(const char *path, mode_t mode); int do_rename(const char *fname1, const char *fname2); +int do_ftruncate(int fd, OFF_T size); void trim_trailing_slashes(char *name); int do_mkdir(char *fname, mode_t mode); int do_mkstemp(char *template, mode_t perms); @@ -311,6 +311,10 @@ int do_stat(const char *fname, STRUCT_ST int do_lstat(const char *fname, STRUCT_STAT *st); int do_fstat(int fd, STRUCT_STAT *st); OFF_T do_lseek(int fd, OFF_T offset, int whence); +int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec); +int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec); +int do_utimes(const char *fname, time_t modtime, uint32 mod_nsec); +int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec)); void set_compression(const char *fname); void send_token(int f, int32 token, struct map_struct *buf, OFF_T offset, int32 n, int32 toklen); @@ -381,11 +385,11 @@ void *expand_item_list(item_list *lp, si void free_xattr(stat_x *sxp); int get_xattr(const char *fname, stat_x *sxp); int copy_xattrs(const char *source, const char *dest); -int send_xattr(stat_x *sxp, int f); +int send_xattr(int f, stat_x *sxp); int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all); void send_xattr_request(const char *fname, struct file_struct *file, int f_out); int recv_xattr_request(struct file_struct *file, int f_in); -void receive_xattr(struct file_struct *file, int f); +void receive_xattr(int f, struct file_struct *file); void cache_tmp_xattr(struct file_struct *file, stat_x *sxp); void uncache_tmp_xattrs(void); int set_xattr(const char *fname, const struct file_struct *file, diff -upN a/rsync.1 b/rsync.1 --- a/rsync.1 +++ b/rsync.1 @@ -1,6 +1,6 @@ -.TH "rsync" "1" "31 Dec 2009" "" "" +.TH "rsync" "1" "26 Mar 2011" "" "" .SH "NAME" -rsync \(em a fast, versatile, remote (and local) file-copying tool +rsync \(em a fast, versatile, remote (and local) file\-copying tool .SH "SYNOPSIS" .PP @@ -29,7 +29,7 @@ Rsync is a fast and extraordinarily vers copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the -set of files to be copied. It is famous for its delta-transfer algorithm, +set of files to be copied. It is famous for its delta\-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an @@ -37,7 +37,7 @@ improved copy command for everyday use. .PP Rsync finds files that need to be transferred using a \(dq\&quick check\(dq\& algorithm (by default) that looks for files that have changed in size or -in last-modified time. Any changes in the other preserved attributes (as +in last\-modified time. Any changes in the other preserved attributes (as requested by options) are made on the destination file directly when the quick check indicates that the file\(cq\&s data does not need to be updated. .PP @@ -46,13 +46,13 @@ Some of the additional features of rsync .IP o support for copying links, devices, owners, groups, and permissions .IP o -exclude and exclude-from options similar to GNU tar +exclude and exclude\-from options similar to GNU tar .IP o a CVS exclude mode for ignoring the same files that CVS would ignore .IP o can use any transparent remote shell, including ssh or rsh .IP o -does not require super-user privileges +does not require super\-user privileges .IP o pipelining of file transfers to minimize latency costs .IP o @@ -67,13 +67,13 @@ Rsync copies files either to or from a r current host (it does not support copying files between two remote hosts). .PP There are two different ways for rsync to contact a remote system: using a -remote-shell program as the transport (such as ssh or rsh) or contacting an -rsync daemon directly via TCP. The remote-shell transport is used whenever +remote\-shell program as the transport (such as ssh or rsh) or contacting an +rsync daemon directly via TCP. The remote\-shell transport is used whenever the source or destination path contains a single colon (:) separator after a host specification. Contacting an rsync daemon directly happens when the source or destination path contains a double colon (::) separator after a host specification, OR when an rsync:// URL is specified (see also the -\(dq\&USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION\(dq\& section for +\(dq\&USING RSYNC\-DAEMON FEATURES VIA A REMOTE\-SHELL CONNECTION\(dq\& section for an exception to this latter rule). .PP As a special case, if a single source arg is specified without a @@ -83,8 +83,8 @@ As expected, if neither the source or de host, the copy occurs locally (see also the \fB\-\-list\-only\fP option). .PP Rsync refers to the local side as the \(dq\&client\(dq\& and the remote side as the -\(dq\&server\(dq\&. Don\(cq\&t confuse \(dq\&server\(dq\& with an rsync daemon \(em a daemon is always a -server, but a server can be either a daemon or a remote-shell spawned process. +\(dq\&server\(dq\&. Don\(cq\&t confuse \(dq\&server\(dq\& with an rsync daemon \-\- a daemon is always a +server, but a server can be either a daemon or a remote\-shell spawned process. .PP .SH "SETUP" @@ -93,7 +93,7 @@ See the file README for installation ins .PP Once installed, you can use rsync to any machine that you can access via a remote shell (as well as some that you can access using the rsync -daemon-mode protocol). For remote transfers, a modern rsync uses ssh +daemon\-mode protocol). For remote transfers, a modern rsync uses ssh for its communications, but it may have been configured to use a different remote shell by default, such as rsh or remsh. .PP @@ -119,7 +119,7 @@ Perhaps the best way to explain the synt This would transfer all files matching the pattern *.c from the current directory to the directory src on the machine foo. If any of the files already exist on the remote system then the rsync -remote-update protocol is used to update the file by sending only the +remote\-update protocol is used to update the file by sending only the differences. See the tech report for details. .PP .RS @@ -168,7 +168,7 @@ copy the remote directory\(cq\&s content .RE .PP -You can also use rsync in local-only mode, where both the source and +You can also use rsync in local\-only mode, where both the source and destination don\(cq\&t have a \(cq\&:\(cq\& in the name. In this case it behaves like an improved copy command. .PP @@ -186,7 +186,7 @@ See the following section for more detai .PP The syntax for requesting multiple files from a remote host is done by -specifying additional remote-host args in the same style as the first, +specifying additional remote\-host args in the same style as the first, or with the hostname omitted. For instance, all these work: .PP .RS @@ -208,7 +208,7 @@ examples: .RE .PP -This word-splitting still works (by default) in the latest rsync, but is +This word\-splitting still works (by default) in the latest rsync, but is not as easy to use as the first method. .PP If you need to transfer a filename that contains whitespace, you can either @@ -290,26 +290,26 @@ The command specified above uses ssh to which forwards all data to port 873 (the rsync daemon) on the targethost (%H). .PP -.SH "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" +.SH "USING RSYNC\-DAEMON FEATURES VIA A REMOTE\-SHELL CONNECTION" .PP It is sometimes useful to use various features of an rsync daemon (such as named modules) without actually allowing any new socket connections into a -system (other than what is already required to allow remote-shell access). +system (other than what is already required to allow remote\-shell access). Rsync supports connecting to a host using a remote shell and then spawning -a single-use \(dq\&daemon\(dq\& server that expects to read its config file in the +a single\-use \(dq\&daemon\(dq\& server that expects to read its config file in the home dir of the remote user. This can be useful if you want to encrypt a -daemon-style transfer\(cq\&s data, but since the daemon is started up fresh by +daemon\-style transfer\(cq\&s data, but since the daemon is started up fresh by the remote user, you may not be able to use features such as chroot or change the uid used by the daemon. (For another way to encrypt a daemon transfer, consider using ssh to tunnel a local port to a remote machine and configure a normal rsync daemon on that remote host to only allow connections from \(dq\&localhost\(dq\&.) .PP -From the user\(cq\&s perspective, a daemon transfer via a remote-shell -connection uses nearly the same command-line syntax as a normal -rsync-daemon transfer, with the only exception being that you must -explicitly set the remote shell program on the command-line with the +From the user\(cq\&s perspective, a daemon transfer via a remote\-shell +connection uses nearly the same command\-line syntax as a normal +rsync\-daemon transfer, with the only exception being that you must +explicitly set the remote shell program on the command\-line with the \fB\-\-rsh=COMMAND\fP option. (Setting the RSYNC_RSH in the environment will not turn on this functionality.) For example: .PP @@ -318,19 +318,19 @@ will not turn on this functionality.) F .fi .PP -If you need to specify a different remote-shell user, keep in mind that the -user@ prefix in front of the host is specifying the rsync-user value (for a -module that requires user-based authentication). This means that you must -give the \(cq\&-l user\(cq\& option to ssh when specifying the remote-shell, as in +If you need to specify a different remote\-shell user, keep in mind that the +user@ prefix in front of the host is specifying the rsync\-user value (for a +module that requires user\-based authentication). This means that you must +give the \(cq\&\-l user\(cq\& option to ssh when specifying the remote\-shell, as in this example that uses the short version of the \fB\-\-rsh\fP option: .PP .nf - rsync \-av \-e \(dq\&ssh \-l ssh-user\(dq\& rsync-user@host::module /dest + rsync \-av \-e \(dq\&ssh \-l ssh\-user\(dq\& rsync\-user@host::module /dest .fi .PP -The \(dq\&ssh-user\(dq\& will be used at the ssh level; the \(dq\&rsync-user\(dq\& will be -used to log-in to the \(dq\&module\(dq\&. +The \(dq\&ssh\-user\(dq\& will be used at the ssh level; the \(dq\&rsync\-user\(dq\& will be +used to log\-in to the \(dq\&module\(dq\&. .PP .SH "STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS" @@ -339,11 +339,11 @@ In order to connect to an rsync daemon, daemon already running (or it needs to have configured something like inetd to spawn an rsync daemon for incoming connections on a particular port). For full information on how to start a daemon that will handling incoming -socket connections, see the \fBrsyncd.conf\fP(5) man page \(em that is the config +socket connections, see the \fBrsyncd.conf\fP(5) man page \-\- that is the config file for the daemon, and it contains the full details for how to run the -daemon (including stand-alone and inetd configurations). +daemon (including stand\-alone and inetd configurations). .PP -If you\(cq\&re using one of the remote-shell transports for the transfer, there is +If you\(cq\&re using one of the remote\-shell transports for the transfer, there is no need to manually start an rsync daemon. .PP .SH "EXAMPLES" @@ -393,9 +393,9 @@ to the detailed description below for a .nf \-v, \-\-verbose increase verbosity - \-q, \-\-quiet suppress non-error messages - \-\-no\-motd suppress daemon-mode MOTD (see caveat) - \-c, \-\-checksum skip based on checksum, not mod-time & size + \-q, \-\-quiet suppress non\-error messages + \-\-no\-motd suppress daemon\-mode MOTD (see caveat) + \-c, \-\-checksum skip based on checksum, not mod\-time & size \-a, \-\-archive archive mode; equals \-rlptgoD (no \-H,\-A,\-X) \-\-no\-OPTION turn off an implied OPTION (e.g. \-\-no\-D) \-r, \-\-recursive recurse into directories @@ -405,7 +405,7 @@ to the detailed description below for a \-\-backup\-dir=DIR make backups into hierarchy based in DIR \-\-suffix=SUFFIX backup suffix (default ~ w/o \-\-backup\-dir) \-u, \-\-update skip files that are newer on the receiver - \-\-inplace update destination files in-place + \-\-inplace update destination files in\-place \-\-append append data onto shorter files \-\-append\-verify \-\-append w/old data in file checksum \-d, \-\-dirs transfer directories without recursing @@ -421,25 +421,25 @@ to the detailed description below for a \-\-chmod=CHMOD affect file and/or directory permissions \-A, \-\-acls preserve ACLs (implies \-p) \-X, \-\-xattrs preserve extended attributes - \-o, \-\-owner preserve owner (super-user only) + \-o, \-\-owner preserve owner (super\-user only) \-g, \-\-group preserve group - \-\-devices preserve device files (super-user only) + \-\-devices preserve device files (super\-user only) \-\-specials preserve special files \-D same as \-\-devices \-\-specials \-t, \-\-times preserve modification times \-O, \-\-omit\-dir\-times omit directories from \-\-times - \-\-super receiver attempts super-user activities + \-\-super receiver attempts super\-user activities \-\-fake\-super store/recover privileged attrs using xattrs \-S, \-\-sparse handle sparse files efficiently \-n, \-\-dry\-run perform a trial run with no changes made - \-W, \-\-whole\-file copy files whole (w/o delta-xfer algorithm) + \-W, \-\-whole\-file copy files whole (w/o delta\-xfer algorithm) \-x, \-\-one\-file\-system don'\&t cross filesystem boundaries - \-B, \-\-block\-size=SIZE force a fixed checksum block-size + \-B, \-\-block\-size=SIZE force a fixed checksum block\-size \-e, \-\-rsh=COMMAND specify the remote shell to use \-\-rsync\-path=PROGRAM specify the rsync to run on remote machine \-\-existing skip creating new files on receiver \-\-ignore\-existing skip updating files that exist on receiver - \-\-remove\-source\-files sender removes synchronized files (non-dir) + \-\-remove\-source\-files sender removes synchronized files (non\-dir) \-\-del an alias for \-\-delete\-during \-\-delete delete extraneous files from dest dirs \-\-delete\-before receiver deletes before transfer (default) @@ -455,13 +455,13 @@ to the detailed description below for a \-\-partial keep partially transferred files \-\-partial\-dir=DIR put a partially transferred file into DIR \-\-delay\-updates put all updated files into place at end - \-m, \-\-prune\-empty\-dirs prune empty directory chains from file-list + \-m, \-\-prune\-empty\-dirs prune empty directory chains from file\-list \-\-numeric\-ids don'\&t map uid/gid values by user/group name \-\-timeout=SECONDS set I/O timeout in seconds \-\-contimeout=SECONDS set daemon connection timeout in seconds \-I, \-\-ignore\-times don'\&t skip files that match size and time \-\-size\-only skip files that match in size - \-\-modify\-window=NUM compare mod-times with reduced accuracy + \-\-modify\-window=NUM compare mod\-times with reduced accuracy \-T, \-\-temp\-dir=DIR create temporary files in directory DIR \-y, \-\-fuzzy find similar file for basis if no dest file \-\-compare\-dest=DIR also compare received files relative to DIR @@ -470,31 +470,31 @@ to the detailed description below for a \-z, \-\-compress compress file data during the transfer \-\-compress\-level=NUM explicitly set compression level \-\-skip\-compress=LIST skip compressing files with suffix in LIST - \-C, \-\-cvs\-exclude auto-ignore files in the same way CVS does - \-f, \-\-filter=RULE add a file-filtering RULE - \-F same as \-\-filter='\&dir-merge /.rsync\-filter'\& - repeated: \-\-filter='\&- .rsync\-filter'\& + \-C, \-\-cvs\-exclude auto\-ignore files in the same way CVS does + \-f, \-\-filter=RULE add a file\-filtering RULE + \-F same as \-\-filter='\&dir\-merge /.rsync\-filter'\& + repeated: \-\-filter='\&\- .rsync\-filter'\& \-\-exclude=PATTERN exclude files matching PATTERN \-\-exclude\-from=FILE read exclude patterns from FILE \-\-include=PATTERN don'\&t exclude files matching PATTERN \-\-include\-from=FILE read include patterns from FILE - \-\-files\-from=FILE read list of source-file names from FILE + \-\-files\-from=FILE read list of source\-file names from FILE \-0, \-\-from0 all *from/filter files are delimited by 0s - \-s, \-\-protect\-args no space-splitting; wildcard chars only + \-s, \-\-protect\-args no space\-splitting; wildcard chars only \-\-address=ADDRESS bind address for outgoing socket to daemon - \-\-port=PORT specify double-colon alternate port number + \-\-port=PORT specify double\-colon alternate port number \-\-sockopts=OPTIONS specify custom TCP options \-\-blocking\-io use blocking I/O for the remote shell - \-\-stats give some file-transfer stats - \-8, \-\-8\-bit\-output leave high-bit chars unescaped in output - \-h, \-\-human\-readable output numbers in a human-readable format + \-\-stats give some file\-transfer stats + \-8, \-\-8\-bit\-output leave high\-bit chars unescaped in output + \-h, \-\-human\-readable output numbers in a human\-readable format \-\-progress show progress during transfer \-P same as \-\-partial \-\-progress - \-i, \-\-itemize\-changes output a change-summary for all updates + \-i, \-\-itemize\-changes output a change\-summary for all updates \-\-out\-format=FORMAT output updates using the specified FORMAT \-\-log\-file=FILE log what we'\&re doing to the specified FILE \-\-log\-file\-format=FMT log updates using the specified FMT - \-\-password\-file=FILE read daemon-access password from FILE + \-\-password\-file=FILE read daemon\-access password from FILE \-\-list\-only list the files instead of copying them \-\-bwlimit=KBPS limit I/O bandwidth; KBytes per second \-\-write\-batch=FILE write a batched update to FILE @@ -541,7 +541,7 @@ can be used instead. .PP .IP "\fB\-\-help\fP" Print a short help page describing the options -available in rsync and exit. For backward-compatibility with older +available in rsync and exit. For backward\-compatibility with older versions of rsync, the help will also be output if you use the \fB\-h\fP option without any other args. .IP @@ -575,7 +575,7 @@ cron. .IP "\fB\-\-no\-motd\fP" This option affects the information that is output by the client at the start of a daemon transfer. This suppresses the -message-of-the-day (MOTD) text, but it also affects the list of modules +message\-of\-the\-day (MOTD) text, but it also affects the list of modules that the daemon sends in response to the \(dq\&rsync host::\(dq\& request (due to a limitation in the rsync protocol), so omit this option if you want to request the list of modules from the daemon. @@ -589,18 +589,18 @@ be updated. .IP "\fB\-\-size\-only\fP" This modifies rsync\(cq\&s \(dq\&quick check\(dq\& algorithm for finding files that need to be transferred, changing it from the default of -transferring files with either a changed size or a changed last-modified +transferring files with either a changed size or a changed last\-modified time to just looking for files that have changed in size. This is useful when starting to use rsync after using another mirroring system which may not preserve timestamps exactly. .IP .IP "\fB\-\-modify\-window\fP" When comparing two timestamps, rsync treats the -timestamps as being equal if they differ by no more than the modify-window +timestamps as being equal if they differ by no more than the modify\-window value. This is normally 0 (for an exact match), but you may find it useful to set this to a larger value in some situations. In particular, when transferring to or from an MS Windows FAT filesystem (which represents -times with a 2-second resolution), \fB\-\-modify\-window=1\fP is useful +times with a 2\-second resolution), \fB\-\-modify\-window=1\fP is useful (allowing times to differ by up to 1 second). .IP .IP "\fB\-c, \-\-checksum\fP" @@ -608,23 +608,23 @@ This changes the way rsync checks if the been changed and are in need of a transfer. Without this option, rsync uses a \(dq\&quick check\(dq\& that (by default) checks if each file\(cq\&s size and time of last modification match between the sender and receiver. This option -changes this to compare a 128-bit checksum for each file that has a +changes this to compare a 128\-bit checksum for each file that has a matching size. Generating the checksums means that both sides will expend a lot of disk I/O reading all the data in the files in the transfer (and this is prior to any reading that will be done to transfer changed files), so this can slow things down significantly. .IP -The sending side generates its checksums while it is doing the file-system +The sending side generates its checksums while it is doing the file\-system scan that builds the list of the available files. The receiver generates its checksums when it is scanning for changed files, and will checksum any file that has the same size as the corresponding sender\(cq\&s file: files with either a changed size or a changed checksum are selected for transfer. .IP Note that rsync always verifies that each \fItransferred\fP file was -correctly reconstructed on the receiving side by checking a whole-file +correctly reconstructed on the receiving side by checking a whole\-file checksum that is generated as the file is transferred, but that -automatic after-the-transfer verification has nothing to do with this -option\(cq\&s before-the-transfer \(dq\&Does this file need to be updated?\(dq\& check. +automatic after\-the\-transfer verification has nothing to do with this +option\(cq\&s before\-the\-transfer \(dq\&Does this file need to be updated?\(dq\& check. .IP For protocol 30 and beyond (first supported in 3.0.0), the checksum used is MD5. For older protocols, the checksum used is MD4. @@ -637,16 +637,16 @@ The only exception to the above equivale specified, in which case \fB\-r\fP is not implied. .IP Note that \fB\-a\fP \fBdoes not preserve hardlinks\fP, because -finding multiply-linked files is expensive. You must separately +finding multiply\-linked files is expensive. You must separately specify \fB\-H\fP. .IP .IP "\-\-no\-OPTION" You may turn off one or more implied options by prefixing -the option name with \(dq\&no-\(dq\&. Not all options may be prefixed with a \(dq\&no-\(dq\&: +the option name with \(dq\&no\-\(dq\&. Not all options may be prefixed with a \(dq\&no\-\(dq\&: only options that are implied by other options (e.g. \fB\-\-no\-D\fP, \fB\-\-no\-perms\fP) or have different defaults in various circumstances (e.g. \fB\-\-no\-whole\-file\fP, \fB\-\-no\-blocking\-io\fP, \fB\-\-no\-dirs\fP). You may -specify either the short or the long option name after the \(dq\&no-\(dq\& prefix +specify either the short or the long option name after the \(dq\&no\-\(dq\& prefix (e.g. \fB\-\-no\-R\fP is the same as \fB\-\-no\-relative\fP). .IP For example: if you want to use \fB\-a\fP (\fB\-\-archive\fP) but don\(cq\&t want @@ -655,7 +655,7 @@ could specify \fB\-a \-\-no\-o\fP (or \f .IP The order of the options is important: if you specify \fB\-\-no\-r \-a\fP, the \fB\-r\fP option would end up being turned on, the opposite of \fB\-a \-\-no\-r\fP. -Note also that the side-effects of the \fB\-\-files\-from\fP option are NOT +Note also that the side\-effects of the \fB\-\-files\-from\fP option are NOT positional, as it affects the default state of several options and slightly changes the meaning of \fB\-a\fP (see the \fB\-\-files\-from\fP option for more details). @@ -668,7 +668,7 @@ Beginning with rsync 3.0.0, the recursiv incremental scan that uses much less memory than before and begins the transfer after the scanning of the first few directories have been completed. This incremental scan only affects our recursion algorithm, and -does not change a non-recursive transfer. It is also only possible when +does not change a non\-recursive transfer. It is also only possible when both ends of the transfer are at least version 3.0.0. .IP Some options require rsync to know the full file list, so these options @@ -712,7 +712,7 @@ Beginning with rsync 3.0.0, rsync always real directories in the file list, even if a path element is really a symlink on the sending side. This prevents some really unexpected behaviors when copying the full path of a file that you didn\(cq\&t realize had -a symlink in its path. If you want to duplicate a server-side symlink, +a symlink in its path. If you want to duplicate a server\-side symlink, include both the symlink via its path, and referent directory via its real path. If you\(cq\&re dealing with an older rsync on the sending side, you may need to use the \fB\-\-no\-implied\-dirs\fP option. @@ -737,10 +737,10 @@ source path. For example, when pushing .RE .IP -(Note that the parens put the two commands into a sub-shell, so that the +(Note that the parens put the two commands into a sub\-shell, so that the \(dq\&cd\(dq\& command doesn\(cq\&t remain in effect for future commands.) If you\(cq\&re pulling files from an older rsync, use this idiom (but only -for a non-daemon transfer): +for a non\-daemon transfer): .IP .RS \f(CW rsync \-avR \-\-rsync\-path=\(dq\&cd /foo; rsync\(dq\& \e \fP @@ -759,7 +759,7 @@ created with default attributes. This e elements to have big differences, such as being a symlink to a directory on the receiving side. .IP -For instance, if a command-line arg or a files-from entry told rsync to +For instance, if a command\-line arg or a files\-from entry told rsync to transfer the file \(dq\&path/foo/file\(dq\&, the directories \(dq\&path\(dq\& and \(dq\&path/foo\(dq\& are implied when \fB\-\-relative\fP is used. If \(dq\&path/foo\(dq\& is a symlink to \(dq\&bar\(dq\& on the destination system, the receiving rsync would ordinarily @@ -783,12 +783,12 @@ backup file goes and what (if any) suffi Note that if you don\(cq\&t specify \fB\-\-backup\-dir\fP, (1) the \fB\-\-omit\-dir\-times\fP option will be implied, and (2) if \fB\-\-delete\fP is also in effect (without \fB\-\-delete\-excluded\fP), rsync will add a \(dq\&protect\(dq\& -filter-rule for the backup suffix to the end of all your existing excludes -(e.g. \fB\-f \(dq\&P *~\(dq\&\fP). This will prevent previously backed-up files from being +filter\-rule for the backup suffix to the end of all your existing excludes +(e.g. \fB\-f \(dq\&P *~\(dq\&\fP). This will prevent previously backed\-up files from being deleted. Note that if you are supplying your own filter rules, you may need to manually insert your own exclude/protect rule somewhere higher up in the list so that it has a high enough priority to be effective (e.g., if -your rules specify a trailing inclusion/exclusion of \(cq\&*\(cq\&, the auto-added +your rules specify a trailing inclusion/exclusion of \(cq\&*\(cq\&, the auto\-added rule would never be reached). .IP .IP "\fB\-\-backup\-dir=DIR\fP" @@ -799,10 +799,16 @@ specify a backup suffix using the \fB\-\ (otherwise the files backed up in the specified directory will keep their original filenames). .IP +Note that if you specify a relative path, the backup directory will be +relative to the destination directory, so you probably want to specify +either an absolute path or a path that starts with \(dq\&../\(dq\&. If an rsync +daemon is the receiver, the backup dir cannot go outside the module\(cq\&s path +hierarchy, so take extra care not to delete it or copy into it. +.IP .IP "\fB\-\-suffix=SUFFIX\fP" This option allows you to override the default backup suffix used with the \fB\-\-backup\fP (\fB\-b\fP) option. The default suffix is a ~ -if no \-\fB\-backup-dir\fP was specified, otherwise it is an empty string. +if no \-\fB\-backup\-dir\fP was specified, otherwise it is an empty string. .IP .IP "\fB\-u, \-\-update\fP" This forces rsync to skip any files which exist on @@ -818,7 +824,7 @@ where the destination has a file, the tr the timestamps. .IP This option is a transfer rule, not an exclude, so it doesn\(cq\&t affect the -data that goes into the file-lists, and thus it doesn\(cq\&t affect deletions. +data that goes into the file\-lists, and thus it doesn\(cq\&t affect deletions. It just limits the files that the receiver requests to be transferred. .IP .IP "\fB\-\-inplace\fP" @@ -827,24 +833,42 @@ its data needs to be updated: instead of a new copy of the file and moving it into place when it is complete, rsync instead writes the updated data directly to the destination file. .IP -This has several effects: (1) in-use binaries cannot be updated (either the -OS will prevent this from happening, or binaries that attempt to swap-in -their data will misbehave or crash), (2) the file\(cq\&s data will be in an -inconsistent state during the transfer, (3) a file\(cq\&s data may be left in an -inconsistent state after the transfer if the transfer is interrupted or if -an update fails, (4) a file that does not have write permissions can not be -updated, and (5) the efficiency of rsync\(cq\&s delta-transfer algorithm may be -reduced if some data in the destination file is overwritten before it can -be copied to a position later in the file (one exception to this is if you -combine this option with \fB\-\-backup\fP, since rsync is smart enough to use -the backup file as the basis file for the transfer). +This has several effects: +.IP +.RS +.IP o +Hard links are not broken. This means the new data will be visible +through other hard links to the destination file. Moreover, attempts to +copy differing source files onto a multiply\-linked destination file will +result in a \(dq\&tug of war\(dq\& with the destination data changing back and forth. +.IP o +In\-use binaries cannot be updated (either the OS will prevent this from +happening, or binaries that attempt to swap\-in their data will misbehave or +crash). +.IP o +The file\(cq\&s data will be in an inconsistent state during the transfer +and will be left that way if the transfer is interrupted or if an update +fails. +.IP o +A file that rsync cannot write to cannot be updated. While a super user +can update any file, a normal user needs to be granted write permission for +the open of the file for writing to be successful. +.IP o +The efficiency of rsync\(cq\&s delta\-transfer algorithm may be reduced if +some data in the destination file is overwritten before it can be copied to +a position later in the file. This does not apply if you use \fB\-\-backup\fP, +since rsync is smart enough to use the backup file as the basis file for the +transfer. +.RE + .IP WARNING: you should not use this option to update files that are being accessed by others, so be careful when choosing to use this for a copy. .IP -This option is useful for transferring large files with block-based changes +This option is useful for transferring large files with block\-based changes or appended data, and also on systems that are disk bound, not network -bound. +bound. It can also help keep a copy\-on\-write filesystem snapshot from +diverging the entire contents of a file that only has minor changes. .IP The option implies \fB\-\-partial\fP (since an interrupted transfer does not delete the file), but conflicts with \fB\-\-partial\-dir\fP and \fB\-\-delay\-updates\fP. @@ -857,18 +881,18 @@ the end of the file, which presumes that the receiving side is identical with the start of the file on the sending side. If a file needs to be transferred and its size on the receiver is the same or longer than the size on the sender, the file is skipped. This -does not interfere with the updating of a file\(cq\&s non-content attributes +does not interfere with the updating of a file\(cq\&s non\-content attributes (e.g. permissions, ownership, etc.) when the file does not need to be -transferred, nor does it affect the updating of any non-regular files. +transferred, nor does it affect the updating of any non\-regular files. Implies \fB\-\-inplace\fP, but does not conflict with \fB\-\-sparse\fP (since it is always extending a file\(cq\&s length). .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 +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 -final verification step fails (rsync uses a normal, non-appending +final verification step fails (rsync uses a normal, non\-appending \fB\-\-inplace\fP transfer for the resend). .IP Note: prior to rsync 3.0.0, the \fB\-\-append\fP option worked like @@ -891,8 +915,8 @@ or the \fB\-\-list\-only\fP option (incl directories are seen in the listing). Specify \fB\-\-no\-dirs\fP (or \fB\-\-no\-d\fP) if you want to turn this off. .IP -There is also a backward-compatibility helper option, \fB\-\-old\-dirs\fP (or -\fB\-\-old\-d\fP) that tells rsync to use a hack of \(dq\&-r \-\-exclude=\(cq\&/*/*\(cq\&\(dq\& to get +There is also a backward\-compatibility helper option, \fB\-\-old\-dirs\fP (or +\fB\-\-old\-d\fP) that tells rsync to use a hack of \(dq\&\-r \-\-exclude=\(cq\&/*/*\(cq\&\(dq\& to get an older rsync to list a single directory without recursing. .IP .IP "\fB\-l, \-\-links\fP" @@ -902,12 +926,12 @@ symlink on the destination. .IP "\fB\-L, \-\-copy\-links\fP" When symlinks are encountered, the item that they point to (the referent) is copied, rather than the symlink. In older -versions of rsync, this option also had the side-effect of telling the +versions of rsync, this option also had the side\-effect of telling the receiving side to follow symlinks, such as symlinks to directories. In a modern rsync such as this one, you\(cq\&ll need to specify \fB\-\-keep\-dirlinks\fP (\fB\-K\fP) to get this extra behavior. The only exception is when sending files to -an rsync that is too old to understand \fB\-K\fP \(em in that case, the \fB\-L\fP option -will still have the side-effect of \fB\-K\fP on that older receiving rsync. +an rsync that is too old to understand \fB\-K\fP \-\- in that case, the \fB\-L\fP option +will still have the side\-effect of \fB\-K\fP on that older receiving rsync. .IP .IP "\fB\-\-copy\-unsafe\-links\fP" This tells rsync to copy the referent of @@ -925,7 +949,7 @@ give unexpected results. .IP "\fB\-k, \-\-copy\-dirlinks\fP" This option causes the sending side to treat a symlink to a directory as though it were a real directory. This is -useful if you don\(cq\&t want symlinks to non-directories to be affected, as +useful if you don\(cq\&t want symlinks to non\-directories to be affected, as they would be using \fB\-\-copy\-links\fP. .IP Without this option, if the sending side has replaced a directory with a @@ -936,6 +960,20 @@ the way of the new symlink, including a See also \fB\-\-keep\-dirlinks\fP for an analogous option for the receiving side. .IP +\fB\-\-copy\-dirlinks\fP applies to all symlinks to directories in the source. If +you want to follow only a few specified symlinks, a trick you can use is to +pass them as additional source args with a trailing slash, using \fB\-\-relative\fP +to make the paths match up right. For example: +.IP +.RS +\f(CWrsync \-r \-\-relative src/./ src/./follow\-me/ dest/\fP +.RE + +.IP +This works because rsync calls \fBlstat\fP(2) on the source arg as given, and the +trailing slash makes \fBlstat\fP(2) follow the symlink, giving rise to a directory +in the file\-list which overrides the symlink found during the scan of \(dq\&src/./\(dq\&. +.IP .IP "\fB\-K, \-\-keep\-dirlinks\fP" This option causes the receiving side to treat a symlink to a directory as though it were a real directory, but only if it @@ -960,21 +998,32 @@ to modify your receiving hierarchy. See also \fB\-\-copy\-dirlinks\fP for an analogous option for the sending side. .IP .IP "\fB\-H, \-\-hard\-links\fP" -This tells rsync to look for hard-linked files in -the transfer and link together the corresponding files on the receiving -side. Without this option, hard-linked files in the transfer are treated +This tells rsync to look for hard\-linked files in +the source and link together the corresponding files on the destination. +Without this option, hard\-linked files in the source are treated as though they were separate files. .IP -When you are updating a non-empty destination, this option only ensures -that files that are hard-linked together on the source are hard-linked -together on the destination. It does NOT currently endeavor to break -already existing hard links on the destination that do not exist between -the source files. Note, however, that if one or more extra-linked files -have content changes, they will become unlinked when updated (assuming you -are not using the \fB\-\-inplace\fP option). +This option does NOT necessarily ensure that the pattern of hard links on the +destination exactly matches that on the source. Cases in which the +destination may end up with extra hard links include the following: +.IP +.RS +.IP o +If the destination contains extraneous hard\-links (more linking than +what is present in the source file list), the copying algorithm will not +break them explicitly. However, if one or more of the paths have content +differences, the normal file\-update process will break those extra links +(unless you are using the \fB\-\-inplace\fP option). +.IP o +If you specify a \fB\-\-link\-dest\fP directory that contains hard links, +the linking of the destination files against the \fB\-\-link\-dest\fP files can +cause some paths in the destination to become linked together due to the +\fB\-\-link\-dest\fP associations. +.RE + .IP Note that rsync can only detect hard links between files that are inside -the transfer set. If rsync updates a file that has extra hard-link +the transfer set. If rsync updates a file that has extra hard\-link connections to files outside the transfer, that linkage will be broken. If you are tempted to use the \fB\-\-inplace\fP option to avoid this breakage, be very careful that you know how your files are being updated so that you are @@ -982,9 +1031,12 @@ certain that no unintended changes happe see the \fB\-\-inplace\fP option for more caveats). .IP If incremental recursion is active (see \fB\-\-recursive\fP), rsync may transfer -a missing hard-linked file before it finds that another link for that contents +a missing hard\-linked file before it finds that another link for that contents exists elsewhere in the hierarchy. This does not affect the accuracy of -the transfer, just its efficiency. One way to avoid this is to disable +the transfer (i.e. which files are hard\-linked together), just its efficiency +(i.e. copying the data for a new, early copy of a hard\-linked file that could +have been found later in the transfer in another member of the hard\-linked +set of files). One way to avoid this inefficiency is to disable incremental recursion using the \fB\-\-no\-inc\-recursive\fP option. .IP .IP "\fB\-p, \-\-perms\fP" @@ -1011,14 +1063,14 @@ directory inherits a setgid bit from its .IP Thus, when \fB\-\-perms\fP and \fB\-\-executability\fP are both disabled, -rsync\(cq\&s behavior is the same as that of other file-copy utilities, +rsync\(cq\&s behavior is the same as that of other file\-copy utilities, such as \fBcp\fP(1) and \fBtar\fP(1). .IP In summary: to give destination files (both old and new) the source -permissions, use \fB\-\-perms\fP. To give new files the destination-default +permissions, use \fB\-\-perms\fP. To give new files the destination\-default permissions (while leaving existing files unchanged), make sure that the \fB\-\-perms\fP option is off and use \fB\-\-chmod=ugo=rwX\fP (which ensures that -all non-masked bits get enabled). If you\(cq\&d care to make this latter +all non\-masked bits get enabled). If you\(cq\&d care to make this latter behavior easier to type, you could define a popt alias for it, such as putting this line in the file ~/.popt (the following defines the \fB\-Z\fP option, and includes \-\-no\-g to use the default group of the destination dir): @@ -1035,22 +1087,22 @@ You could then use this new option in a .RE .IP -(Caveat: make sure that \fB\-a\fP does not follow \fB\-Z\fP, or it will re-enable +(Caveat: make sure that \fB\-a\fP does not follow \fB\-Z\fP, or it will re\-enable the two \(dq\&\-\-no\-*\(dq\& options mentioned above.) .IP -The preservation of the destination\(cq\&s setgid bit on newly-created +The preservation of the destination\(cq\&s setgid bit on newly\-created directories when \fB\-\-perms\fP is off was added in rsync 2.6.7. Older rsync versions erroneously preserved the three special permission bits for -newly-created files when \fB\-\-perms\fP was off, while overriding the -destination\(cq\&s setgid bit setting on a newly-created directory. Default ACL +newly\-created files when \fB\-\-perms\fP was off, while overriding the +destination\(cq\&s setgid bit setting on a newly\-created directory. Default ACL observance was added to the ACL patch for rsync 2.6.7, so older (or -non-ACL-enabled) rsyncs use the umask even if default ACLs are present. +non\-ACL\-enabled) rsyncs use the umask even if default ACLs are present. (Keep in mind that it is the version of the receiving rsync that affects these behaviors.) .IP .IP "\fB\-E, \-\-executability\fP" This option causes rsync to preserve the -executability (or non-executability) of regular files when \fB\-\-perms\fP is +executability (or non\-executability) of regular files when \fB\-\-perms\fP is not enabled. A regular file is considered to be executable if at least one \(cq\&x\(cq\& is turned on in its permissions. When an existing destination file\(cq\&s executability differs from that of the corresponding source file, rsync @@ -1058,7 +1110,7 @@ modifies the destination file\(cq\&s per .IP .RS .IP o -To make a file non-executable, rsync turns off all its \(cq\&x\(cq\& +To make a file non\-executable, rsync turns off all its \(cq\&x\(cq\& permissions. .IP o To make a file executable, rsync turns on each \(cq\&x\(cq\& permission that @@ -1078,17 +1130,21 @@ option to work properly. See the \fB\-\ and restore ACLs that are not compatible. .IP .IP "\fB\-X, \-\-xattrs\fP" -This option causes rsync to update the remote -extended attributes to be the same as the local ones. +This option causes rsync to update the destination +extended attributes to be the same as the source ones. .IP -For systems that support extended-attribute namespaces, a copy being done by a -super-user copies all namespaces except system.*. A normal user only copies -the user.* namespace. To be able to backup and restore non-user namespaces as +For systems that support extended\-attribute namespaces, a copy being done by a +super\-user copies all namespaces except system.*. A normal user only copies +the user.* namespace. To be able to backup and restore non\-user namespaces as a normal user, see the \fB\-\-fake\-super\fP option. .IP +Note that this option does not copy rsyncs special xattr values (e.g. those +used by \fB\-\-fake\-super\fP) unless you repeat the option (e.g. \-XX). This +\(dq\© all xattrs\(dq\& mode cannot be used with \fB\-\-fake\-super\fP. +.IP .IP "\fB\-\-chmod\fP" This option tells rsync to apply one or more -comma-separated \(dq\&chmod\(dq\& strings to the permission of the files in the +comma\-separated \(dq\&chmod\(dq\& strings to the permission of the files in the transfer. The resulting value is treated as though it were the permissions that the sending side supplied for the file, which means that this option can seem to have no effect on existing files if \fB\-\-perms\fP is not enabled. @@ -1096,10 +1152,13 @@ can seem to have no effect on existing f In addition to the normal parsing rules specified in the \fBchmod\fP(1) manpage, you can specify an item that should only apply to a directory by prefixing it with a \(cq\&D\(cq\&, or specify an item that should only apply to a -file by prefixing it with a \(cq\&F\(cq\&. For example: +file by prefixing it with a \(cq\&F\(cq\&. For example, the following will ensure +that all directories get marked set\-gid, that no files are other\-writable, +that both are user\-writable and group\-writable, and that both have +consistent executability across all bits: .IP .RS -\-\-chmod=Dg+s,ug+w,Fo-w,+X +\-\-chmod=Dg+s,ug+w,Fo\-w,+X .RE .IP @@ -1112,7 +1171,7 @@ permission value can be applied to the f .IP "\fB\-o, \-\-owner\fP" This option causes rsync to set the owner of the destination file to be the same as the source file, but only if the -receiving rsync is being run as the super-user (see also the \fB\-\-super\fP +receiving rsync is being run as the super\-user (see also the \fB\-\-super\fP and \fB\-\-fake\-super\fP options). Without this option, the owner of new and/or transferred files are set to the invoking user on the receiving side. @@ -1124,7 +1183,7 @@ may fall back to using the ID number in .IP "\fB\-g, \-\-group\fP" This option causes rsync to set the group of the destination file to be the same as the source file. If the receiving -program is not running as the super-user (or if \fB\-\-no\-super\fP was +program is not running as the super\-user (or if \fB\-\-no\-super\fP was specified), only groups that the invoking user on the receiving side is a member of will be preserved. Without this option, the group is set to the default group of the invoking @@ -1138,7 +1197,7 @@ default, but may fall back to using the This option causes rsync to transfer character and block device files to the remote system to recreate these devices. This option has no effect if the receiving rsync is not run as the -super-user (see also the \fB\-\-super\fP and \fB\-\-fake\-super\fP options). +super\-user (see also the \fB\-\-super\fP and \fB\-\-fake\-super\fP options). .IP .IP "\fB\-\-specials\fP" This option causes rsync to transfer special files @@ -1153,7 +1212,7 @@ with the files and update them on the re option is not used, the optimization that excludes files that have not been modified cannot be effective; in other words, a missing \fB\-t\fP or \fB\-a\fP will cause the next transfer to behave as if it used \fB\-I\fP, causing all files to be -updated (though rsync\(cq\&s delta-transfer algorithm will make the update fairly efficient +updated (though rsync\(cq\&s delta\-transfer algorithm will make the update fairly efficient if the files haven\(cq\&t actually changed, you\(cq\&re much better off using \fB\-t\fP). .IP .IP "\fB\-O, \-\-omit\-dir\-times\fP" @@ -1163,34 +1222,34 @@ the directories on the receiving side, i This option is inferred if you use \fB\-\-backup\fP without \fB\-\-backup\-dir\fP. .IP .IP "\fB\-\-super\fP" -This tells the receiving side to attempt super-user -activities even if the receiving rsync wasn\(cq\&t run by the super-user. These +This tells the receiving side to attempt super\-user +activities even if the receiving rsync wasn\(cq\&t run by the super\-user. These activities include: preserving users via the \fB\-\-owner\fP option, preserving all groups (not just the current user\(cq\&s groups) via the \fB\-\-groups\fP option, and copying devices via the \fB\-\-devices\fP option. This is useful -for systems that allow such activities without being the super-user, and +for systems that allow such activities without being the super\-user, and also for ensuring that you will get errors if the receiving side isn\(cq\&t -being run as the super-user. To turn off super-user activities, the -super-user can use \fB\-\-no\-super\fP. +being run as the super\-user. To turn off super\-user activities, the +super\-user can use \fB\-\-no\-super\fP. .IP .IP "\fB\-\-fake\-super\fP" When this option is enabled, rsync simulates -super-user activities by saving/restoring the privileged attributes via +super\-user activities by saving/restoring the privileged attributes via special extended attributes that are attached to each file (as needed). This includes the file\(cq\&s owner and group (if it is not the default), the file\(cq\&s device info (device & special files are created as empty text files), and any permission bits that we won\(cq\&t allow to be set on the real file (e.g. -the real file gets u-s,g-s,o-t for safety) or that would limit the owner\(cq\&s -access (since the real super-user can always access/change a file, the +the real file gets u\-s,g\-s,o\-t for safety) or that would limit the owner\(cq\&s +access (since the real super\-user can always access/change a file, the files we create can always be accessed/changed by the creating user). -This option also handles ACLs (if \fB\-\-acls\fP was specified) and non-user +This option also handles ACLs (if \fB\-\-acls\fP was specified) and non\-user extended attributes (if \fB\-\-xattrs\fP was specified). .IP -This is a good way to backup data without using a super-user, and to store +This is a good way to backup data without using a super\-user, and to store ACLs from incompatible systems. .IP The \fB\-\-fake\-super\fP option only affects the side where the option is used. -To affect the remote side of a remote-shell connection, specify an rsync +To affect the remote side of a remote\-shell connection, specify an rsync path: .IP .RS @@ -1213,10 +1272,6 @@ Try to handle sparse files efficiently s up less space on the destination. Conflicts with \fB\-\-inplace\fP because it\(cq\&s not possible to overwrite data in a sparse fashion. .IP -NOTE: Don\(cq\&t use this option when the destination is a Solaris \(dq\&tmpfs\(dq\& -filesystem. It seems to have problems seeking over null regions, -and ends up corrupting the files. -.IP .IP "\fB\-n, \-\-dry\-run\fP" This makes rsync perform a trial run that doesn\(cq\&t make any changes (and produces mostly the same output as a real run). It @@ -1234,13 +1289,13 @@ statistics are too small, and the \(dq\& where no file transfers were needed. .IP .IP "\fB\-W, \-\-whole\-file\fP" -With this option rsync\(cq\&s delta-transfer algorithm -is not used and the whole file is sent as-is instead. The transfer may be +With this option rsync\(cq\&s delta\-transfer algorithm +is not used and the whole file is sent as\-is instead. The transfer may be faster if this option is used when the bandwidth between the source and destination machines is higher than the bandwidth to disk (especially when the \(dq\&disk\(dq\& is actually a networked filesystem). This is the default when both the source and destination are specified as local paths, but only if no -batch-writing option is in effect. +batch\-writing option is in effect. .IP .IP "\fB\-x, \-\-one\-file\-system\fP" This tells rsync to avoid crossing a @@ -1251,14 +1306,14 @@ the analogous recursion on the receiving in mind that rsync treats a \(dq\&bind\(dq\& mount to the same device as being on the same filesystem. .IP -If this option is repeated, rsync omits all mount-point directories from -the copy. Otherwise, it includes an empty directory at each mount-point it +If this option is repeated, rsync omits all mount\-point directories from +the copy. Otherwise, it includes an empty directory at each mount\-point it encounters (using the attributes of the mounted directory because those of -the underlying mount-point directory are inaccessible). +the underlying mount\-point directory are inaccessible). .IP If rsync has been told to collapse symlinks (via \fB\-\-copy\-links\fP or \fB\-\-copy\-unsafe\-links\fP), a symlink to a directory on another device is -treated like a mount-point. Symlinks to non-directories are unaffected +treated like a mount\-point. Symlinks to non\-directories are unaffected by this option. .IP .IP "\fB\-\-existing, \-\-ignore\-non\-existing\fP" @@ -1269,7 +1324,7 @@ combined with the \fB\-\-ignore\-existin (which can be useful if all you want to do is delete extraneous files). .IP This option is a transfer rule, not an exclude, so it doesn\(cq\&t affect the -data that goes into the file-lists, and thus it doesn\(cq\&t affect deletions. +data that goes into the file\-lists, and thus it doesn\(cq\&t affect deletions. It just limits the files that the receiver requests to be transferred. .IP .IP "\fB\-\-ignore\-existing\fP" @@ -1278,20 +1333,20 @@ already exist on the destination (this d directories, or nothing would get done). See also \fB\-\-existing\fP. .IP This option is a transfer rule, not an exclude, so it doesn\(cq\&t affect the -data that goes into the file-lists, and thus it doesn\(cq\&t affect deletions. +data that goes into the file\-lists, and thus it doesn\(cq\&t affect deletions. It just limits the files that the receiver requests to be transferred. .IP This option can be useful for those doing backups using the \fB\-\-link\-dest\fP option when they need to continue a backup run that got interrupted. Since a \fB\-\-link\-dest\fP run is copied into a new directory hierarchy (when it is used properly), using \fB\-\-ignore existing\fP will ensure that the -already-handled files don\(cq\&t get tweaked (which avoids a change in -permissions on the hard-linked files). This does mean that this option +already\-handled files don\(cq\&t get tweaked (which avoids a change in +permissions on the hard\-linked files). This does mean that this option is only looking at the existing files in the destination hierarchy itself. .IP .IP "\fB\-\-remove\-source\-files\fP" This tells rsync to remove from the sending -side the files (meaning non-directories) that are a part of the transfer +side the files (meaning non\-directories) that are a part of the transfer and have been successfully duplicated on the receiving side. .IP .IP "\fB\-\-delete\fP" @@ -1328,29 +1383,29 @@ the \fB\-\-delete\-before\fP algorithm w \fB\-\-delete\-delay\fP and \fB\-\-delete\-after\fP. .IP .IP "\fB\-\-delete\-before\fP" -Request that the file-deletions on the receiving +Request that the file\-deletions on the receiving side be done before the transfer starts. -See \fB\-\-delete\fP (which is implied) for more details on file-deletion. +See \fB\-\-delete\fP (which is implied) for more details on file\-deletion. .IP Deleting before the transfer is helpful if the filesystem is tight for space and removing extraneous files would help to make the transfer possible. However, it does introduce a delay before the start of the transfer, and this delay might cause the transfer to timeout (if \fB\-\-timeout\fP was -specified). It also forces rsync to use the old, non-incremental recursion +specified). It also forces rsync to use the old, non\-incremental recursion algorithm that requires rsync to scan all the files in the transfer into memory at once (see \fB\-\-recursive\fP). .IP .IP "\fB\-\-delete\-during, \-\-del\fP" -Request that the file-deletions on the +Request that the file\-deletions on the receiving side be done incrementally as the transfer happens. The -per-directory delete scan is done right before each directory is checked +per\-directory delete scan is done right before each directory is checked for updates, so it behaves like a more efficient \fB\-\-delete\-before\fP, -including doing the deletions prior to any per-directory filter files +including doing the deletions prior to any per\-directory filter files being updated. This option was first added in rsync version 2.6.4. -See \fB\-\-delete\fP (which is implied) for more details on file-deletion. +See \fB\-\-delete\fP (which is implied) for more details on file\-deletion. .IP .IP "\fB\-\-delete\-delay\fP" -Request that the file-deletions on the receiving +Request that the file\-deletions on the receiving side be computed during the transfer (like \fB\-\-delete\-during\fP), and then removed after the transfer completes. This is useful when combined with \fB\-\-delay\-updates\fP and/or \fB\-\-fuzzy\fP, and is more efficient than using @@ -1362,17 +1417,17 @@ is removed while open, so you shouldn\(c the creation of the temporary file fails, rsync will try to fall back to using \fB\-\-delete\-after\fP (which it cannot do if \fB\-\-recursive\fP is doing an incremental scan). -See \fB\-\-delete\fP (which is implied) for more details on file-deletion. +See \fB\-\-delete\fP (which is implied) for more details on file\-deletion. .IP .IP "\fB\-\-delete\-after\fP" -Request that the file-deletions on the receiving +Request that the file\-deletions on the receiving side be done after the transfer has completed. This is useful if you -are sending new per-directory merge files as a part of the transfer and +are sending new per\-directory merge files as a part of the transfer and you want their exclusions to take effect for the delete phase of the -current transfer. It also forces rsync to use the old, non-incremental +current transfer. It also forces rsync to use the old, non\-incremental recursion algorithm that requires rsync to scan all the files in the transfer into memory at once (see \fB\-\-recursive\fP). -See \fB\-\-delete\fP (which is implied) for more details on file-deletion. +See \fB\-\-delete\fP (which is implied) for more details on file\-deletion. .IP .IP "\fB\-\-delete\-excluded\fP" In addition to deleting the files on the @@ -1381,19 +1436,19 @@ delete any files on the receiving side t See the FILTER RULES section for a way to make individual exclusions behave this way on the receiver, and for a way to protect files from \fB\-\-delete\-excluded\fP. -See \fB\-\-delete\fP (which is implied) for more details on file-deletion. +See \fB\-\-delete\fP (which is implied) for more details on file\-deletion. .IP .IP "\fB\-\-ignore\-errors\fP" Tells \fB\-\-delete\fP to go ahead and delete files even when there are I/O errors. .IP .IP "\fB\-\-force\fP" -This option tells rsync to delete a non-empty directory -when it is to be replaced by a non-directory. This is only relevant if +This option tells rsync to delete a non\-empty directory +when it is to be replaced by a non\-directory. This is only relevant if deletions are not active (see \fB\-\-delete\fP for details). .IP Note for older rsync versions: \fB\-\-force\fP used to still be required when -using \fB\-\-delete\-after\fP, and it used to be non-functional unless the +using \fB\-\-delete\-after\fP, and it used to be non\-functional unless the \fB\-\-recursive\fP option was also enabled. .IP .IP "\fB\-\-max\-delete=NUM\fP" @@ -1405,7 +1460,7 @@ Also new for version 3.0.0, you may spec about any extraneous files in the destination without removing any of them. Older clients interpreted this as \(dq\&unlimited\(dq\&, so if you don\(cq\&t know what version the client is, you can use the less obvious \fB\-\-max\-delete=\-1\fP as -a backward-compatible way to specify that no deletions be allowed (though +a backward\-compatible way to specify that no deletions be allowed (though older versions didn\(cq\&t warn when the limit was exceeded). .IP .IP "\fB\-\-max\-size=SIZE\fP" @@ -1415,14 +1470,14 @@ suffixed with a string to indicate a siz may be a fractional value (e.g. \(dq\&\fB\-\-max\-size=1.5m\fP\(dq\&). .IP This option is a transfer rule, not an exclude, so it doesn\(cq\&t affect the -data that goes into the file-lists, and thus it doesn\(cq\&t affect deletions. +data that goes into the file\-lists, and thus it doesn\(cq\&t affect deletions. It just limits the files that the receiver requests to be transferred. .IP The suffixes are as follows: \(dq\&K\(dq\& (or \(dq\&KiB\(dq\&) is a kibibyte (1024), \(dq\&M\(dq\& (or \(dq\&MiB\(dq\&) is a mebibyte (1024*1024), and \(dq\&G\(dq\& (or \(dq\&GiB\(dq\&) is a gibibyte (1024*1024*1024). If you want the multiplier to be 1000 instead of 1024, use \(dq\&KB\(dq\&, -\(dq\&MB\(dq\&, or \(dq\&GB\(dq\&. (Note: lower-case is also accepted for all values.) +\(dq\&MB\(dq\&, or \(dq\&GB\(dq\&. (Note: lower\-case is also accepted for all values.) Finally, if the suffix ends in either \(dq\&+1\(dq\& or \(dq\&\-1\(dq\&, the value will be offset by one byte in the indicated direction. .IP @@ -1437,7 +1492,7 @@ See the \fB\-\-max\-size\fP option for a .IP .IP "\fB\-B, \-\-block\-size=BLOCKSIZE\fP" This forces the block size used in -rsync\(cq\&s delta-transfer algorithm to a fixed value. It is normally selected based on +rsync\(cq\&s delta\-transfer algorithm to a fixed value. It is normally selected based on the size of each file being updated. See the technical report for details. .IP .IP "\fB\-e, \-\-rsh=COMMAND\fP" @@ -1451,15 +1506,15 @@ remote shell \fICOMMAND\fP will be used remote host, and all data will be transmitted through that remote shell connection, rather than through a direct socket connection to a running rsync daemon on the remote host. See the section \(dq\&USING -RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION\(dq\& above. +RSYNC\-DAEMON FEATURES VIA A REMOTE\-SHELL CONNECTION\(dq\& above. .IP -Command-line arguments are permitted in COMMAND provided that COMMAND is +Command\-line arguments are permitted in COMMAND provided that COMMAND is presented to rsync as a single argument. You must use spaces (not tabs or other whitespace) to separate the command and args from each other, -and you can use single- and/or double-quotes to preserve spaces in an -argument (but not backslashes). Note that doubling a single-quote -inside a single-quoted string gives you a single-quote; likewise for -double-quotes (though you need to pay attention to which quotes your +and you can use single\- and/or double\-quotes to preserve spaces in an +argument (but not backslashes). Note that doubling a single\-quote +inside a single\-quoted string gives you a single\-quote; likewise for +double\-quotes (though you need to pay attention to which quotes your shell is parsing and which quotes rsync is parsing). Some examples: .IP .RS @@ -1470,7 +1525,7 @@ shell is parsing and which quotes rsync .RE .IP -(Note that ssh users can alternately customize site-specific connect +(Note that ssh users can alternately customize site\-specific connect options in their .ssh/config file.) .IP You can also choose the remote shell program using the RSYNC_RSH @@ -1480,11 +1535,11 @@ See also the \fB\-\-blocking\-io\fP opti .IP .IP "\fB\-\-rsync\-path=PROGRAM\fP" Use this to specify what program is to be run -on the remote machine to start-up rsync. Often used when rsync is not in -the default remote-shell\(cq\&s path (e.g. \-\-rsync\-path=/usr/local/bin/rsync). +on the remote machine to start\-up rsync. Often used when rsync is not in +the default remote\-shell\(cq\&s path (e.g. \-\-rsync\-path=/usr/local/bin/rsync). Note that PROGRAM is run with the help of a shell, so it can be any program, script, or command sequence you\(cq\&d care to run, so long as it does -not corrupt the standard-in & standard-out that rsync is using to +not corrupt the standard\-in & standard\-out that rsync is using to communicate. .IP One tricky example is to set a different default directory on the remote @@ -1502,13 +1557,13 @@ systems. It uses a similar algorithm to a file should be ignored. .IP The exclude list is initialized to exclude the following items (these -initial items are marked as perishable \(em see the FILTER RULES section): +initial items are marked as perishable \-\- see the FILTER RULES section): .IP .RS .RS \f(CWRCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state \&.nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del\-* -*.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/\fP +*.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .hg/ .bzr/\fP .RE .RE @@ -1524,14 +1579,14 @@ See the \fBcvs\fP(1) manual for more inf .IP If you\(cq\&re combining \fB\-C\fP with your own \fB\-\-filter\fP rules, you should note that these CVS excludes are appended at the end of your own rules, -regardless of where the \fB\-C\fP was placed on the command-line. This makes them +regardless of where the \fB\-C\fP was placed on the command\-line. This makes them a lower priority than any rules you specified explicitly. If you want to control where these CVS excludes get inserted into your filter rules, you -should omit the \fB\-C\fP as a command-line option and use a combination of -\fB\-\-filter=:C\fP and \fB\-\-filter=\-C\fP (either on your command-line or by -putting the \(dq\&:C\(dq\& and \(dq\&-C\(dq\& rules into a filter file with your other rules). -The first option turns on the per-directory scanning for the .cvsignore -file. The second option does a one-time import of the CVS excludes +should omit the \fB\-C\fP as a command\-line option and use a combination of +\fB\-\-filter=:C\fP and \fB\-\-filter=\-C\fP (either on your command\-line or by +putting the \(dq\&:C\(dq\& and \(dq\&\-C\(dq\& rules into a filter file with your other rules). +The first option turns on the per\-directory scanning for the .cvsignore +file. The second option does a one\-time import of the CVS excludes mentioned above. .IP .IP "\fB\-f, \-\-filter=RULE\fP" @@ -1556,7 +1611,7 @@ your command. The first time it is used .RE .IP -This tells rsync to look for per-directory .rsync\-filter files that have +This tells rsync to look for per\-directory .rsync\-filter files that have been sprinkled through the hierarchy and use their rules to filter the files in the transfer. If \fB\-F\fP is repeated, it is a shorthand for this rule: @@ -1574,7 +1629,7 @@ work. .IP "\fB\-\-exclude=PATTERN\fP" This option is a simplified form of the \fB\-\-filter\fP option that defaults to an exclude rule and does not allow -the full rule-parsing syntax of normal filter rules. +the full rule\-parsing syntax of normal filter rules. .IP See the FILTER RULES section for detailed information on this option. .IP @@ -1587,7 +1642,7 @@ If \fIFILE\fP is \fB\-\fP, the list will .IP "\fB\-\-include=PATTERN\fP" This option is a simplified form of the \fB\-\-filter\fP option that defaults to an include rule and does not allow -the full rule-parsing syntax of normal filter rules. +the full rule\-parsing syntax of normal filter rules. .IP See the FILTER RULES section for detailed information on this option. .IP @@ -1616,15 +1671,15 @@ them (use \fB\-\-no\-dirs\fP or \fB\-\-n The \fB\-\-archive\fP (\fB\-a\fP) option\(cq\&s behavior does not imply \fB\-\-recursive\fP (\fB\-r\fP), so specify it explicitly, if you want it. .IP o -These side-effects change the default state of rsync, so the position -of the \fB\-\-files\-from\fP option on the command-line has no bearing on how +These side\-effects change the default state of rsync, so the position +of the \fB\-\-files\-from\fP option on the command\-line has no bearing on how other options are parsed (e.g. \fB\-a\fP works the same before or after \fB\-\-files\-from\fP, as does \fB\-\-no\-R\fP and all other options). .RE .IP The filenames that are read from the FILE are all relative to the -source dir \(em any leading slashes are removed and no \(dq\&..\(dq\& references are +source dir \-\- any leading slashes are removed and no \(dq\&..\(dq\& references are allowed to go higher than the source dir. For example, take this command: .IP @@ -1637,18 +1692,18 @@ If /tmp/foo contains the string \(dq\&bi directory will be created as /backup/bin on the remote host. If it contains \(dq\&bin/\(dq\& (note the trailing slash), the immediate contents of the directory would also be sent (without needing to be explicitly -mentioned in the file \(em this began in version 2.6.4). In both cases, +mentioned in the file \-\- this began in version 2.6.4). In both cases, if the \fB\-r\fP option was enabled, that dir\(cq\&s entire hierarchy would also be transferred (keep in mind that \fB\-r\fP needs to be specified explicitly with \fB\-\-files\-from\fP, since it is not implied by \fB\-a\fP). Also note that the effect of the (enabled by default) \fB\-\-relative\fP option is to -duplicate only the path info that is read from the file \(em it does not -force the duplication of the source-spec path (/usr in this case). +duplicate only the path info that is read from the file \-\- it does not +force the duplication of the source\-spec path (/usr in this case). .IP In addition, the \fB\-\-files\-from\fP file can be read from the remote host instead of the local host if you specify a \(dq\&host:\(dq\& in front of the file -(the host must match one end of the transfer). As a short-cut, you can +(the host must match one end of the transfer). As a short\-cut, you can specify just a prefix of \(dq\&:\(dq\& to mean \(dq\&use the remote end of the transfer\(dq\&. For example: .IP @@ -1657,7 +1712,7 @@ transfer\(dq\&. For example: .RE .IP -This would copy all the files specified in the /path/file-list file that +This would copy all the files specified in the /path/file\-list file that was located on the remote \(dq\&src\(dq\& host. .IP If the \fB\-\-iconv\fP and \fB\-\-protect\-args\fP options are specified and the @@ -1665,6 +1720,12 @@ If the \fB\-\-iconv\fP and \fB\-\-protec filenames will be translated from the sending host\(cq\&s charset to the receiving host\(cq\&s charset. .IP +NOTE: sorting the list of files in the \-\-files\-from input helps rsync to be +more efficient, as it will avoid re\-visiting the path elements that are shared +between adjacent entries. If the input is not sorted, some path elements +(implied directories) may end up being scanned multiple times, and rsync will +eventually unduplicate them after they get turned into file\-list elements. +.IP .IP "\fB\-0, \-\-from0\fP" This tells rsync that the rules/filenames it reads from a file are terminated by a null (\(cq\&\e0\(cq\&) character, not a NL, CR, or CR+LF. @@ -1676,14 +1737,14 @@ file are split on whitespace). .IP "\fB\-s, \-\-protect\-args\fP" This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This -means that spaces are not split in names, and any non-wildcard special +means that spaces are not split in names, and any non\-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it). .IP If you use this option with \fB\-\-iconv\fP, the args related to the remote side will also be translated -from the local to the remote character-set. The translation happens before -wild-cards are expanded. See also the \fB\-\-files\-from\fP option. +from the local to the remote character\-set. The translation happens before +wild\-cards are expanded. See also the \fB\-\-files\-from\fP option. .IP .IP "\fB\-T, \-\-temp\-dir=DIR\fP" This option instructs rsync to use DIR as a @@ -1714,19 +1775,19 @@ partition, another way to tell rsync tha about disk space is to use the \fB\-\-partial\-dir\fP option with a relative path; because this tells rsync that it is OK to stash off a copy of a single file in a subdir in the destination hierarchy, rsync will use the -partial-dir as a staging area to bring over the copied file, and then +partial\-dir as a staging area to bring over the copied file, and then rename it into place from there. (Specifying a \fB\-\-partial\-dir\fP with -an absolute path does not have this side-effect.) +an absolute path does not have this side\-effect.) .IP .IP "\fB\-y, \-\-fuzzy\fP" This option tells rsync that it should look for a basis file for any destination file that is missing. The current algorithm looks in the same directory as the destination file for either a file that -has an identical size and modified-time, or a similarly-named file. If +has an identical size and modified\-time, or a similarly\-named file. If found, rsync uses the fuzzy basis file to try to speed up the transfer. .IP Note that the use of the \fB\-\-delete\fP option might get rid of any potential -fuzzy-match files, so either use \fB\-\-delete\-after\fP or specify some +fuzzy\-match files, so either use \fB\-\-delete\-after\fP or specify some filename exclusions if you need to prevent this. .IP .IP "\fB\-\-compare\-dest=DIR\fP" @@ -1754,7 +1815,7 @@ This option behaves like \fB\-\-compare\ rsync will also copy unchanged files found in \fIDIR\fP to the destination directory using a local copy. This is useful for doing transfers to a new destination while leaving -existing files intact, and then doing a flash-cutover when all files have +existing files intact, and then doing a flash\-cutover when all files have been successfully transferred. .IP Multiple \fB\-\-copy\-dest\fP directories may be provided, which will cause @@ -1777,7 +1838,7 @@ An example: .RE .IP -If file\(cq\&s aren\(cq\&t linking, double-check their attributes. Also check if some +If file\(cq\&s aren\(cq\&t linking, double\-check their attributes. Also check if some attributes are getting forced outside of rsync\(cq\&s control, such a mount option that squishes root to a single user, or mounts a removable drive with generic ownership (such as OS X\(cq\&s \(dq\&Ignore ownership on this volume\(dq\& option). @@ -1791,9 +1852,9 @@ If a match is not found, a basis file fr selected to try to speed up the transfer. .IP This option works best when copying into an empty destination hierarchy, as -rsync treats existing files as definitive (so it never looks in the link-dest +rsync treats existing files as definitive (so it never looks in the link\-dest dirs when a destination file already exists), and as malleable (so it might -change the attributes of a destination file, which affects all the hard-linked +change the attributes of a destination file, which affects all the hard\-linked versions). .IP Note that if you combine this option with \fB\-\-ignore\-times\fP, rsync will not @@ -1805,14 +1866,14 @@ If \fIDIR\fP is a relative path, it is r See also \fB\-\-compare\-dest\fP and \fB\-\-copy\-dest\fP. .IP Note that rsync versions prior to 2.6.1 had a bug that could prevent -\fB\-\-link\-dest\fP from working properly for a non-super-user when \fB\-o\fP was -specified (or implied by \fB\-a\fP). You can work-around this bug by avoiding +\fB\-\-link\-dest\fP from working properly for a non\-super\-user when \fB\-o\fP was +specified (or implied by \fB\-a\fP). You can work\-around this bug by avoiding the \fB\-o\fP option when sending to an old rsync. .IP .IP "\fB\-z, \-\-compress\fP" With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data -being transmitted \(em something that is useful over a slow connection. +being transmitted \-\- something that is useful over a slow connection. .IP Note that this option typically achieves better compression ratios than can be achieved by using a compressing remote shell or a compressing transport @@ -1824,7 +1885,7 @@ that will not be compressed. .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. If NUM is non\-zero, the \fB\-\-compress\fP option is implied. .IP .IP "\fB\-\-skip\-compress=LIST\fP" @@ -1834,11 +1895,11 @@ not be compressed. The \fBLIST\fP shoul .IP You may specify an empty string to indicate that no file should be skipped. .IP -Simple character-class matching is supported: each must consist of a list +Simple character\-class matching is supported: each must consist of a list of letters inside the square brackets (e.g. no special classes, such as -\(dq\&[:alpha:]\(dq\&, are supported). +\(dq\&[:alpha:]\(dq\&, are supported, and \(cq\&\-\(cq\& has no special meaning). .IP -The characters asterisk (*) and question-mark (?) have no special meaning. +The characters asterisk (*) and question\-mark (?) have no special meaning. .IP Here\(cq\&s an example that specifies 6 suffixes to skip (since 1 of the 5 rules matches 2 suffixes): @@ -1848,17 +1909,30 @@ matches 2 suffixes): .fi .IP -The default list of suffixes that will not be compressed is this (several -of these are newly added for 3.0.0): +The default list of suffixes that will not be compressed is this (in this +version of rsync): .IP -.nf - gz/zip/z/rpm/deb/iso/bz2/t[gb]z/7z/mp[34]/mov/avi/ogg/jpg/jpeg -.fi - +\fB7z\fP +\fBavi\fP +\fBbz2\fP +\fBdeb\fP +\fBgz\fP +\fBiso\fP +\fBjpeg\fP +\fBjpg\fP +\fBmov\fP +\fBmp3\fP +\fBmp4\fP +\fBogg\fP +\fBrpm\fP +\fBtbz\fP +\fBtgz\fP +\fBz\fP +\fBzip\fP .IP This list will be replaced by your \fB\-\-skip\-compress\fP list in all but one situation: a copy from a daemon rsync will add your skipped suffixes to -its list of non-compressing files (and its list may be configured to a +its list of non\-compressing files (and its list may be configured to a different default). .IP .IP "\fB\-\-numeric\-ids\fP" @@ -1897,7 +1971,7 @@ option in the \fB\-\-daemon\fP mode sect .IP "\fB\-\-port=PORT\fP" This specifies an alternate TCP port number to use rather than the default of 873. This is only needed if you are using the -double-colon (::) syntax to connect with an rsync daemon (since the URL +double\-colon (::) syntax to connect with an rsync daemon (since the URL syntax has a way to specify the port as a part of the URL). See also this option in the \fB\-\-daemon\fP mode section. .IP @@ -1917,8 +1991,8 @@ connections to a remote rsync daemon. T This tells rsync to use blocking I/O when launching a remote shell transport. If the remote shell is either rsh or remsh, rsync defaults to using -blocking I/O, otherwise it defaults to using non-blocking I/O. (Note that -ssh prefers non-blocking I/O.) +blocking I/O, otherwise it defaults to using non\-blocking I/O. (Note that +ssh prefers non\-blocking I/O.) .IP .IP "\fB\-i, \-\-itemize\-changes\fP" Requests a simple itemized list of the @@ -1931,7 +2005,7 @@ verbose messages). .IP The \(dq\&%i\(dq\& escape has a cryptic output that is 11 letters long. The general format is like the string \fBYXcstpoguax\fP, where \fBY\fP is replaced by the -type of update being done, \fBX\fP is replaced by the file-type, and the +type of update being done, \fBX\fP is replaced by the file\-type, and the other letters represent attributes that may be output if they are being modified. .IP @@ -1954,12 +2028,12 @@ A \fBh\fP means that the item is a hard A \fB.\fP means that the item is not being updated (though it might have attributes that are being modified). .IP o -A \fB*\fP means that the rest of the itemized-output area contains +A \fB*\fP means that the rest of the itemized\-output area contains a message (e.g. \(dq\&deleting\(dq\&). .RE .IP -The file-types that replace the \fBX\fP are: \fBf\fP for a file, a \fBd\fP for a +The file\-types that replace the \fBX\fP are: \fBf\fP for a file, a \fBd\fP for a directory, an \fBL\fP for a symlink, a \fBD\fP for a device, and a \fBS\fP for a special file (e.g. named sockets and fifos). .IP @@ -1978,7 +2052,7 @@ A \fBc\fP means either that a regular fi (requires \fB\-\-checksum\fP) or that a symlink, device, or special file has a changed value. Note that if you are sending files to an rsync prior to 3.0.1, this -change flag will be present only for checksum-differing regular files. +change flag will be present only for checksum\-differing regular files. .IP o A \fBs\fP means the size of a regular file is different and will be updated by the file transfer. @@ -1989,13 +2063,13 @@ means that the modification time will be when a file/symlink/device is updated without \fB\-\-times\fP and when a symlink is changed and the receiver can\(cq\&t set its time. (Note: when using an rsync 3.0.0 client, you might see the \fBs\fP flag combined -with \fBt\fP instead of the proper \fBT\fP flag for this time-setting failure.) +with \fBt\fP instead of the proper \fBT\fP flag for this time\-setting failure.) .IP o A \fBp\fP means the permissions are different and are being updated to the sender\(cq\&s value (requires \fB\-\-perms\fP). .IP o An \fBo\fP means the owner is different and is being updated to the -sender\(cq\&s value (requires \fB\-\-owner\fP and super-user privileges). +sender\(cq\&s value (requires \fB\-\-owner\fP and super\-user privileges). .IP o A \fBg\fP means the group is different and is being updated to the sender\(cq\&s value (requires \fB\-\-group\fP and the authority to set the group). @@ -2015,8 +2089,8 @@ outputting them as a verbose message). .IP .IP "\fB\-\-out\-format=FORMAT\fP" This allows you to specify exactly what the -rsync client outputs to the user on a per-update basis. The format is a -text string containing embedded single-character escape sequences prefixed +rsync client outputs to the user on a per\-update basis. The format is a +text string containing embedded single\-character escape sequences prefixed with a percent (%) character. A default format of \(dq\&%n%L\(dq\& is assumed if \fB\-v\fP is specified (which reports the name of the file and, if the item is a link, where it points). For a full list @@ -2026,23 +2100,23 @@ rsyncd.conf manpage. Specifying the \fB\-\-out\-format\fP option will mention each file, dir, etc. that gets updated in a significant way (a transferred file, a recreated symlink/device, or a touched -directory). In addition, if the itemize-changes escape (%i) is included in +directory). In addition, if the itemize\-changes escape (%i) is included in the string (e.g. if the \fB\-\-itemize\-changes\fP option was used), the logging of names increases to mention any item that is changed in any way (as long as the receiving side is at least 2.6.4). See the \fB\-\-itemize\-changes\fP option for a description of the output of \(dq\&%i\(dq\&. .IP -Rsync will output the out-format string prior to a file\(cq\&s transfer unless -one of the transfer-statistic escapes is requested, in which case the +Rsync will output the out\-format string prior to a file\(cq\&s transfer unless +one of the transfer\-statistic escapes is requested, in which case the logging is done at the end of the file\(cq\&s transfer. When this late logging is in effect and \fB\-\-progress\fP is also specified, rsync will also output the name of the file being transferred prior to its progress information -(followed, of course, by the out-format output). +(followed, of course, by the out\-format output). .IP .IP "\fB\-\-log\-file=FILE\fP" This option causes rsync to log what it is doing to a file. This is similar to the logging that a daemon does, but can be -requested for the client side and/or the server side of a non-daemon +requested for the client side and/or the server side of a non\-daemon transfer. If specified as a client option, transfer logging will be enabled with a default format of \(dq\&%i %n%L\(dq\&. See the \fB\-\-log\-file\-format\fP option if you wish to override this. @@ -2060,7 +2134,7 @@ unexpectedly. .IP .IP "\fB\-\-log\-file\-format=FORMAT\fP" This allows you to specify exactly what -per-update logging is put into the file specified by the \fB\-\-log\-file\fP option +per\-update logging is put into the file specified by the \fB\-\-log\-file\fP option (which must also be specified for this option to have any effect). If you specify an empty string, updated files will not be mentioned in the log file. For a list of the possible escape characters, see the \(dq\&log format\(dq\& setting @@ -2071,7 +2145,7 @@ is \(cq\&%i %n%L\(cq\&. .IP .IP "\fB\-\-stats\fP" This tells rsync to print a verbose set of statistics -on the file transfer, allowing you to tell how effective rsync\(cq\&s delta-transfer +on the file transfer, allowing you to tell how effective rsync\(cq\&s delta\-transfer algorithm is for your data. .IP The current statistics are as follows: @@ -2081,7 +2155,7 @@ The current statistics are as follows: sense), which includes directories, symlinks, etc. .IP o \fBNumber of files transferred\fP is the count of normal files that -were updated via rsync\(cq\&s delta-transfer algorithm, which does not include created +were updated via rsync\(cq\&s delta\-transfer algorithm, which does not include created dirs, symlinks, etc. .IP o \fBTotal file size\fP is the total sum of all file sizes in the transfer. @@ -2091,14 +2165,14 @@ include the size of symlinks. \fBTotal transferred file size\fP is the total sum of all files sizes for just the transferred files. .IP o -\fBLiteral data\fP is how much unmatched file-update data we had to +\fBLiteral data\fP is how much unmatched file\-update data we had to send to the receiver for it to recreate the updated files. .IP o \fBMatched data\fP is how much data the receiver got locally when recreating the updated files. .IP o -\fBFile list size\fP is how big the file-list data was when the sender -sent it to the receiver. This is smaller than the in-memory size for the +\fBFile list size\fP is how big the file\-list data was when the sender +sent it to the receiver. This is smaller than the in\-memory size for the file list due to some compressing of duplicated data when rsync sends the list. .IP o @@ -2112,15 +2186,15 @@ spent sending the file list to the recei \fBTotal bytes sent\fP is the count of all the bytes that rsync sent from the client side to the server side. .IP o -\fBTotal bytes received\fP is the count of all non-message bytes that -rsync received by the client side from the server side. \(dq\&Non-message\(dq\& +\fBTotal bytes received\fP is the count of all non\-message bytes that +rsync received by the client side from the server side. \(dq\&Non\-message\(dq\& bytes means that we don\(cq\&t count the bytes for a verbose message that the server sent to us, which makes the stats more consistent. .RE .IP .IP "\fB\-8, \-\-8\-bit\-output\fP" -This tells rsync to leave all high-bit characters +This tells rsync to leave all high\-bit characters unescaped in the output instead of trying to test them to see if they\(cq\&re valid in the current locale and escaping the invalid ones. All control characters (but never tabs) are always escaped, regardless of this option\(cq\&s @@ -2132,7 +2206,7 @@ would output as \(dq\&\e#012\(dq\&. A l escaped unless it is followed by a hash and 3 digits (0\-9). .IP .IP "\fB\-h, \-\-human\-readable\fP" -Output numbers in a more human-readable format. +Output numbers in a more human\-readable format. This makes big numbers output using larger units, with a K, M, or G suffix. If this option was specified once, these units are K (1000), M (1000*1000), and G (1000*1000*1000); if the option is repeated, the units are powers of 1024 @@ -2153,39 +2227,39 @@ On the next transfer, rsync will use a f dir as data to speed up the resumption of the transfer and then delete it after it has served its purpose. .IP -Note that if \fB\-\-whole\-file\fP is specified (or implied), any partial-dir +Note that if \fB\-\-whole\-file\fP is specified (or implied), any partial\-dir file that is found for a file that is being updated will simply be removed (since -rsync is sending files without using rsync\(cq\&s delta-transfer algorithm). +rsync is sending files without using rsync\(cq\&s delta\-transfer algorithm). .IP -Rsync will create the \fIDIR\fP if it is missing (just the last dir \(em not +Rsync will create the \fIDIR\fP if it is missing (just the last dir \-\- not the whole path). This makes it easy to use a relative path (such as \(dq\&\fB\-\-partial\-dir=.rsync\-partial\fP\(dq\&) to have rsync create the -partial-directory in the destination file\(cq\&s directory when needed, and then +partial\-directory in the destination file\(cq\&s directory when needed, and then remove it again when the partial file is deleted. .IP -If the partial-dir value is not an absolute path, rsync will add an exclude +If the partial\-dir value is not an absolute path, rsync will add an exclude rule at the end of all your existing excludes. This will prevent the -sending of any partial-dir files that may exist on the sending side, and -will also prevent the untimely deletion of partial-dir items on the +sending of any partial\-dir files that may exist on the sending side, and +will also prevent the untimely deletion of partial\-dir items on the receiving side. An example: the above \fB\-\-partial\-dir\fP option would add -the equivalent of \(dq\&\fB\-f '\&-p .rsync\-partial/'\&\fP\(dq\& at the end of any other +the equivalent of \(dq\&\fB\-f '\&\-p .rsync\-partial/'\&\fP\(dq\& at the end of any other filter rules. .IP If you are supplying your own exclude rules, you may need to add your own -exclude/hide/protect rule for the partial-dir because (1) the auto-added +exclude/hide/protect rule for the partial\-dir because (1) the auto\-added rule may be ineffective at the end of your other rules, or (2) you may wish to override rsync\(cq\&s exclude choice. For instance, if you want to make -rsync clean-up any left-over partial-dirs that may be lying around, you +rsync clean\-up any left\-over partial\-dirs that may be lying around, you should specify \fB\-\-delete\-after\fP and add a \(dq\&risk\(dq\& filter rule, e.g. \fB\-f '\&R .rsync\-partial/'\&\fP. (Avoid using \fB\-\-delete\-before\fP or \fB\-\-delete\-during\fP unless you don\(cq\&t need rsync to use any of the -left-over partial-dir data during the current run.) +left\-over partial\-dir data during the current run.) .IP IMPORTANT: the \fB\-\-partial\-dir\fP should not be writable by other users or it is a security risk. E.g. AVOID \(dq\&/tmp\(dq\&. .IP -You can also set the partial-dir value the RSYNC_PARTIAL_DIR environment +You can also set the partial\-dir value the RSYNC_PARTIAL_DIR environment variable. Setting this in the environment does not force \fB\-\-partial\fP to be enabled, but rather it affects where partial files go when \fB\-\-partial\fP is specified. For instance, instead of using \fB\-\-partial\-dir=.rsync\-tmp\fP @@ -2196,7 +2270,7 @@ option does not look for this environmen specified (since \fB\-\-inplace\fP conflicts with \fB\-\-partial\-dir\fP), and (2) when \fB\-\-delay\-updates\fP was specified (see below). .IP -For the purposes of the daemon-config\(cq\&s \(dq\&refuse options\(dq\& setting, +For the purposes of the daemon\-config\(cq\&s \(dq\&refuse options\(dq\& setting, \fB\-\-partial\-dir\fP does \fInot\fP imply \fB\-\-partial\fP. This is so that a refusal of the \fB\-\-partial\fP option can be used to disallow the overwriting of destination files with a partial transfer, while still allowing the @@ -2226,14 +2300,14 @@ absolute) and (2) there are no mount points in the hierarchy (since the delayed updates will fail if they can\(cq\&t be renamed into place). .IP -See also the \(dq\&atomic-rsync\(dq\& perl script in the \(dq\&support\(dq\& subdir for an +See also the \(dq\&atomic\-rsync\(dq\& perl script in the \(dq\&support\(dq\& subdir for an update algorithm that is even more atomic (it uses \fB\-\-link\-dest\fP and a parallel hierarchy of files). .IP .IP "\fB\-m, \-\-prune\-empty\-dirs\fP" This option tells the receiving rsync to get -rid of empty directories from the file-list, including nested directories -that have no non-directory children. This is useful for avoiding the +rid of empty directories from the file\-list, including nested directories +that have no non\-directory children. This is useful for avoiding the creation of a bunch of useless directories when the sending rsync is recursively scanning a hierarchy of files using include/exclude/filter rules. @@ -2242,16 +2316,16 @@ Note that the use of transfer rules, suc not affect what goes into the file list, and thus does not leave directories empty, even if none of the files in a directory match the transfer rule. .IP -Because the file-list is actually being pruned, this option also affects +Because the file\-list is actually being pruned, this option also affects what directories get deleted when a delete is active. However, keep in mind that excluded files and directories can prevent existing items from being deleted due to an exclude both hiding source files and protecting -destination files. See the perishable filter-rule option for how to avoid +destination files. See the perishable filter\-rule option for how to avoid this. .IP -You can prevent the pruning of certain empty directories from the file-list +You can prevent the pruning of certain empty directories from the file\-list by using a global \(dq\&protect\(dq\& filter. For instance, this option would ensure -that the directory \(dq\&emptydir\(dq\& was kept in the file-list: +that the directory \(dq\&emptydir\(dq\& was kept in the file\-list: .IP .RS \-\-filter \(cq\&protect emptydir/\(cq\& @@ -2261,7 +2335,7 @@ that the directory \(dq\&emptydir\(dq\& Here\(cq\&s an example that copies all .pdf files in a hierarchy, only creating the necessary destination directories to hold the .pdf files, and ensures that any superfluous files and directories in the destination are removed -(note the hide filter of non-directories being used instead of an exclude): +(note the hide filter of non\-directories being used instead of an exclude): .IP .RS rsync \-avm \-\-del \-\-include=\(cq\&*.pdf\(cq\& \-f \(cq\&hide,! */\(cq\& src/ dest @@ -2269,8 +2343,8 @@ rsync \-avm \-\-del \-\-include=\(cq\&*. .IP If you didn\(cq\&t want to remove superfluous destination files, the more -time-honored options of \(dq\&\fB\-\-include='\&*/'\& \-\-exclude='\&*'\&\fP\(dq\& would work fine -in place of the hide-filter (if that is more natural to you). +time\-honored options of \(dq\&\fB\-\-include='\&*/'\& \-\-exclude='\&*'\&\fP\(dq\& would work fine +in place of the hide\-filter (if that is more natural to you). .IP .IP "\fB\-\-progress\fP" This option tells rsync to print information @@ -2291,7 +2365,7 @@ sender\(cq\&s file, which is being recon per second, and the transfer will finish in 4 seconds if the current rate is maintained until the end. .IP -These statistics can be misleading if rsync\(cq\&s delta-transfer algorithm is +These statistics can be misleading if rsync\(cq\&s delta\-transfer algorithm is in use. For example, if the sender\(cq\&s file consists of the basis file followed by additional data, the reported rate will probably drop dramatically when the receiver gets to the literal data, and the transfer @@ -2302,7 +2376,7 @@ When the file transfer finishes, rsync r summary line that looks like this: .IP .nf - 1238099 100% 146.38kB/s 0:00:08 (xfer#5, to-check=169/396) + 1238099 100% 146.38kB/s 0:00:08 (xfer#5, to\-check=169/396) .fi .IP @@ -2310,8 +2384,8 @@ In this example, the file was 1238099 by of transfer for the whole file was 146.38 kilobytes per second over the 8 seconds that it took to complete, it was the 5th transfer of a regular file during the current rsync session, and there are 169 more files for the -receiver to check (to see if they are up-to-date or not) remaining out of -the 396 total files in the file-list. +receiver to check (to see if they are up\-to\-date or not) remaining out of +the 396 total files in the file\-list. .IP .IP "\fB\-P\fP" The \fB\-P\fP option is equivalent to \fB\-\-partial\fP \fB\-\-progress\fP. Its @@ -2321,7 +2395,8 @@ transfer that may be interrupted. .IP "\fB\-\-password\-file\fP" This option allows you to provide a password in a file for accessing an rsync daemon. The file must not be world readable. -It should contain just the password as a single line. +It should contain just the password as the first line of the file (all +other lines are ignored). .IP This option does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell\(cq\&s documentation. @@ -2335,9 +2410,9 @@ This option will cause the source files instead of transferred. This option is inferred if there is a single source arg and no destination specified, so its main uses are: (1) to turn a copy command that includes a -destination arg into a file-listing command, or (2) to be able to specify +destination arg into a file\-listing command, or (2) to be able to specify more than one source arg (note: be sure to include the destination). -Caution: keep in mind that a source arg with a wild-card is expanded by the +Caution: keep in mind that a source arg with a wild\-card is expanded by the shell into multiple args, so it is never safe to try to list such an arg without using this option. For example: .IP @@ -2348,7 +2423,7 @@ without using this option. For example: .IP Compatibility note: when requesting a remote listing of files from an rsync that is version 2.6.3 or older, you may encounter an error if you ask for a -non-recursive listing. This is because a file listing implies the \fB\-\-dirs\fP +non\-recursive listing. This is because a file listing implies the \fB\-\-dirs\fP option w/o \fB\-\-recursive\fP, and older rsyncs don\(cq\&t have that option. To avoid this problem, either specify the \fB\-\-no\-dirs\fP option (if you don\(cq\&t need to expand a directory\(cq\&s content), or turn on recursion and exclude @@ -2378,7 +2453,7 @@ Note that you can feel free to write the media: if this media fills to capacity before the end of the transfer, you can just apply that partial transfer to the destination and repeat the whole process to get the rest of the changes (as long as you don\(cq\&t mind a -partially updated destination system while the multi-update cycle is +partially updated destination system while the multi\-update cycle is happening). .IP Also note that you only save bandwidth when pushing changes to a remote @@ -2404,21 +2479,21 @@ file (assuming you can\(cq\&t upgrade th .IP "\fB\-\-iconv=CONVERT_SPEC\fP" Rsync can convert filenames between character sets using this option. Using a CONVERT_SPEC of \(dq\&.\(dq\& tells rsync to look up -the default character-set via the locale setting. Alternately, you can +the default character\-set via the locale setting. Alternately, you can fully specify what conversion to do by giving a local and a remote charset separated by a comma in the order \fB\-\-iconv=LOCAL,REMOTE\fP, e.g. \fB\-\-iconv=utf8,iso88591\fP. This order ensures that the option will stay the same whether you\(cq\&re pushing or pulling files. -Finally, you can specify either \fB\-\-no\-iconv\fP or a CONVERT_SPEC of \(dq\&-\(dq\& +Finally, you can specify either \fB\-\-no\-iconv\fP or a CONVERT_SPEC of \(dq\&\-\(dq\& to turn off any conversion. -The default setting of this option is site-specific, and can also be +The default setting of this option is site\-specific, and can also be affected via the RSYNC_ICONV environment variable. .IP For a list of what charset names your local iconv library supports, you can run \(dq\&iconv \-\-list\(dq\&. .IP If you specify the \fB\-\-protect\-args\fP option (\fB\-s\fP), rsync will translate -the filenames you specify on the command-line that are being sent to the +the filenames you specify on the command\-line that are being sent to the remote host. See also the \fB\-\-files\-from\fP option. .IP Note that rsync does not do any conversion of names in filter files @@ -2492,7 +2567,7 @@ client version of this option (above) fo This specifies an alternate config file than the default. This is only relevant when \fB\-\-daemon\fP is specified. The default is /etc/rsyncd.conf unless the daemon is running over -a remote shell program and the remote user is not the super-user; in that case +a remote shell program and the remote user is not the super\-user; in that case the default is rsyncd.conf in the current directory (typically $HOME). .IP .IP "\fB\-\-no\-detach\fP" @@ -2512,7 +2587,7 @@ global option in the rsyncd.conf manpage .IP .IP "\fB\-\-log\-file=FILE\fP" This option tells the rsync daemon to use the -given log-file name instead of using the \(dq\&log file\(dq\& setting in the config +given log\-file name instead of using the \(dq\&log file\(dq\& setting in the config file. .IP .IP "\fB\-\-log\-file\-format=FORMAT\fP" @@ -2564,7 +2639,7 @@ filename is not skipped; if no matching filename is not skipped. .PP Rsync builds an ordered list of filter rules as specified on the -command-line. Filter rules have the following syntax: +command\-line. Filter rules have the following syntax: .PP .RS \f(CWRULE [PATTERN_OR_FILENAME]\fP @@ -2575,7 +2650,7 @@ command-line. Filter rules have the fol .PP You have your choice of using either short or long RULE names, as described -below. If you use a short-named rule, the \(cq\&,\(cq\& separating the RULE from the +below. If you use a short\-named rule, the \(cq\&,\(cq\& separating the RULE from the MODIFIERS is optional. The PATTERN or FILENAME that follows (when present) must come after either a single space or an underscore (_). Here are the available rule prefixes: @@ -2585,9 +2660,9 @@ Here are the available rule prefixes: .br \fBinclude, +\fP specifies an include pattern. .br -\fBmerge, .\fP specifies a merge-file to read for more rules. +\fBmerge, .\fP specifies a merge\-file to read for more rules. .br -\fBdir-merge, :\fP specifies a per-directory merge-file. +\fBdir\-merge, :\fP specifies a per\-directory merge\-file. .br \fBhide, H\fP specifies a pattern for hiding files from the transfer. .br @@ -2605,27 +2680,27 @@ Here are the available rule prefixes: When rules are being read from a file, empty lines are ignored, as are comment lines that start with a \(dq\&#\(dq\&. .PP -Note that the \fB\-\-include\fP/\fB\-\-exclude\fP command-line options do not allow the -full range of rule parsing as described above \(em they only allow the +Note that the \fB\-\-include\fP/\fB\-\-exclude\fP command\-line options do not allow the +full range of rule parsing as described above \-\- they only allow the specification of include/exclude patterns plus a \(dq\&!\(dq\& token to clear the list (and the normal comment parsing when rules are read from a file). If a pattern -does not begin with \(dq\&- \(dq\& (dash, space) or \(dq\&+ \(dq\& (plus, space), then the -rule will be interpreted as if \(dq\&+ \(dq\& (for an include option) or \(dq\&- \(dq\& (for +does not begin with \(dq\&\- \(dq\& (dash, space) or \(dq\&+ \(dq\& (plus, space), then the +rule will be interpreted as if \(dq\&+ \(dq\& (for an include option) or \(dq\&\- \(dq\& (for an exclude option) were prefixed to the string. A \fB\-\-filter\fP option, on the other hand, must always contain either a short or long rule name at the start of the rule. .PP Note also that the \fB\-\-filter\fP, \fB\-\-include\fP, and \fB\-\-exclude\fP options take one rule/pattern each. To add multiple ones, you can repeat the options on -the command-line, use the merge-file syntax of the \fB\-\-filter\fP option, or +the command\-line, use the merge\-file syntax of the \fB\-\-filter\fP option, or the \fB\-\-include\-from\fP/\fB\-\-exclude\-from\fP options. .PP .SH "INCLUDE/EXCLUDE PATTERN RULES" .PP You can include and exclude files by specifying patterns using the \(dq\&+\(dq\&, -\(dq\&-\(dq\&, etc. filter rules (as introduced in the FILTER RULES section above). +\(dq\&\-\(dq\&, etc. filter rules (as introduced in the FILTER RULES section above). The include/exclude rules each specify a pattern that is matched against the names of the files that are going to be transferred. These patterns can take several forms: @@ -2636,8 +2711,8 @@ particular spot in the hierarchy of file against the end of the pathname. This is similar to a leading ^ in regular expressions. Thus \(dq\&/foo\(dq\& would match a name of \(dq\&foo\(dq\& at either the \(dq\&root of the -transfer\(dq\& (for a global rule) or in the merge-file\(cq\&s directory (for a -per-directory rule). +transfer\(dq\& (for a global rule) or in the merge\-file\(cq\&s directory (for a +per\-directory rule). An unqualified \(dq\&foo\(dq\& would match a name of \(dq\&foo\(dq\& anywhere in the tree because the algorithm is applied recursively from the top down; it behaves as if each path component gets a turn at being the @@ -2684,7 +2759,7 @@ Note that, when using the \fB\-\-recursi include/exclude patterns get applied recursively to each subcomponent\(cq\&s full name (e.g. to include \(dq\&/foo/bar/baz\(dq\& the subcomponents \(dq\&/foo\(dq\& and \(dq\&/foo/bar\(dq\& must not be excluded). -The exclude patterns actually short-circuit the directory traversal stage +The exclude patterns actually short\-circuit the directory traversal stage when rsync finds the files to send. If a pattern excludes a particular parent directory, it can render a deeper include pattern ineffectual because rsync did not descend through that excluded section of the @@ -2705,7 +2780,7 @@ This fails because the parent directory rule, so rsync never visits any of the files in the \(dq\&some\(dq\& or \(dq\&some/path\(dq\& directories. One solution is to ask for all directories in the hierarchy to be included by using a single rule: \(dq\&+ */\(dq\& (put it somewhere before the -\(dq\&- *\(dq\& rule), and perhaps use the \fB\-\-prune\-empty\-dirs\fP option. Another +\(dq\&\- *\(dq\& rule), and perhaps use the \fB\-\-prune\-empty\-dirs\fP option. Another solution is to add specific include rules for all the parent dirs that need to be visited. For instance, this set of rules works fine: @@ -2727,58 +2802,58 @@ works fine: Here are some examples of exclude/include matching: .PP .IP o -\(dq\&- *.o\(dq\& would exclude all names matching *.o +\(dq\&\- *.o\(dq\& would exclude all names matching *.o .IP o -\(dq\&- /foo\(dq\& would exclude a file (or directory) named foo in the -transfer-root directory +\(dq\&\- /foo\(dq\& would exclude a file (or directory) named foo in the +transfer\-root directory .IP o -\(dq\&- foo/\(dq\& would exclude any directory named foo +\(dq\&\- foo/\(dq\& would exclude any directory named foo .IP o -\(dq\&- /foo/*/bar\(dq\& would exclude any file named bar which is at two -levels below a directory named foo in the transfer-root directory +\(dq\&\- /foo/*/bar\(dq\& would exclude any file named bar which is at two +levels below a directory named foo in the transfer\-root directory .IP o -\(dq\&- /foo/**/bar\(dq\& would exclude any file named bar two -or more levels below a directory named foo in the transfer-root directory +\(dq\&\- /foo/**/bar\(dq\& would exclude any file named bar two +or more levels below a directory named foo in the transfer\-root directory .IP o -The combination of \(dq\&+ */\(dq\&, \(dq\&+ *.c\(dq\&, and \(dq\&- *\(dq\& would include all +The combination of \(dq\&+ */\(dq\&, \(dq\&+ *.c\(dq\&, and \(dq\&\- *\(dq\& would include all directories and C source files but nothing else (see also the \fB\-\-prune\-empty\-dirs\fP option) .IP o -The combination of \(dq\&+ foo/\(dq\&, \(dq\&+ foo/bar.c\(dq\&, and \(dq\&- *\(dq\& would include +The combination of \(dq\&+ foo/\(dq\&, \(dq\&+ foo/bar.c\(dq\&, and \(dq\&\- *\(dq\& would include only the foo directory and foo/bar.c (the foo directory must be explicitly included or it would be excluded by the \(dq\&*\(dq\&) .PP -The following modifiers are accepted after a \(dq\&+\(dq\& or \(dq\&-\(dq\&: +The following modifiers are accepted after a \(dq\&+\(dq\& or \(dq\&\-\(dq\&: .PP .IP o A \fB/\fP specifies that the include/exclude rule should be matched against the absolute pathname of the current item. For example, -\(dq\&-/ /etc/passwd\(dq\& would exclude the passwd file any time the transfer -was sending files from the \(dq\&/etc\(dq\& directory, and \(dq\&-/ subdir/foo\(dq\& +\(dq\&\-/ /etc/passwd\(dq\& would exclude the passwd file any time the transfer +was sending files from the \(dq\&/etc\(dq\& directory, and \(dq\&\-/ subdir/foo\(dq\& would always exclude \(dq\&foo\(dq\& when it is in a dir named \(dq\&subdir\(dq\&, even if \(dq\&foo\(dq\& is at the root of the current transfer. .IP o A \fB!\fP specifies that the include/exclude should take effect if -the pattern fails to match. For instance, \(dq\&-! */\(dq\& would exclude all -non-directories. +the pattern fails to match. For instance, \(dq\&\-! */\(dq\& would exclude all +non\-directories. .IP o -A \fBC\fP is used to indicate that all the global CVS-exclude rules -should be inserted as excludes in place of the \(dq\&-C\(dq\&. No arg should +A \fBC\fP is used to indicate that all the global CVS\-exclude rules +should be inserted as excludes in place of the \(dq\&\-C\(dq\&. No arg should follow. .IP o An \fBs\fP is used to indicate that the rule applies to the sending side. When a rule affects the sending side, it prevents files from being transferred. The default is for a rule to affect both sides unless \fB\-\-delete\-excluded\fP was specified, in which case default rules -become sender-side only. See also the hide (H) and show (S) rules, -which are an alternate way to specify sending-side includes/excludes. +become sender\-side only. See also the hide (H) and show (S) rules, +which are an alternate way to specify sending\-side includes/excludes. .IP o An \fBr\fP is used to indicate that the rule applies to the receiving side. When a rule affects the receiving side, it prevents files from being deleted. See the \fBs\fP modifier for more info. See also the protect (P) and risk (R) rules, which are an alternate way to -specify receiver-side includes/excludes. +specify receiver\-side includes/excludes. .IP o A \fBp\fP indicates that a rule is perishable, meaning that it is ignored in directories that are being deleted. For instance, the \fB\-C\fP @@ -2787,23 +2862,23 @@ marked as perishable, and will not preve on the source from being deleted on the destination. .PP -.SH "MERGE-FILE FILTER RULES" +.SH "MERGE\-FILE FILTER RULES" .PP You can merge whole files into your filter rules by specifying either a -merge (.) or a dir-merge (:) filter rule (as introduced in the FILTER RULES +merge (.) or a dir\-merge (:) filter rule (as introduced in the FILTER RULES section above). .PP -There are two kinds of merged files \(em single-instance (\(cq\&.\(cq\&) and -per-directory (\(cq\&:\(cq\&). A single-instance merge file is read one time, and +There are two kinds of merged files \-\- single\-instance (\(cq\&.\(cq\&) and +per\-directory (\(cq\&:\(cq\&). A single\-instance merge file is read one time, and its rules are incorporated into the filter list in the place of the \(dq\&.\(dq\& -rule. For per-directory merge files, rsync will scan every directory that +rule. For per\-directory merge files, rsync will scan every directory that it traverses for the named file, merging its contents when the file exists -into the current list of inherited rules. These per-directory rule files +into the current list of inherited rules. These per\-directory rule files must be created on the sending side because it is the sending side that is being scanned for the available files to transfer. These rule files may also need to be transferred to the receiving side if you want them to -affect what files don\(cq\&t get deleted (see PER-DIRECTORY RULES AND DELETE +affect what files don\(cq\&t get deleted (see PER\-DIRECTORY RULES AND DELETE below). .PP Some examples: @@ -2822,53 +2897,57 @@ Some examples: .RE .PP -The following modifiers are accepted after a merge or dir-merge rule: +The following modifiers are accepted after a merge or dir\-merge rule: .PP .IP o A \fB\-\fP specifies that the file should consist of only exclude -patterns, with no other rule-parsing except for in-file comments. +patterns, with no other rule\-parsing except for in\-file comments. .IP o A \fB+\fP specifies that the file should consist of only include -patterns, with no other rule-parsing except for in-file comments. +patterns, with no other rule\-parsing except for in\-file comments. .IP o A \fBC\fP is a way to specify that the file should be read in a -CVS-compatible manner. This turns on \(cq\&n\(cq\&, \(cq\&w\(cq\&, and \(cq\&-\(cq\&, but also -allows the list-clearing token (!) to be specified. If no filename is +CVS\-compatible manner. This turns on \(cq\&n\(cq\&, \(cq\&w\(cq\&, and \(cq\&\-\(cq\&, but also +allows the list\-clearing token (!) to be specified. If no filename is provided, \(dq\&.cvsignore\(dq\& is assumed. .IP o -A \fBe\fP will exclude the merge-file name from the transfer; e.g. -\(dq\&dir-merge,e .rules\(dq\& is like \(dq\&dir-merge .rules\(dq\& and \(dq\&- .rules\(dq\&. +A \fBe\fP will exclude the merge\-file name from the transfer; e.g. +\(dq\&dir\-merge,e .rules\(dq\& is like \(dq\&dir\-merge .rules\(dq\& and \(dq\&\- .rules\(dq\&. .IP o An \fBn\fP specifies that the rules are not inherited by subdirectories. .IP o -A \fBw\fP specifies that the rules are word-split on whitespace instead -of the normal line-splitting. This also turns off comments. Note: the +A \fBw\fP specifies that the rules are word\-split on whitespace instead +of the normal line\-splitting. This also turns off comments. Note: the space that separates the prefix from the rule is treated specially, so -\(dq\&- foo + bar\(dq\& is parsed as two rules (assuming that prefix-parsing wasn\(cq\&t +\(dq\&\- foo + bar\(dq\& is parsed as two rules (assuming that prefix\-parsing wasn\(cq\&t also disabled). .IP o -You may also specify any of the modifiers for the \(dq\&+\(dq\& or \(dq\&-\(dq\& rules +You may also specify any of the modifiers for the \(dq\&+\(dq\& or \(dq\&\-\(dq\& rules (above) in order to have the rules that are read in from the file -default to having that modifier set. For instance, \(dq\&merge,\-/ .excl\(dq\& would -treat the contents of .excl as absolute-path excludes, -while \(dq\&dir-merge,s .filt\(dq\& and \(dq\&:sC\(dq\& would each make all their -per-directory rules apply only on the sending side. +default to having that modifier set (except for the \fB!\fP modifier, which +would not be useful). For instance, \(dq\&merge,\-/ .excl\(dq\& would +treat the contents of .excl as absolute\-path excludes, +while \(dq\&dir\-merge,s .filt\(dq\& and \(dq\&:sC\(dq\& would each make all their +per\-directory rules apply only on the sending side. If the merge rule +specifies sides to affect (via the \fBs\fP or \fBr\fP modifier or both), +then the rules in the file must not specify sides (via a modifier or +a rule prefix such as \fBhide\fP). .PP -Per-directory rules are inherited in all subdirectories of the directory -where the merge-file was found unless the \(cq\&n\(cq\& modifier was used. Each -subdirectory\(cq\&s rules are prefixed to the inherited per-directory rules +Per\-directory rules are inherited in all subdirectories of the directory +where the merge\-file was found unless the \(cq\&n\(cq\& modifier was used. Each +subdirectory\(cq\&s rules are prefixed to the inherited per\-directory rules from its parents, which gives the newest rules a higher priority than the -inherited rules. The entire set of dir-merge rules are grouped together in -the spot where the merge-file was specified, so it is possible to override -dir-merge rules via a rule that got specified earlier in the list of global -rules. When the list-clearing rule (\(dq\&!\(dq\&) is read from a per-directory +inherited rules. The entire set of dir\-merge rules are grouped together in +the spot where the merge\-file was specified, so it is possible to override +dir\-merge rules via a rule that got specified earlier in the list of global +rules. When the list\-clearing rule (\(dq\&!\(dq\&) is read from a per\-directory file, it only clears the inherited rules for the current merge file. .PP -Another way to prevent a single rule from a dir-merge file from being inherited is to -anchor it with a leading slash. Anchored rules in a per-directory -merge-file are relative to the merge-file\(cq\&s directory, so a pattern \(dq\&/foo\(dq\& -would only match the file \(dq\&foo\(dq\& in the directory where the dir-merge filter +Another way to prevent a single rule from a dir\-merge file from being inherited is to +anchor it with a leading slash. Anchored rules in a per\-directory +merge\-file are relative to the merge\-file\(cq\&s directory, so a pattern \(dq\&/foo\(dq\& +would only match the file \(dq\&foo\(dq\& in the directory where the dir\-merge filter file was found. .PP Here\(cq\&s an example filter file which you\(cq\&d specify via \fB\-\-filter=\(dq\&. file\(dq\&:\fP @@ -2888,15 +2967,15 @@ Here\(cq\&s an example filter file which .PP This will merge the contents of the /home/user/.global\-filter file at the -start of the list and also turns the \(dq\&.rules\(dq\& filename into a per-directory +start of the list and also turns the \(dq\&.rules\(dq\& filename into a per\-directory filter file. All rules read in prior to the start of the directory scan follow the global anchoring rules (i.e. a leading slash matches at the root of the transfer). .PP -If a per-directory merge-file is specified with a path that is a parent +If a per\-directory merge\-file is specified with a path that is a parent directory of the first transfer directory, rsync will scan all the parent dirs from that starting point to the transfer directory for the indicated -per-directory file. For instance, here is a common filter (see \fB\-F\fP): +per\-directory file. For instance, here is a common filter (see \fB\-F\fP): .PP .RS \f(CW\-\-filter='\&: /.rsync\-filter'\&\fP @@ -2909,7 +2988,7 @@ transfer prior to the start of the norma the directories that are sent as a part of the transfer. (Note: for an rsync daemon, the root is always the same as the module\(cq\&s \(dq\&path\(dq\&.) .PP -Some examples of this pre-scanning for per-directory files: +Some examples of this pre\-scanning for per\-directory files: .PP .RS \f(CWrsync \-avF /src/path/ /dest/dir\fP @@ -2923,18 +3002,18 @@ Some examples of this pre-scanning for p .PP The first two commands above will look for \(dq\&.rsync\-filter\(dq\& in \(dq\&/\(dq\& and \(dq\&/src\(dq\& before the normal scan begins looking for the file in \(dq\&/src/path\(dq\& -and its subdirectories. The last command avoids the parent-dir scan +and its subdirectories. The last command avoids the parent\-dir scan and only looks for the \(dq\&.rsync\-filter\(dq\& files in each directory that is a part of the transfer. .PP If you want to include the contents of a \(dq\&.cvsignore\(dq\& in your patterns, -you should use the rule \(dq\&:C\(dq\&, which creates a dir-merge of the .cvsignore -file, but parsed in a CVS-compatible manner. You can +you should use the rule \(dq\&:C\(dq\&, which creates a dir\-merge of the .cvsignore +file, but parsed in a CVS\-compatible manner. You can use this to affect where the \fB\-\-cvs\-exclude\fP (\fB\-C\fP) option\(cq\&s inclusion of the -per-directory .cvsignore file gets placed into your rules by putting the +per\-directory .cvsignore file gets placed into your rules by putting the \(dq\&:C\(dq\& wherever you like in your filter rules. Without this, rsync would -add the dir-merge rule for the .cvsignore file at the end of all your other -rules (giving it a lower priority than your command-line rules). For +add the dir\-merge rule for the .cvsignore file at the end of all your other +rules (giving it a lower priority than your command\-line rules). For example: .PP .RS @@ -2954,35 +3033,35 @@ example: .PP Both of the above rsync commands are identical. Each one will merge all -the per-directory .cvsignore rules in the middle of the list rather than -at the end. This allows their dir-specific rules to supersede the rules +the per\-directory .cvsignore rules in the middle of the list rather than +at the end. This allows their dir\-specific rules to supersede the rules that follow the :C instead of being subservient to all your rules. To affect the other CVS exclude rules (i.e. the default list of exclusions, the contents of $HOME/.cvsignore, and the value of $CVSIGNORE) you should -omit the \fB\-C\fP command-line option and instead insert a \(dq\&-C\(dq\& rule into +omit the \fB\-C\fP command\-line option and instead insert a \(dq\&\-C\(dq\& rule into your filter rules; e.g. \(dq\&\fB\-\-filter=\-C\fP\(dq\&. .PP -.SH "LIST-CLEARING FILTER RULE" +.SH "LIST\-CLEARING FILTER RULE" .PP You can clear the current include/exclude list by using the \(dq\&!\(dq\& filter rule (as introduced in the FILTER RULES section above). The \(dq\¤t\(dq\& list is either the global list of rules (if the rule is encountered while -parsing the filter options) or a set of per-directory rules (which are -inherited in their own sub-list, so a subdirectory can use this to clear +parsing the filter options) or a set of per\-directory rules (which are +inherited in their own sub\-list, so a subdirectory can use this to clear out the parent\(cq\&s rules). .PP .SH "ANCHORING INCLUDE/EXCLUDE PATTERNS" .PP As mentioned earlier, global include/exclude patterns are anchored at the -\(dq\&root of the transfer\(dq\& (as opposed to per-directory patterns, which are -anchored at the merge-file\(cq\&s directory). If you think of the transfer as +\(dq\&root of the transfer\(dq\& (as opposed to per\-directory patterns, which are +anchored at the merge\-file\(cq\&s directory). If you think of the transfer as a subtree of names that are being sent from sender to receiver, the -transfer-root is where the tree starts to be duplicated in the destination +transfer\-root is where the tree starts to be duplicated in the destination directory. This root governs where patterns that start with a / match. .PP -Because the matching is relative to the transfer-root, changing the +Because the matching is relative to the transfer\-root, changing the trailing slash on a source path or changing your use of the \fB\-\-relative\fP option affects the path you need to use in your matching (in addition to changing how much of the file tree is duplicated on the destination @@ -2990,7 +3069,7 @@ host). The following examples demonstra .PP Let\(cq\&s say that we want to match two source files, one with an absolute path of \(dq\&/home/me/foo/bar\(dq\&, and one with a path of \(dq\&/home/you/bar/baz\(dq\&. -Here is how the various command choices differ for a 2-source transfer: +Here is how the various command choices differ for a 2\-source transfer: .PP .RS Example cmd: rsync \-a /home/me /home/you /dest @@ -3052,10 +3131,10 @@ The easiest way to see what name you sho look at the output when using \fB\-\-verbose\fP and put a / in front of the name (use the \fB\-\-dry\-run\fP option if you\(cq\&re not yet ready to copy any files). .PP -.SH "PER-DIRECTORY RULES AND DELETE" +.SH "PER\-DIRECTORY RULES AND DELETE" .PP -Without a delete option, per-directory rules are only relevant on the +Without a delete option, per\-directory rules are only relevant on the sending side, so you can feel free to exclude the merge files themselves without affecting the transfer. To make this easy, the \(cq\&e\(cq\& modifier adds this exclude for you, as seen in these two equivalent commands: @@ -3071,7 +3150,7 @@ this exclude for you, as seen in these t However, if you want to do a delete on the receiving side AND you want some files to be excluded from being deleted, you\(cq\&ll need to be sure that the receiving side knows what files to exclude. The easiest way is to include -the per-directory merge files in the transfer and use \fB\-\-delete\-after\fP, +the per\-directory merge files in the transfer and use \fB\-\-delete\-after\fP, because this ensures that the receiving side gets all the same exclude rules as the sending side before it tries to delete anything: .PP @@ -3082,7 +3161,7 @@ rules as the sending side before it trie .PP However, if the merge files are not a part of the transfer, you\(cq\&ll need to either specify some global exclude rules (i.e. specified on the command -line), or you\(cq\&ll need to maintain your own per-directory merge files on +line), or you\(cq\&ll need to maintain your own per\-directory merge files on the receiving side. An example of the first is this (assume that the remote .rules files exclude themselves): .PP @@ -3095,12 +3174,12 @@ rsync \-av \-\-filter=\(cq\&: .rules\(cq In the above example the extra.rules file can affect both sides of the transfer, but (on the sending side) the rules are subservient to the rules merged from the .rules files because they were specified after the -per-directory merge rule. +per\-directory merge rule. .PP In one final example, the remote side is excluding the .rsync\-filter files from the transfer, but we want to use our own .rsync\-filter files to control what gets deleted on the receiving side. To do this we must -specifically exclude the per-directory merge files (so that they don\(cq\&t get +specifically exclude the per\-directory merge files (so that they don\(cq\&t get deleted) and then put rules into the local files to control what else should not get deleted. Like one of these commands: .PP @@ -3119,8 +3198,8 @@ identical systems. Suppose one has a tre number of hosts. Now suppose some changes have been made to this source tree and those changes need to be propagated to the other hosts. In order to do this using batch mode, rsync is run with the -write-batch option to apply the changes made to the source tree to one -of the destination trees. The write-batch option causes the rsync +write\-batch option to apply the changes made to the source tree to one +of the destination trees. The write\-batch option causes the rsync client to store in a \(dq\&batch file\(dq\& all the information needed to repeat this operation against other, identical destination trees. .PP @@ -3131,15 +3210,15 @@ be used to transfer the batch update fil at once, instead of sending the same data to every host individually. .PP To apply the recorded changes to another destination tree, run rsync -with the read-batch option, specifying the name of the same batch +with the read\-batch option, specifying the name of the same batch file, and the destination tree. Rsync updates the destination tree using the information stored in the batch file. .PP -For your convenience, a script file is also created when the write-batch +For your convenience, a script file is also created when the write\-batch option is used: it will be named the same as the batch file with \(dq\&.sh\(dq\& -appended. This script file contains a command-line suitable for updating a +appended. This script file contains a command\-line suitable for updating a destination tree using the associated batch file. It can be executed using -a Bourne (or Bourne-like) shell, optionally passing in an alternate +a Bourne (or Bourne\-like) shell, optionally passing in an alternate destination tree pathname which is then used instead of the original destination path. This is useful when the destination tree path on the current host differs from the one used to create the batch file. @@ -3172,11 +3251,11 @@ reveals some of the flexibility you have .PP .IP o The first example shows that the initial copy doesn\(cq\&t have to be -local \(em you can push or pull data to/from a remote host using either the -remote-shell syntax or rsync daemon syntax, as desired. +local \-\- you can push or pull data to/from a remote host using either the +remote\-shell syntax or rsync daemon syntax, as desired. .IP o The first example uses the created \(dq\&foo.sh\(dq\& file to get the right -rsync options when running the read-batch command on the remote host. +rsync options when running the read\-batch command on the remote host. .IP o The second example reads the batch data via standard input so that the batch file doesn\(cq\&t need to be copied to the remote machine first. @@ -3188,24 +3267,24 @@ standard input, such as the \(dq\&\fB\-\ .PP Caveats: .PP -The read-batch option expects the destination tree that it is updating +The read\-batch option expects the destination tree that it is updating to be identical to the destination tree that was used to create the batch update fileset. When a difference between the destination trees is encountered the update might be discarded with a warning (if the file -appears to be up-to-date already) or the file-update may be attempted +appears to be up\-to\-date already) or the file\-update may be attempted and then, if the file fails to verify, the update discarded with an -error. This means that it should be safe to re-run a read-batch operation -if the command got interrupted. If you wish to force the batched-update to +error. This means that it should be safe to re\-run a read\-batch operation +if the command got interrupted. If you wish to force the batched\-update to always be attempted regardless of the file\(cq\&s size and date, use the \fB\-I\fP option (when reading the batch). If an error occurs, the destination tree will probably be in a partially updated state. In that case, rsync can -be used in its regular (non-batch) mode of operation to fix up the +be used in its regular (non\-batch) mode of operation to fix up the destination tree. .PP The rsync version used on all destinations must be at least as new as the one used to generate the batch file. Rsync will die with an error if the -protocol version in the batch file is too new for the batch-reading rsync +protocol version in the batch file is too new for the batch\-reading rsync to handle. See also the \fB\-\-protocol\fP option for a way to have the creating rsync generate a batch file that an older rsync can understand. (Note that batch files changed format in version 2.6.3, so mixing versions @@ -3213,7 +3292,7 @@ older than that with newer versions will .PP When reading a batch file, rsync will force the value of certain options to match the data in the batch file if you didn\(cq\&t set them to the same -as the batch-writing command. Other options can (and should) be changed. +as the batch\-writing command. Other options can (and should) be changed. For instance \fB\-\-write\-batch\fP changes to \fB\-\-read\-batch\fP, \fB\-\-files\-from\fP is dropped, and the \fB\-\-filter\fP/\fB\-\-include\fP/\fB\-\-exclude\fP options are not needed unless @@ -3236,7 +3315,7 @@ Three basic behaviors are possible when link in the source directory. .PP By default, symbolic links are not transferred at all. A message -\(dq\&skipping non-regular\(dq\& file is emitted for any symlinks that exist. +\(dq\&skipping non\-regular\(dq\& file is emitted for any symlinks that exist. .PP If \fB\-\-links\fP is specified, then symlinks are recreated with the same target on the destination. Note that \fB\-\-archive\fP implies @@ -3286,7 +3365,7 @@ Duplicate all symlinks. .PP rsync occasionally produces error messages that may seem a little cryptic. The one that seems to cause the most confusion is \(dq\&protocol -version mismatch \(em is your shell clean?\(dq\&. +version mismatch \-\- is your shell clean?\(dq\&. .PP This message is usually caused by your startup scripts or remote shell facility producing unwanted garbage on the stream that rsync is using @@ -3304,7 +3383,7 @@ rsync then you will probably find that o data. Look at the contents and try to work out what is producing it. The most common cause is incorrectly configured shell startup scripts (such as .cshrc or .profile) that contain output statements -for non-interactive logins. +for non\-interactive logins. .PP If you are having trouble debugging filter patterns, then try specifying the \fB\-vv\fP option. At this level of verbosity rsync will @@ -3323,13 +3402,13 @@ Protocol incompatibility Errors selecting input/output files, dirs .IP "\fB4\fP" Requested action not supported: an attempt -was made to manipulate 64-bit files on a platform that cannot support +was made to manipulate 64\-bit files on a platform that cannot support them; or an option was specified that is supported by the client and not by the server. .IP "\fB5\fP" -Error starting client-server protocol +Error starting client\-server protocol .IP "\fB6\fP" -Daemon unable to append to log-file +Daemon unable to append to log\-file .IP "\fB10\fP" Error in socket I/O .IP "\fB11\fP" @@ -3368,7 +3447,7 @@ ignore patterns in .cvsignore files. See more details. .IP "\fBRSYNC_ICONV\fP" Specify a default \fB\-\-iconv\fP setting using this -environment variable. +environment variable. (First supported in 3.0.0.) .IP "\fBRSYNC_RSH\fP" The RSYNC_RSH environment variable allows you to override the default shell used as the transport for rsync. Command line @@ -3407,7 +3486,7 @@ default .cvsignore file. .PP times are transferred as *nix time_t values .PP -When transferring to FAT filesystems rsync may re-sync +When transferring to FAT filesystems rsync may re\-sync unmodified files. See the comments on the \fB\-\-modify\-window\fP option. .PP @@ -3422,7 +3501,7 @@ http://rsync.samba.org/ .SH "VERSION" .PP -This man page is current for version 3.0.7 of rsync. +This man page is current for version 3.0.8 of rsync. .PP .SH "INTERNAL OPTIONS" @@ -3443,24 +3522,24 @@ COPYING for details. .PP A WEB site is available at http://rsync.samba.org/. The site -includes an FAQ-O-Matic which may cover questions unanswered by this +includes an FAQ\-O\-Matic which may cover questions unanswered by this manual page. .PP The primary ftp site for rsync is ftp://rsync.samba.org/pub/rsync. .PP We would be delighted to hear from you if you like this program. -Please contact the mailing-list at rsync@lists.samba.org. +Please contact the mailing\-list at rsync@lists.samba.org. .PP This program uses the excellent zlib compression library written by -Jean-loup Gailly and Mark Adler. +Jean\-loup Gailly and Mark Adler. .PP .SH "THANKS" .PP Special thanks go out to: John Van Essen, Matt McCutchen, Wesley W. Terpstra, David Dykstra, Jos Backus, Sebastian Krahmer, Martin Pool, and our -gone-but-not-forgotten compadre, J.W. Schultz. +gone\-but\-not\-forgotten compadre, J.W. Schultz. .PP Thanks also to Richard Brent, Brendan Mackay, Bill Waite, Stephen Rothwell and David Bell. I\(cq\&ve probably missed some people, my apologies if I have. diff -upN a/rsyncd.conf.5 b/rsyncd.conf.5 --- a/rsyncd.conf.5 +++ b/rsyncd.conf.5 @@ -1,4 +1,4 @@ -.TH "rsyncd.conf" "5" "31 Dec 2009" "" "" +.TH "rsyncd.conf" "5" "26 Mar 2011" "" "" .SH "NAME" rsyncd.conf \(em configuration file for rsync in daemon mode .SH "SYNOPSIS" @@ -22,7 +22,7 @@ The file consists of modules and paramet name of the module in square brackets and continues until the next module begins. Modules contain parameters of the form \(dq\&name = value\(dq\&. .PP -The file is line-based \(em that is, each newline-terminated line represents +The file is line\-based \-\- that is, each newline\-terminated line represents either a comment, a module name or a parameter. .PP Only the first equals sign in a parameter is significant. Whitespace before @@ -53,8 +53,8 @@ bind to a port numbered under 1024 (as i file ownership. Otherwise, it must just have permission to read and write the appropriate data, log, and lock files. .PP -You can launch it either via inetd, as a stand-alone daemon, or from -an rsync client via a remote shell. If run as a stand-alone daemon then +You can launch it either via inetd, as a stand\-alone daemon, or from +an rsync client via a remote shell. If run as a stand\-alone daemon then just run the command \(dq\&\fBrsync \-\-daemon\fP\(dq\& from a suitable startup script. .PP When run via inetd you should add a line like this to /etc/services: @@ -76,7 +76,7 @@ your system. You will then need to send reread its config file. .PP Note that you should \fBnot\fP send the rsync daemon a HUP signal to force -it to reread the \f(CWrsyncd.conf\fP file. The file is re-read on each client +it to reread the \f(CWrsyncd.conf\fP file. The file is re\-read on each client connection. .PP .SH "GLOBAL PARAMETERS" @@ -103,12 +103,12 @@ daemon will abort rather than overwrite .IP "\fBport\fP" You can override the default port the daemon will listen on by specifying this value (defaults to 873). This is ignored if the daemon -is being run by inetd, and is superseded by the \fB\-\-port\fP command-line option. +is being run by inetd, and is superseded by the \fB\-\-port\fP command\-line option. .IP .IP "\fBaddress\fP" You can override the default IP address the daemon will listen on by specifying this value. This is ignored if the daemon is -being run by inetd, and is superseded by the \fB\-\-address\fP command-line option. +being run by inetd, and is superseded by the \fB\-\-address\fP command\-line option. .IP .IP "\fBsocket options\fP" This parameter can provide endless fun for people @@ -119,7 +119,7 @@ slower!). Read the man page for the system call for details on some of the options you may be able to set. By default no special socket options are set. These settings can also be specified -via the \fB\-\-sockopts\fP command-line option. +via the \fB\-\-sockopts\fP command\-line option. .IP .SH "MODULE PARAMETERS" @@ -147,23 +147,23 @@ for each module in \f(CWrsyncd.conf\fP. If \(dq\&use chroot\(dq\& is true, the rsync daemon will chroot to the \(dq\&path\(dq\& before starting the file transfer with the client. This has the advantage of extra protection against possible implementation security -holes, but it has the disadvantages of requiring super-user privileges, +holes, but it has the disadvantages of requiring super\-user privileges, of not being able to follow symbolic links that are either absolute or outside of the new root path, and of complicating the preservation of users and groups by name (see below). .IP -As an additional safety feature, you can specify a dot-dir in the module\(cq\&s +As an additional safety feature, you can specify a dot\-dir in the module\(cq\&s \(dq\&path\(dq\& to indicate the point where the chroot should occur. This allows rsync -to run in a chroot with a non-\(dq\&/\(dq\& path for the top of the transfer hierarchy. +to run in a chroot with a non\-\(dq\&/\(dq\& path for the top of the transfer hierarchy. Doing this guards against unintended library loading (since those absolute paths will not be inside the transfer hierarchy unless you have used an unwise pathname), and lets you setup libraries for the chroot that are outside of the transfer. For example, specifying \(dq\&/var/rsync/./module1\(dq\& will chroot to the -\(dq\&/var/rsync\(dq\& directory and set the inside-chroot path to \(dq\&/module1\(dq\&. If you -had omitted the dot-dir, the chroot would have used the whole path, and the -inside-chroot path would have been \(dq\&/\(dq\&. +\(dq\&/var/rsync\(dq\& directory and set the inside\-chroot path to \(dq\&/module1\(dq\&. If you +had omitted the dot\-dir, the chroot would have used the whole path, and the +inside\-chroot path would have been \(dq\&/\(dq\&. .IP -When \(dq\&use chroot\(dq\& is false or the inside-chroot path is not \(dq\&/\(dq\&, rsync will: +When \(dq\&use chroot\(dq\& is false or the inside\-chroot path is not \(dq\&/\(dq\&, rsync will: (1) munge symlinks by default for security reasons (see \(dq\&munge symlinks\(dq\& for a way to turn this off, but only if you trust your users), (2) substitute leading slashes in @@ -172,11 +172,11 @@ absolute paths with the module\(cq\&s pa rooted in the module\(cq\&s \(dq\&path\(dq\& dir), and (3) trim \(dq\&..\(dq\& path elements from args if rsync believes they would escape the module hierarchy. The default for \(dq\&use chroot\(dq\& is true, and is the safer choice (especially -if the module is not read-only). +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 +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 , @@ -205,12 +205,12 @@ could abbreviate the list of users and g .IP "\fBnumeric ids\fP" Enabling this parameter disables the mapping of users and groups by name for the current daemon module. This prevents -the daemon from trying to load any user/group-related files or libraries. +the daemon from trying to load any user/group\-related files or libraries. 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. +the \fB\-\-numeric\-ids\fP command\-line option. By default, this parameter is +enabled for chroot modules and disabled for non\-chroot modules. .IP -A chroot-enabled module should not have this parameter enabled unless you\(cq\&ve +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. @@ -220,34 +220,34 @@ This parameter tells rsync to modify all incoming symlinks in a way that makes them unusable but recoverable (see below). This should help protect your files from user trickery when your daemon module is writable. The default is disabled when \(dq\&use chroot\(dq\& -is on and the inside-chroot path is \(dq\&/\(dq\&, otherwise it is enabled. +is on and the inside\-chroot path is \(dq\&/\(dq\&, otherwise it is enabled. .IP -If you disable this parameter on a daemon that is not read-only, there +If you disable this parameter on a daemon that is not read\-only, there are tricks that a user can play with uploaded symlinks to access -daemon-excluded items (if your module has any), and, if \(dq\&use chroot\(dq\& +daemon\-excluded items (if your module has any), and, if \(dq\&use chroot\(dq\& is off, rsync can even be tricked into showing or changing data that -is outside the module\(cq\&s path (as access-permissions allow). +is outside the module\(cq\&s path (as access\-permissions allow). .IP The way rsync disables the use of symlinks is to prefix each one with -the string \(dq\&/rsyncd-munged/\(dq\&. This prevents the links from being used +the string \(dq\&/rsyncd\-munged/\(dq\&. This prevents the links from being used as long as that directory does not exist. When this parameter is enabled, rsync will refuse to run if that path is a directory or a symlink to a directory. When using the \(dq\&munge symlinks\(dq\& parameter in a chroot area -that has an inside-chroot path of \(dq\&/\(dq\&, you should add \(dq\&/rsyncd-munged/\(dq\& +that has an inside\-chroot path of \(dq\&/\(dq\&, you should add \(dq\&/rsyncd\-munged/\(dq\& to the exclude setting for the module so that a user can\(cq\&t try to create it. .IP -Note: rsync makes no attempt to verify that any pre-existing symlinks in +Note: rsync makes no attempt to verify that any pre\-existing symlinks in the module\(cq\&s hierarchy are as safe as you want them to be (unless, of course, it just copied in the whole hierarchy). If you setup an rsync daemon on a new area or locally add symlinks, you can manually protect your -symlinks from being abused by prefixing \(dq\&/rsyncd-munged/\(dq\& to the start of +symlinks from being abused by prefixing \(dq\&/rsyncd\-munged/\(dq\& to the start of every symlink\(cq\&s value. There is a perl script in the support directory -of the source code named \(dq\&munge-symlinks\(dq\& that can be used to add or remove +of the source code named \(dq\&munge\-symlinks\(dq\& that can be used to add or remove this prefix from your symlinks. .IP When this parameter is disabled on a writable module and \(dq\&use chroot\(dq\& is off -(or the inside-chroot path is not \(dq\&/\(dq\&), +(or the inside\-chroot path is not \(dq\&/\(dq\&), incoming symlinks will be modified to drop a leading slash and to remove \(dq\&..\(dq\& path elements that rsync believes will allow a symlink to escape the module\(cq\&s hierarchy. There are tricky ways to work around this, though, so you had @@ -259,12 +259,12 @@ module\(cq\&s filenames are stored. If the daemon will use the value of the \(dq\&charset\(dq\& parameter regardless of the character set the client actually passed. This allows the daemon to support charset conversion in a chroot module without extra files in the -chroot area, and also ensures that name-translation is done in a consistent +chroot area, and also ensures that name\-translation is done in a consistent manner. If the \(dq\&charset\(dq\& parameter is not set, the \fB\-\-iconv\fP option is refused, just as if \(dq\&iconv\(dq\& had been specified via \(dq\&refuse options\(dq\&. .IP If you wish to force users to always use \fB\-\-iconv\fP for a particular -module, add \(dq\&no-iconv\(dq\& to the \(dq\&refuse options\(dq\& parameter. Keep in mind +module, add \(dq\&no\-iconv\(dq\& to the \(dq\&refuse options\(dq\& parameter. Keep in mind that this will restrict access to your module to very new rsync clients. .IP .IP "\fBmax connections\fP" @@ -276,7 +276,7 @@ A negative value disables the module. See also the \(dq\&lock file\(dq\& parameter. .IP .IP "\fBlog file\fP" -When the \(dq\&log file\(dq\& parameter is set to a non-empty +When the \(dq\&log file\(dq\& parameter is set to a non\-empty string, the rsync daemon will log messages to the indicated file rather than using syslog. This is particularly useful on systems (such as AIX) where @@ -285,9 +285,9 @@ doesn\(cq\&t work for chrooted programs. opened before \f(CWchroot()\fP is called, allowing it to be placed outside -the transfer. If this value is set on a per-module basis instead of +the transfer. If this value is set on a per\-module basis instead of globally, the global log will still contain any authorization failures -or config-file error messages. +or config\-file error messages. .IP If the daemon fails to open the specified file, it will fall back to using syslog and output an error about the failure. (Note that the @@ -301,7 +301,7 @@ defined on your system. Common names are ftp, kern, lpr, mail, news, security, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6 and local7. The default is daemon. This setting has no effect if the \(dq\&log file\(dq\& setting is a -non-empty string (either set in the per-modules settings, or inherited +non\-empty string (either set in the per\-modules settings, or inherited from the global settings). .IP .IP "\fBmax verbosity\fP" @@ -352,7 +352,7 @@ which is normally the group \(dq\&nobody .IP .IP "\fBfake super\fP" Setting \(dq\&fake super = yes\(dq\& for a module causes the -daemon side to behave as if the \fB\-\-fake\-user\fP command-line option had +daemon side to behave as if the \fB\-\-fake\-super\fP command\-line option had been specified. This allows the full attributes of a file to be stored without having to have the daemon actually running as root. .IP @@ -360,7 +360,7 @@ without having to have the daemon actual The daemon has its own filter chain that determines what files it will let the client access. This chain is not sent to the client and is independent of any filters the client may have specified. Files excluded by -the daemon filter chain (\fBdaemon-excluded\fP files) are treated as non-existent +the daemon filter chain (\fBdaemon\-excluded\fP files) are treated as non\-existent if the client tries to pull them, are skipped with an error message if the client tries to push them (triggering exit code 23), and are never deleted from the module. You can use daemon filters to prevent clients from downloading or @@ -371,23 +371,23 @@ The daemon filter chain is built from th \(dq\&exclude from\(dq\&, and \(dq\&exclude\(dq\& parameters, in that order of priority. Anchored patterns are anchored at the root of the module. To prevent access to an entire subtree, for example, \(dq\&/secret\(dq\&, you \fImust\fP exclude everything in the -subtree; the easiest way to do this is with a triple-star pattern like +subtree; the easiest way to do this is with a triple\-star pattern like \(dq\&/secret/***\(dq\&. .IP -The \(dq\&filter\(dq\& parameter takes a space-separated list of daemon filter rules, +The \(dq\&filter\(dq\& parameter takes a space\-separated list of daemon filter rules, though it is smart enough to know not to split a token at an internal space in -a rule (e.g. \(dq\&- /foo \(em /bar\(dq\& is parsed as two rules). You may specify one or -more merge-file rules using the normal syntax. Only one \(dq\&filter\(dq\& parameter can +a rule (e.g. \(dq\&\- /foo \(em /bar\(dq\& is parsed as two rules). You may specify one or +more merge\-file rules using the normal syntax. Only one \(dq\&filter\(dq\& parameter can apply to a given module in the config file, so put all the rules you want in a -single parameter. Note that per-directory merge-file rules do not provide as +single parameter. Note that per\-directory merge\-file rules do not provide as much protection as global rules, but they can be used to make \fB\-\-delete\fP work -better during a client download operation if the per-dir merge files are +better during a client download operation if the per\-dir merge files are included in the transfer and the client requests that they be used. .IP .IP "\fBexclude\fP" -This parameter takes a space-separated list of daemon +This parameter takes a space\-separated list of daemon exclude patterns. As with the client \fB\-\-exclude\fP option, patterns can be -qualified with \(dq\&- \(dq\& or \(dq\&+ \(dq\& to explicitly indicate exclude/include. Only one +qualified with \(dq\&\- \(dq\& or \(dq\&+ \(dq\& to explicitly indicate exclude/include. Only one \(dq\&exclude\(dq\& parameter can apply to a given module. See the \(dq\&filter\(dq\& parameter for a description of how excluded files affect the daemon. .IP @@ -400,7 +400,7 @@ parameter. Only one \(dq\&include\(dq\& This parameter specifies the name of a file on the daemon that contains daemon exclude patterns, one per line. Only one \(dq\&exclude from\(dq\& parameter can apply to a given module; if you have multiple -exclude-from files, you can specify them as a merge file in the \(dq\&filter\(dq\& +exclude\-from files, you can specify them as a merge file in the \(dq\&filter\(dq\& parameter. See the \(dq\&filter\(dq\& parameter for a description of how excluded files affect the daemon. .IP @@ -412,17 +412,17 @@ daemon. .IP .IP "\fBincoming chmod\fP" This parameter allows you to specify a set of -comma-separated chmod strings that will affect the permissions of all +comma\-separated chmod strings that will affect the permissions of all incoming files (files that are being received by the daemon). These changes happen after all other permission calculations, and this will -even override destination-default and/or existing permissions when the +even override destination\-default and/or existing permissions when the client does not specify \fB\-\-perms\fP. See the description of the \fB\-\-chmod\fP rsync option and the \fBchmod\fP(1) manpage for information on the format of this string. .IP .IP "\fBoutgoing chmod\fP" This parameter allows you to specify a set of -comma-separated chmod strings that will affect the permissions of all +comma\-separated chmod strings that will affect the permissions of all outgoing files (files that are being sent out from the daemon). These changes happen first, making the sent permissions appear to be different than those stored in the filesystem itself. For instance, you could @@ -433,7 +433,7 @@ manpage for information on the format of .IP .IP "\fBauth users\fP" This parameter specifies a comma and -space-separated list of usernames that will be allowed to connect to +space\-separated list of usernames that will be allowed to connect to this module. The usernames do not need to exist on the local system. The usernames may also contain shell wildcard characters. If \(dq\&auth users\(dq\& is set then the client will be challenged to supply a @@ -443,9 +443,9 @@ usernames and passwords are stored in th \(dq\&secrets file\(dq\& parameter. The default is for all users to be able to connect without a password (this is called \(dq\&anonymous rsync\(dq\&). .IP -See also the section entitled \(dq\&USING RSYNC-DAEMON FEATURES VIA A REMOTE +See also the section entitled \(dq\&USING RSYNC\-DAEMON FEATURES VIA A REMOTE SHELL CONNECTION\(dq\& in \fBrsync\fP(1) for information on how handle an -rsyncd.conf\-level username that differs from the remote-shell-level +rsyncd.conf\-level username that differs from the remote\-shell\-level username when using a remote shell to connect to an rsync daemon. .IP .IP "\fBsecrets file\fP" @@ -504,7 +504,7 @@ then the client is allowed in. .RE .IP -Note IPv6 link-local addresses can have a scope in the address specification: +Note IPv6 link\-local addresses can have a scope in the address specification: .IP .RS \f(CW fe80::1%link1\fP @@ -546,11 +546,11 @@ behavior. .IP "\fBignore nonreadable\fP" This tells the rsync daemon to completely ignore files that are not readable by the user. This is useful for -public archives that may have some non-readable files among the +public archives that may have some non\-readable files among the directories, and the sysadmin doesn\(cq\&t want those files to be seen at all. .IP .IP "\fBtransfer logging\fP" -This parameter enables per-file +This parameter enables per\-file logging of downloads and uploads in a format somewhat similar to that used by ftp daemons. The daemon always logs the transfer at the end, so if a transfer is aborted, no mention will be made in the log file. @@ -560,7 +560,7 @@ If you want to customize the log lines, .IP "\fBlog format\fP" This parameter allows you to specify the format used for logging file transfers when transfer logging is enabled. -The format is a text string containing embedded single-character escape +The format is a text string containing embedded single\-character escape sequences prefixed with a percent (%) character. An optional numeric field width may also be specified between the percent and the escape letter (e.g. \(dq\&\fB%\-50n %8l %07p\fP\(dq\&). @@ -571,7 +571,7 @@ is always prefixed when using the \(dq\& in the rsync source code distribution in the \(dq\&support\(dq\& subdirectory: rsyncstats.) .IP -The single-character escapes that are understood are as follows: +The single\-character escapes that are understood are as follows: .IP .RS .IP o @@ -597,7 +597,7 @@ The single-character escapes that are un .IP o %m the module name .IP o -%M the last-modified time of the file +%M the last\-modified time of the file .IP o %n the filename (short form; trailing \(dq\&/\(dq\& on dir) .IP o @@ -632,10 +632,10 @@ a 10 minute timeout). .IP .IP "\fBrefuse options\fP" This parameter allows you to -specify a space-separated list of rsync command line options that will +specify a space\-separated list of rsync command line options that will be refused by your rsync daemon. -You may specify the full option name, its one-letter abbreviation, or a -wild-card string that matches multiple options. +You may specify the full option name, its one\-letter abbreviation, or a +wild\-card string that matches multiple options. For example, this would refuse \fB\-\-checksum\fP (\fB\-c\fP) and all the various delete options: .IP @@ -647,8 +647,8 @@ delete options: The reason the above refuses all delete options is that the options imply \fB\-\-delete\fP, and implied options are refused just like explicit options. As an additional safety feature, the refusal of \(dq\&delete\(dq\& also refuses -\fBremove-source-files\fP when the daemon is the sender; if you want the latter -without the former, instead refuse \(dq\&delete\-*\(dq\& \(em that refuses all the +\fBremove\-source\-files\fP when the daemon is the sender; if you want the latter +without the former, instead refuse \(dq\&delete\-*\(dq\& \-\- that refuses all the delete modes without affecting \fB\-\-remove\-source\-files\fP. .IP When an option is refused, the daemon prints an error message and exits. @@ -666,8 +666,8 @@ Compression is expensive in terms of CPU is usually good to not try to compress files that won\(cq\&t compress well, such as already compressed files. .IP -The \(dq\&dont compress\(dq\& parameter takes a space-separated list of -case-insensitive wildcard patterns. Any source filename matching one +The \(dq\&dont compress\(dq\& parameter takes a space\-separated list of +case\-insensitive wildcard patterns. Any source filename matching one of the patterns will not be compressed during transfer. .IP See the \fB\-\-skip\-compress\fP parameter in the \fBrsync\fP(1) manpage for the list @@ -675,13 +675,13 @@ of file suffixes that are not compressed for the \(dq\&dont compress\(dq\& parameter changes the default when the daemon is the sender. .IP -.IP "\fBpre-xfer exec\fP, \fBpost-xfer exec\fP" +.IP "\fBpre\-xfer exec\fP, \fBpost\-xfer exec\fP" You may specify a command to be run -before and/or after the transfer. If the \fBpre-xfer exec\fP command fails, the +before and/or after the transfer. If the \fBpre\-xfer exec\fP command fails, the transfer is aborted before it begins. .IP The following environment variables will be set, though some are -specific to the pre-xfer or the post-xfer environment: +specific to the pre\-xfer or the post\-xfer environment: .IP .RS .IP o @@ -697,21 +697,21 @@ specific to the pre-xfer or the post-xfe .IP o \fBRSYNC_PID\fP: A unique number for this transfer. .IP o -\fBRSYNC_REQUEST\fP: (pre-xfer only) The module/path info specified +\fBRSYNC_REQUEST\fP: (pre\-xfer only) The module/path info specified by the user (note that the user can specify multiple source files, so the request can be something like \(dq\&mod/path1 mod/path2\(dq\&, etc.). .IP o -\fBRSYNC_ARG#\fP: (pre-xfer only) The pre-request arguments are set +\fBRSYNC_ARG#\fP: (pre\-xfer only) The pre\-request arguments are set in these numbered values. RSYNC_ARG0 is always \(dq\&rsyncd\(dq\&, and the last value contains a single period. .IP o -\fBRSYNC_EXIT_STATUS\fP: (post-xfer only) the server side\(cq\&s exit value. +\fBRSYNC_EXIT_STATUS\fP: (post\-xfer only) the server side\(cq\&s exit value. This will be 0 for a successful run, a positive value for an error that the server generated, or a \-1 if rsync failed to exit properly. Note that an error that occurs on the client side does not currently get sent to the server side, so this is not the final exit status for the whole transfer. .IP o -\fBRSYNC_RAW_STATUS\fP: (post-xfer only) the raw exit value from +\fBRSYNC_RAW_STATUS\fP: (post\-xfer only) the raw exit value from \f(CWwaitpid()\fP \&. .RE @@ -726,8 +726,8 @@ module\(cq\&s uid/gid setting) without a .PP The authentication protocol used in rsync is a 128 bit MD4 based challenge response system. This is fairly weak protection, though (with -at least one brute-force hash-finding algorithm publicly available), so -if you want really top-quality security, then I recommend that you run +at least one brute\-force hash\-finding algorithm publicly available), so +if you want really top\-quality security, then I recommend that you run rsync over ssh. (Yes, a future version of rsync will switch over to a stronger hashing method.) .PP @@ -822,7 +822,7 @@ http://rsync.samba.org/ .SH "VERSION" .PP -This man page is current for version 3.0.7 of rsync. +This man page is current for version 3.0.8 of rsync. .PP .SH "CREDITS" @@ -838,7 +838,7 @@ http://rsync.samba.org/ .PP We would be delighted to hear from you if you like this program. .PP -This program uses the zlib compression library written by Jean-loup +This program uses the zlib compression library written by Jean\-loup Gailly and Mark Adler. .PP .SH "THANKS"