mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-05-26 15:55:42 -04:00
Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4177f09b83 | ||
|
|
acaadb55c1 | ||
|
|
b88c2e8ffe | ||
|
|
f4ea5f47dc | ||
|
|
62ae66d43b | ||
|
|
8641d28740 | ||
|
|
de3438407c | ||
|
|
434764269c | ||
|
|
ba212fe0b6 | ||
|
|
5f93b4d35e | ||
|
|
f8db4a8ab4 | ||
|
|
398612ba07 | ||
|
|
77b013afb5 | ||
|
|
08c0cd8a42 | ||
|
|
1c6e9dfabc | ||
|
|
0037bf23fc | ||
|
|
285edc9169 | ||
|
|
c4aa84ad50 | ||
|
|
b635bc92d1 | ||
|
|
146d2228cc | ||
|
|
b2501ccf12 | ||
|
|
e60bba3fbc | ||
|
|
e26cfccf16 | ||
|
|
74f80abce2 | ||
|
|
5899b8cf3e | ||
|
|
08e0a62956 | ||
|
|
2bd17a51ae | ||
|
|
c7b9ebb598 | ||
|
|
e3db43ffe5 | ||
|
|
f61ab01d96 | ||
|
|
ceca8ccac8 | ||
|
|
374c3e1278 | ||
|
|
e09d8a304c | ||
|
|
2a7d9fe9b8 | ||
|
|
e63aeb6d68 | ||
|
|
077d5d4ebc | ||
|
|
e2d774cdd7 | ||
|
|
415b598346 | ||
|
|
69627d66f8 | ||
|
|
ac98cd98e3 | ||
|
|
91d324b4ea | ||
|
|
89fb50263b | ||
|
|
e257c6c20b | ||
|
|
43eae40e45 | ||
|
|
920240a687 | ||
|
|
f8b9da1a2c | ||
|
|
3c987ee956 | ||
|
|
5c6d46329b | ||
|
|
8b3e964d14 | ||
|
|
91a93df049 | ||
|
|
19826af5f0 | ||
|
|
49f4cfdf39 | ||
|
|
b3222792ad | ||
|
|
0640710115 | ||
|
|
fa65989a8b | ||
|
|
4209f079dd | ||
|
|
a7704777ce | ||
|
|
7d51b8374d | ||
|
|
a27042b521 | ||
|
|
5b51c893c5 | ||
|
|
408e69396c | ||
|
|
954bbed84a | ||
|
|
7c329ec72c | ||
|
|
07a8a360a5 | ||
|
|
1618c9e6d1 | ||
|
|
ba0147ac42 | ||
|
|
9e88f057b4 | ||
|
|
f171bf5b8f | ||
|
|
1b1628b90a | ||
|
|
50cf25672e | ||
|
|
b316862831 | ||
|
|
38a4b9c297 |
@@ -91,13 +91,13 @@ t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
|
||||
|
||||
gen:
|
||||
$(MAKE) -C $(srcdir) -f prepare-source.mak gen
|
||||
cd $(srcdir) && $(MAKE) -f prepare-source.mak gen
|
||||
|
||||
man:
|
||||
$(MAKE) -C $(srcdir) -f prepare-source.mak man
|
||||
cd $(srcdir) && $(MAKE) -f prepare-source.mak man
|
||||
|
||||
proto:
|
||||
$(MAKE) -C $(srcdir) -f prepare-source.mak proto.h
|
||||
cd $(srcdir) && $(MAKE) -f prepare-source.mak proto.h
|
||||
|
||||
clean: cleantests
|
||||
rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS) $(CHECK_OBJS)
|
||||
|
||||
341
NEWS
341
NEWS
@@ -1,320 +1,67 @@
|
||||
NEWS for rsync 2.6.7 (11 Mar 2006)
|
||||
|
||||
NEWS for rsync 2.6.8 (22 Apr 2006)
|
||||
Protocol: 29 (unchanged)
|
||||
Changes since 2.6.6:
|
||||
|
||||
OUTPUT CHANGES:
|
||||
|
||||
- The letter 'D' in the itemized output was being used for both devices
|
||||
(character or block) as well as other special files (such as fifos and
|
||||
named sockets). This has changed to separate non-device special files
|
||||
under the 'S' designation (e.g. "cS+++++++ path/fifo"). See also the
|
||||
"--specials" option, below.
|
||||
|
||||
- The way rsync escapes unreadable characters has changed. First, rsync
|
||||
now has support for recognizing valid multibyte character sequences in
|
||||
your current locale, allowing it to escape fewer characters than before
|
||||
for a locale such as UTF-8. Second, it now uses an escape idiom of
|
||||
"\#123", which is the literal string "\#" followed by exactly 3 octal
|
||||
digits. Rsync no longer doubles a backslash character in a filename
|
||||
(e.g. it used to output "foo\\bar" when copying "foo\bar") -- now it only
|
||||
escapes a backslash that is followed by a hash-sign and 3 digits (0-9)
|
||||
(e.g. it will output "foo\#134#789" when copying "foo\#789"). See also
|
||||
the --8-bit-output (-8) option, mentioned below.
|
||||
|
||||
Script writers: the local rsync is the one that outputs escaped names,
|
||||
so if you need to support unescaping of filenames for older rsyncs, I'd
|
||||
suggest that you parse the output of "rsync --version" and only use the
|
||||
old unescaping rules for 2.6.5 and 2.6.6.
|
||||
Changes since 2.6.7:
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- Fixed a really old bug that caused --checksum (-c) to checksum all the
|
||||
files encountered during the delete scan (ouch).
|
||||
- Fixed a bug in the exclude code where an anchored exclude without any
|
||||
wildcards fails to match an absolute source arg, but only when --relative
|
||||
is in effect.
|
||||
|
||||
- Fixed a potential hang in a remote generator: when the receiver gets a
|
||||
read-error on the socket, it now signals the generator about this so that
|
||||
the generator does not try to send any of the terminating error messages
|
||||
to the client (avoiding a potential hang in some setups).
|
||||
- Improved the I/O code for the generator to fix a potential hang when the
|
||||
receiver gets an EOF on the socket but the generator's select() call
|
||||
never indicates that the socket is writable for it to be notified about
|
||||
the EOF. (This can happen when using stunnel).
|
||||
|
||||
- Made hard-links work with symlinks and devices again.
|
||||
- Fixed a problem with the file-reading code where a failed read (such as
|
||||
that caused by a bad sector) would not advance the file's read-position
|
||||
beyond the failed read's data.
|
||||
|
||||
- If the sender gets an early EOF reading a source file, we propagate this
|
||||
error to the receiver so that it can discard the file and try requesting
|
||||
it again (which is the existing behavior for other kinds of read errors).
|
||||
- Fixed a logging bug where the "log file" directive was not being honored
|
||||
in a single-use daemon (one spawned by a remote-shell connection or by
|
||||
init).
|
||||
|
||||
- If a device-file/special-file changes permissions, rsync now updates the
|
||||
permissions without recreating the file.
|
||||
- If rsync cannot honor the --delete option, we output an error and exit
|
||||
instead of silently ignoring the option.
|
||||
|
||||
- If the user specifies a remote-host for both the source and destination,
|
||||
we now output a syntax error rather than trying to open the destination
|
||||
hostspec as a filename.
|
||||
- Fixed a bug in the --link-dest code that prevented special files (such as
|
||||
fifos) from being linked.
|
||||
|
||||
- When --inplace creates a new destination file, rsync now creates it with
|
||||
permissions 0600 instead of 0000 -- this makes restarting possible when
|
||||
the transfer gets interrupted in the middle of sending a new file.
|
||||
|
||||
- Reject the combination of --inplace and --sparse since the sparse-output
|
||||
algorithm doesn't work when overwriting existing data.
|
||||
|
||||
- Fixed the directory name in the error that is output when pop_dir()
|
||||
fails.
|
||||
|
||||
- Really fixed the parsing of a "!" entry in .cvsignore files this time.
|
||||
|
||||
- If the generator gets a stat() error on a file, output it (this used to
|
||||
require at least -vv for the error to be seen).
|
||||
|
||||
- If waitpid() fails or the child rsync didn't exit cleanly, we now handle
|
||||
the exit status properly and generate a better error.
|
||||
|
||||
- Fixed some glitches in the double-verbose output when using --copy-dest,
|
||||
--link-dest, or --compare-dest. Also improved how the verbose output
|
||||
handles hard-links (within the transfer) that had an up-to-date alternate
|
||||
"dest" file, and copied files (via --copy-dest).
|
||||
|
||||
- Fixed the matching of the dont-compress items (e.g. *.gz) against files
|
||||
that have a path component containing a slash.
|
||||
|
||||
- If code reading a filter/exclude file an EINTR error, rsync now clears
|
||||
the error flag on the file handle so it can keep on reading.
|
||||
|
||||
- If --relative is active, the sending side cleans up trailing "/" or "/."
|
||||
suffixes to avoid triggering a bug in older rsync versions. Also, we now
|
||||
reject a ".." dir if it would be sent as a relative dir.
|
||||
|
||||
- If a non-directory is in the way of a directory and rsync is run with
|
||||
--dry-run and --delete, rsync no longer complains about not being able
|
||||
to opendir() the not-yet present directory.
|
||||
|
||||
- When --list-only is used and a non-existent local destination dir was
|
||||
also specified as a destination, rsync no longer generates a warning
|
||||
about being unable to create the missing directory.
|
||||
|
||||
- Fixed some problems with --relative --no-implied-dirs when the
|
||||
destination directory did not yet exist: we can now create a symlink or
|
||||
device when it is the first thing in the missing dir, and --fuzzy no
|
||||
longer complains about being unable to open the missing dir.
|
||||
|
||||
- Fixed a bug where the --copy-links option would not affect implied
|
||||
directories without --copy-unsafe-links (see --relative).
|
||||
|
||||
- Got rid of the need for --force to be used in some circumstances with
|
||||
--delete-after (making it consistent with --delete-before/-during).
|
||||
|
||||
- Rsync now ignores the SIGXFSZ signal, just in case your OS sends this
|
||||
when a file is too large (rsync handles the write error).
|
||||
|
||||
- Fixed a bug in the Proxy-Authorization header's base64-encoded value: it
|
||||
was not properly padded with trailing '=' chars. This only affects a
|
||||
user that need to use a password-authenticated proxy for an outgoing
|
||||
daemon-rsync connection.
|
||||
|
||||
- If we're transferring an empty directory to a new name, rsync no longer
|
||||
forces S_IWUSR if it wasn't already set, nor does it accidentally leave
|
||||
it set.
|
||||
|
||||
- Fixed a bug in the debug output (-vvvvv) that could mention the wrong
|
||||
checksum for the current file offset.
|
||||
|
||||
- Rsync no longer allows a single directory to be copied over a non-
|
||||
directory destination arg.
|
||||
- The ability to hard-link symlinks and special files is now determined at
|
||||
configure time instead of at runtime. This fixes a bug with --link-dest
|
||||
creating a hard-link to a symlink's referent on a BSD system.
|
||||
|
||||
ENHANCEMENTS:
|
||||
|
||||
- Added the --append option that makes rsync append data onto files that
|
||||
are longer on the source than the destination (this includes new files).
|
||||
- In daemon mode, if rsync fails to bind to the requested port, the
|
||||
error(s) returned by socket() and/or bind() are now logged.
|
||||
|
||||
- Added the --min-size=SIZE option to exclude small files from the
|
||||
transfer.
|
||||
- When we output a fatal error, we now output the version of rsync in the
|
||||
message.
|
||||
|
||||
- Added the --compress-level option to allow you to set how aggressive
|
||||
rsync's compression should be (this option implies --compress).
|
||||
- Improved the documentation for the --owner and --group options.
|
||||
|
||||
- Enhanced the parsing of the SIZE value for --min-size and --max-size to
|
||||
allow easy entry of multiples of 1000 (instead of just multiples of 1024)
|
||||
and off-by-one values too (e.g. --max-size=8mb-1).
|
||||
- The rsyncstats script in "support" has an improved line-parsing regex
|
||||
that is easier to read and also makes it to parse syslog-generated lines.
|
||||
|
||||
- Added the --8-bit-output (-8) option, which tells rsync to avoid escaping
|
||||
high-bit characters that it thinks are unreadable in the current locale.
|
||||
|
||||
- The new option --human-readable (-h) changes the output of --progress,
|
||||
--stats, and the end-of-run summary to be easier to read. If repeated,
|
||||
the units become powers of 1024 instead of powers of 1000. (The old
|
||||
meaning of -h, as a shorthand for --help, still works as long as you
|
||||
just use it on its own, as in "rsync -h".)
|
||||
|
||||
- If lutimes() and/or lchmod() are around, use them to allow the
|
||||
preservation of attributes on symlinks.
|
||||
|
||||
- The --link-dest option now affects symlinks and devices (when possible).
|
||||
|
||||
- Added two config items to the rsyncd.conf parsing: "pre-xfer exec" and
|
||||
"post-xfer exec". These allow a command to be specified on a per-module
|
||||
basis that will be run before and/or after a daemon-mode transfer. (See
|
||||
the man page for a list of the environment variables that are set with
|
||||
information about the transfer.)
|
||||
|
||||
- When using the --relative option, you can now insert a dot dir in
|
||||
the source path to indicate where the replication of the source dirs
|
||||
should start. For example, if you specify a source path of
|
||||
rsync://host/module/foo/bar/./baz/dir with -R, rsync will now only
|
||||
replicate the "baz/dir" part of the source path (note: a trailing
|
||||
dot dir is unaffected unless it also has a trailing slash).
|
||||
|
||||
- Added some new --no-FOO options that make it easier to override unwanted
|
||||
implied or default options. For example, "-a --no-o" (aka "--archive
|
||||
--no-owner") can be used to turn off the preservation of file ownership
|
||||
that is implied by -a.
|
||||
|
||||
- Added the --chmod=MODE option that allows the destination permissions to
|
||||
be changed from the source permissions. E.g. --chmod=g+w,o-rwx
|
||||
|
||||
- Added the "incoming chmod" and "outgoing chmod" daemon options that allow
|
||||
a module to specify what permissions changes should be applied to all
|
||||
files copied to and from the daemon.
|
||||
|
||||
- Allow the --temp-dir option to be specified when starting a daemon, which
|
||||
sets the default temporary directory for incoming files.
|
||||
|
||||
- If --delete is combined with --dirs without --recursive, rsync will now
|
||||
delete in any directory whose content is being synchronized.
|
||||
|
||||
- If --backup is combined with --delete without --backup-dir (and without
|
||||
--delete-excluded), we add a "protect" filter-rule to ensure that files
|
||||
with the backup suffix are not deleted.
|
||||
|
||||
- The file-count stats that are output by --progress were improved to
|
||||
better indicate what the numbers mean. For instance, the output:
|
||||
"(xfer#5, to-check=8383/9999)" indicates that this was the fifth file
|
||||
to be transferred, and we still need to check 8383 more files out of
|
||||
a total of 9999.
|
||||
|
||||
- The include/exclude code now allows a dir/*** directive (with 3 trailing
|
||||
stars) to match both the dir itself as well as all the content below the
|
||||
dir (dir/** would not match the dir).
|
||||
|
||||
- Added the --prune-empty-dirs (-m) option that makes the receiving rsync
|
||||
discard empty chains of directories from the file-list. This makes it
|
||||
easier to selectively copy files from a source hierarchy and end up with
|
||||
just the directories needed to hold the resulting files.
|
||||
|
||||
- If the --itemize-changes (-i) option is repeated, rsync now includes
|
||||
unchanged files in the itemized output (similar to -vv, but without all
|
||||
the other verbose messages that can get in the way). Of course, the
|
||||
client must be version 2.6.7 for this to work, but the remote rsync only
|
||||
needs to be 2.6.7 if you're pushing files.
|
||||
|
||||
- Added the --specials option to tell rsync to copy non-device special
|
||||
files (which rsync now attempts even as a normal user). The --devices
|
||||
option now requests the copying of just devices (character and block).
|
||||
The -D option still requests both (e.g. --devices and --specials), -a
|
||||
still implies -D, and non-root users still get a silent downgrade that
|
||||
omits device copying.
|
||||
|
||||
- Added the --super option to make the receiver always attempt super-user
|
||||
activities. This is useful for systems that allow things such as devices
|
||||
to be created or ownership to be set without being UID 0, and is also
|
||||
useful for someone who wants to ensure that errors will be output if the
|
||||
receiving rsync isn't being run as root.
|
||||
|
||||
- Added the --sockopts option for those few who want to customize the TCP
|
||||
options used to contact a daemon rsync.
|
||||
|
||||
- Added a way for the --temp-dir option to be combined with a partial-dir
|
||||
setting that lets rsync avoid non-atomic updates (for those times when
|
||||
--temp-dir is not being used because space is tight).
|
||||
|
||||
- A new support script, files-to-excludes, will transform a list of files
|
||||
into a set of include/exclude directives that will copy those files.
|
||||
|
||||
- A new option, --executability (-E) can be used to preserve just the
|
||||
execute bit on files, for those times when using the --perms option is
|
||||
not desired.
|
||||
|
||||
- The daemon now logs each connection and also each module-list request
|
||||
that it receives.
|
||||
|
||||
- New log-format options: %M (modtime), %U (uid), %G (gid), and %B
|
||||
(permission bits, e.g. "rwxr-xrwt").
|
||||
|
||||
- The --dry-run option no longer forces the enabling of --verbose.
|
||||
|
||||
- The --remove-sent-files option now does a better job of incrementally
|
||||
removing the sent files on the sending side (older versions tended to
|
||||
clump up all the removals at the end).
|
||||
|
||||
- A daemon now supersedes its minimal SIGCHLD handler with the standard
|
||||
PID-remembering version after forking. This ensures that the generator
|
||||
can get the child-exit status from the receiver.
|
||||
|
||||
- Use of the --bwlimit option no longer interferes with the remote rsync
|
||||
sending error messages about invalid/refused options.
|
||||
|
||||
- Rsync no longer returns a usage error when used with one local source arg
|
||||
and no destination: this now implies the --list-only option, just like
|
||||
the comparable situation with a remote source arg.
|
||||
|
||||
- Added the --copy-dirlinks option, a more limited version of --copy-links.
|
||||
|
||||
- Various documentation improvements, including: a better synopsis, some
|
||||
improved examples, a better discussion of the presence and absence of
|
||||
--perms (including how it interacts with the new --executability and
|
||||
--chmod options), an extended discussion of --temp-dir, an improved
|
||||
discussion of --partial-dir, a better description of rsync's pattern
|
||||
matching characters, an improved --no-implied-dirs section, and the
|
||||
documenting of what the --stats option outputs.
|
||||
|
||||
- Various new and updated diffs in the patches dir, including: acls.diff,
|
||||
xattrs.diff, atimes.diff, detect-renamed.diff, and slp.diff.
|
||||
|
||||
INTERNAL:
|
||||
|
||||
- We now use sigaction() and sigprocmask() if possible, and fall back on
|
||||
signal() if not. Using sigprocmask() ensures that rsync enables all the
|
||||
signals that it needs, just in case it was started in a masked state.
|
||||
|
||||
- Some buffer sizes were expanded a bit, particularly on systems where
|
||||
MAXPATHLEN is overly small (e.g. cygwin).
|
||||
|
||||
- If io_printf() tries to format more data than fits in the buffer, exit
|
||||
with an error instead of transmitting a truncated buffer.
|
||||
|
||||
- If a va_copy macro is defined, lib/snprintf.c will use it when defining
|
||||
the VA_COPY macro.
|
||||
|
||||
- Reduced the amount of stack memory needed for each level of directory
|
||||
recursion by nearly MAXPATHLEN bytes.
|
||||
|
||||
- The wildmatch function was extended to allow an array of strings to be
|
||||
supplied as the string to match. This allows the exclude code to do less
|
||||
string copying.
|
||||
|
||||
- Got rid of the safe_fname() function (and all the myriad calls) and
|
||||
replaced it with a new function in the log.c code that filters all the
|
||||
output going to the terminal.
|
||||
|
||||
- Unified the f_name() and the f_name_to() functions.
|
||||
|
||||
- Improved the hash-table code the sender uses to handle checksums to make
|
||||
it use slightly less memory and run just a little faster.
|
||||
- A new script in "support": file-attr-restore, can be used to restore the
|
||||
attributes of a file-set (the permissions, ownership, and group info)
|
||||
taken from the cached output of a "find ARG... -ls" command.
|
||||
|
||||
DEVELOPER RELATED:
|
||||
|
||||
- The diffs in the patches dir now require "patch -p1 <DIFF" instead of
|
||||
the previous -p0. Also, the version included in the release tar now
|
||||
affect generated files (e.g. configure, rsync.1, proto.h, etc.), so
|
||||
it is no longer necessary to run autoconf and/or yodl unless you're
|
||||
applying a patch that was checked out from CVS.
|
||||
- Removed the unused function write_int_named(), the unused variable
|
||||
io_read_phase, and the rarely used variable io_write_phase. This also
|
||||
elides the confusing 'phase "unknown"' part of one error message.
|
||||
|
||||
- Several diffs in the patches dir now use the proper --enable-FOO
|
||||
configure option instead of --with-FOO to turn on the inclusion of
|
||||
the newly patched feature.
|
||||
- Removed two unused configure checks and two related (also unused)
|
||||
compatibility functions.
|
||||
|
||||
- There is a new script, "prepare-source" than can be used to update the
|
||||
various generated files (proto.h, configure, etc.) even before configure
|
||||
has created the Makefile (this is mainly useful when patching the source
|
||||
with a patch that doesn't affect generated files).
|
||||
- The xattrs.diff patch received a security fix that prevents a potential
|
||||
buffer overflow in the receive_xattr() code.
|
||||
|
||||
- The testsuite now sets HOME so that it won't be affected by a file such
|
||||
as ~/.popt.
|
||||
- The acls.diff patch has been improved quite a bit, with more to come.
|
||||
|
||||
- A new patch was added: log-file.diff. This contains an early version of
|
||||
a future option, --log-file=FILE, that will allow any rsync to log its
|
||||
actions to a file (something that only a daemon supports at present).
|
||||
|
||||
327
OLDNEWS
327
OLDNEWS
@@ -1,3 +1,324 @@
|
||||
NEWS for rsync 2.6.7 (11 Mar 2006)
|
||||
Protocol: 29 (unchanged)
|
||||
Changes since 2.6.6:
|
||||
|
||||
OUTPUT CHANGES:
|
||||
|
||||
- The letter 'D' in the itemized output was being used for both devices
|
||||
(character or block) as well as other special files (such as fifos and
|
||||
named sockets). This has changed to separate non-device special files
|
||||
under the 'S' designation (e.g. "cS+++++++ path/fifo"). See also the
|
||||
"--specials" option, below.
|
||||
|
||||
- The way rsync escapes unreadable characters has changed. First, rsync
|
||||
now has support for recognizing valid multibyte character sequences in
|
||||
your current locale, allowing it to escape fewer characters than before
|
||||
for a locale such as UTF-8. Second, it now uses an escape idiom of
|
||||
"\#123", which is the literal string "\#" followed by exactly 3 octal
|
||||
digits. Rsync no longer doubles a backslash character in a filename
|
||||
(e.g. it used to output "foo\\bar" when copying "foo\bar") -- now it only
|
||||
escapes a backslash that is followed by a hash-sign and 3 digits (0-9)
|
||||
(e.g. it will output "foo\#134#789" when copying "foo\#789"). See also
|
||||
the --8-bit-output (-8) option, mentioned below.
|
||||
|
||||
Script writers: the local rsync is the one that outputs escaped names,
|
||||
so if you need to support unescaping of filenames for older rsyncs, I'd
|
||||
suggest that you parse the output of "rsync --version" and only use the
|
||||
old unescaping rules for 2.6.5 and 2.6.6.
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- Fixed a really old bug that caused --checksum (-c) to checksum all the
|
||||
files encountered during the delete scan (ouch).
|
||||
|
||||
- Fixed a potential hang in a remote generator: when the receiver gets a
|
||||
read-error on the socket, it now signals the generator about this so that
|
||||
the generator does not try to send any of the terminating error messages
|
||||
to the client (avoiding a potential hang in some setups).
|
||||
|
||||
- Made hard-links work with symlinks and devices again.
|
||||
|
||||
- If the sender gets an early EOF reading a source file, we propagate this
|
||||
error to the receiver so that it can discard the file and try requesting
|
||||
it again (which is the existing behavior for other kinds of read errors).
|
||||
|
||||
- If a device-file/special-file changes permissions, rsync now updates the
|
||||
permissions without recreating the file.
|
||||
|
||||
- If the user specifies a remote-host for both the source and destination,
|
||||
we now output a syntax error rather than trying to open the destination
|
||||
hostspec as a filename.
|
||||
|
||||
- When --inplace creates a new destination file, rsync now creates it with
|
||||
permissions 0600 instead of 0000 -- this makes restarting possible when
|
||||
the transfer gets interrupted in the middle of sending a new file.
|
||||
|
||||
- Reject the combination of --inplace and --sparse since the sparse-output
|
||||
algorithm doesn't work when overwriting existing data.
|
||||
|
||||
- Fixed the directory name in the error that is output when pop_dir()
|
||||
fails.
|
||||
|
||||
- Really fixed the parsing of a "!" entry in .cvsignore files this time.
|
||||
|
||||
- If the generator gets a stat() error on a file, output it (this used to
|
||||
require at least -vv for the error to be seen).
|
||||
|
||||
- If waitpid() fails or the child rsync didn't exit cleanly, we now handle
|
||||
the exit status properly and generate a better error.
|
||||
|
||||
- Fixed some glitches in the double-verbose output when using --copy-dest,
|
||||
--link-dest, or --compare-dest. Also improved how the verbose output
|
||||
handles hard-links (within the transfer) that had an up-to-date alternate
|
||||
"dest" file, and copied files (via --copy-dest).
|
||||
|
||||
- Fixed the matching of the dont-compress items (e.g. *.gz) against files
|
||||
that have a path component containing a slash.
|
||||
|
||||
- If code reading a filter/exclude file an EINTR error, rsync now clears
|
||||
the error flag on the file handle so it can keep on reading.
|
||||
|
||||
- If --relative is active, the sending side cleans up trailing "/" or "/."
|
||||
suffixes to avoid triggering a bug in older rsync versions. Also, we now
|
||||
reject a ".." dir if it would be sent as a relative dir.
|
||||
|
||||
- If a non-directory is in the way of a directory and rsync is run with
|
||||
--dry-run and --delete, rsync no longer complains about not being able
|
||||
to opendir() the not-yet present directory.
|
||||
|
||||
- When --list-only is used and a non-existent local destination dir was
|
||||
also specified as a destination, rsync no longer generates a warning
|
||||
about being unable to create the missing directory.
|
||||
|
||||
- Fixed some problems with --relative --no-implied-dirs when the
|
||||
destination directory did not yet exist: we can now create a symlink or
|
||||
device when it is the first thing in the missing dir, and --fuzzy no
|
||||
longer complains about being unable to open the missing dir.
|
||||
|
||||
- Fixed a bug where the --copy-links option would not affect implied
|
||||
directories without --copy-unsafe-links (see --relative).
|
||||
|
||||
- Got rid of the need for --force to be used in some circumstances with
|
||||
--delete-after (making it consistent with --delete-before/-during).
|
||||
|
||||
- Rsync now ignores the SIGXFSZ signal, just in case your OS sends this
|
||||
when a file is too large (rsync handles the write error).
|
||||
|
||||
- Fixed a bug in the Proxy-Authorization header's base64-encoded value: it
|
||||
was not properly padded with trailing '=' chars. This only affects a
|
||||
user that need to use a password-authenticated proxy for an outgoing
|
||||
daemon-rsync connection.
|
||||
|
||||
- If we're transferring an empty directory to a new name, rsync no longer
|
||||
forces S_IWUSR if it wasn't already set, nor does it accidentally leave
|
||||
it set.
|
||||
|
||||
- Fixed a bug in the debug output (-vvvvv) that could mention the wrong
|
||||
checksum for the current file offset.
|
||||
|
||||
- Rsync no longer allows a single directory to be copied over a non-
|
||||
directory destination arg.
|
||||
|
||||
ENHANCEMENTS:
|
||||
|
||||
- Added the --append option that makes rsync append data onto files that
|
||||
are longer on the source than the destination (this includes new files).
|
||||
|
||||
- Added the --min-size=SIZE option to exclude small files from the
|
||||
transfer.
|
||||
|
||||
- Added the --compress-level option to allow you to set how aggressive
|
||||
rsync's compression should be (this option implies --compress).
|
||||
|
||||
- Enhanced the parsing of the SIZE value for --min-size and --max-size to
|
||||
allow easy entry of multiples of 1000 (instead of just multiples of 1024)
|
||||
and off-by-one values too (e.g. --max-size=8mb-1).
|
||||
|
||||
- Added the --8-bit-output (-8) option, which tells rsync to avoid escaping
|
||||
high-bit characters that it thinks are unreadable in the current locale.
|
||||
|
||||
- The new option --human-readable (-h) changes the output of --progress,
|
||||
--stats, and the end-of-run summary to be easier to read. If repeated,
|
||||
the units become powers of 1024 instead of powers of 1000. (The old
|
||||
meaning of -h, as a shorthand for --help, still works as long as you
|
||||
just use it on its own, as in "rsync -h".)
|
||||
|
||||
- If lutimes() and/or lchmod() are around, use them to allow the
|
||||
preservation of attributes on symlinks.
|
||||
|
||||
- The --link-dest option now affects symlinks and devices (when possible).
|
||||
|
||||
- Added two config items to the rsyncd.conf parsing: "pre-xfer exec" and
|
||||
"post-xfer exec". These allow a command to be specified on a per-module
|
||||
basis that will be run before and/or after a daemon-mode transfer. (See
|
||||
the man page for a list of the environment variables that are set with
|
||||
information about the transfer.)
|
||||
|
||||
- When using the --relative option, you can now insert a dot dir in
|
||||
the source path to indicate where the replication of the source dirs
|
||||
should start. For example, if you specify a source path of
|
||||
rsync://host/module/foo/bar/./baz/dir with -R, rsync will now only
|
||||
replicate the "baz/dir" part of the source path (note: a trailing
|
||||
dot dir is unaffected unless it also has a trailing slash).
|
||||
|
||||
- Added some new --no-FOO options that make it easier to override unwanted
|
||||
implied or default options. For example, "-a --no-o" (aka "--archive
|
||||
--no-owner") can be used to turn off the preservation of file ownership
|
||||
that is implied by -a.
|
||||
|
||||
- Added the --chmod=MODE option that allows the destination permissions to
|
||||
be changed from the source permissions. E.g. --chmod=g+w,o-rwx
|
||||
|
||||
- Added the "incoming chmod" and "outgoing chmod" daemon options that allow
|
||||
a module to specify what permissions changes should be applied to all
|
||||
files copied to and from the daemon.
|
||||
|
||||
- Allow the --temp-dir option to be specified when starting a daemon, which
|
||||
sets the default temporary directory for incoming files.
|
||||
|
||||
- If --delete is combined with --dirs without --recursive, rsync will now
|
||||
delete in any directory whose content is being synchronized.
|
||||
|
||||
- If --backup is combined with --delete without --backup-dir (and without
|
||||
--delete-excluded), we add a "protect" filter-rule to ensure that files
|
||||
with the backup suffix are not deleted.
|
||||
|
||||
- The file-count stats that are output by --progress were improved to
|
||||
better indicate what the numbers mean. For instance, the output:
|
||||
"(xfer#5, to-check=8383/9999)" indicates that this was the fifth file
|
||||
to be transferred, and we still need to check 8383 more files out of
|
||||
a total of 9999.
|
||||
|
||||
- The include/exclude code now allows a dir/*** directive (with 3 trailing
|
||||
stars) to match both the dir itself as well as all the content below the
|
||||
dir (dir/** would not match the dir).
|
||||
|
||||
- Added the --prune-empty-dirs (-m) option that makes the receiving rsync
|
||||
discard empty chains of directories from the file-list. This makes it
|
||||
easier to selectively copy files from a source hierarchy and end up with
|
||||
just the directories needed to hold the resulting files.
|
||||
|
||||
- If the --itemize-changes (-i) option is repeated, rsync now includes
|
||||
unchanged files in the itemized output (similar to -vv, but without all
|
||||
the other verbose messages that can get in the way). Of course, the
|
||||
client must be version 2.6.7 for this to work, but the remote rsync only
|
||||
needs to be 2.6.7 if you're pushing files.
|
||||
|
||||
- Added the --specials option to tell rsync to copy non-device special
|
||||
files (which rsync now attempts even as a normal user). The --devices
|
||||
option now requests the copying of just devices (character and block).
|
||||
The -D option still requests both (e.g. --devices and --specials), -a
|
||||
still implies -D, and non-root users still get a silent downgrade that
|
||||
omits device copying.
|
||||
|
||||
- Added the --super option to make the receiver always attempt super-user
|
||||
activities. This is useful for systems that allow things such as devices
|
||||
to be created or ownership to be set without being UID 0, and is also
|
||||
useful for someone who wants to ensure that errors will be output if the
|
||||
receiving rsync isn't being run as root.
|
||||
|
||||
- Added the --sockopts option for those few who want to customize the TCP
|
||||
options used to contact a daemon rsync.
|
||||
|
||||
- Added a way for the --temp-dir option to be combined with a partial-dir
|
||||
setting that lets rsync avoid non-atomic updates (for those times when
|
||||
--temp-dir is not being used because space is tight).
|
||||
|
||||
- A new support script, files-to-excludes, will transform a list of files
|
||||
into a set of include/exclude directives that will copy those files.
|
||||
|
||||
- A new option, --executability (-E) can be used to preserve just the
|
||||
execute bit on files, for those times when using the --perms option is
|
||||
not desired.
|
||||
|
||||
- The daemon now logs each connection and also each module-list request
|
||||
that it receives.
|
||||
|
||||
- New log-format options: %M (modtime), %U (uid), %G (gid), and %B
|
||||
(permission bits, e.g. "rwxr-xrwt").
|
||||
|
||||
- The --dry-run option no longer forces the enabling of --verbose.
|
||||
|
||||
- The --remove-sent-files option now does a better job of incrementally
|
||||
removing the sent files on the sending side (older versions tended to
|
||||
clump up all the removals at the end).
|
||||
|
||||
- A daemon now supersedes its minimal SIGCHLD handler with the standard
|
||||
PID-remembering version after forking. This ensures that the generator
|
||||
can get the child-exit status from the receiver.
|
||||
|
||||
- Use of the --bwlimit option no longer interferes with the remote rsync
|
||||
sending error messages about invalid/refused options.
|
||||
|
||||
- Rsync no longer returns a usage error when used with one local source arg
|
||||
and no destination: this now implies the --list-only option, just like
|
||||
the comparable situation with a remote source arg.
|
||||
|
||||
- Added the --copy-dirlinks option, a more limited version of --copy-links.
|
||||
|
||||
- Various documentation improvements, including: a better synopsis, some
|
||||
improved examples, a better discussion of the presence and absence of
|
||||
--perms (including how it interacts with the new --executability and
|
||||
--chmod options), an extended discussion of --temp-dir, an improved
|
||||
discussion of --partial-dir, a better description of rsync's pattern
|
||||
matching characters, an improved --no-implied-dirs section, and the
|
||||
documenting of what the --stats option outputs.
|
||||
|
||||
- Various new and updated diffs in the patches dir, including: acls.diff,
|
||||
xattrs.diff, atimes.diff, detect-renamed.diff, and slp.diff.
|
||||
|
||||
INTERNAL:
|
||||
|
||||
- We now use sigaction() and sigprocmask() if possible, and fall back on
|
||||
signal() if not. Using sigprocmask() ensures that rsync enables all the
|
||||
signals that it needs, just in case it was started in a masked state.
|
||||
|
||||
- Some buffer sizes were expanded a bit, particularly on systems where
|
||||
MAXPATHLEN is overly small (e.g. cygwin).
|
||||
|
||||
- If io_printf() tries to format more data than fits in the buffer, exit
|
||||
with an error instead of transmitting a truncated buffer.
|
||||
|
||||
- If a va_copy macro is defined, lib/snprintf.c will use it when defining
|
||||
the VA_COPY macro.
|
||||
|
||||
- Reduced the amount of stack memory needed for each level of directory
|
||||
recursion by nearly MAXPATHLEN bytes.
|
||||
|
||||
- The wildmatch function was extended to allow an array of strings to be
|
||||
supplied as the string to match. This allows the exclude code to do less
|
||||
string copying.
|
||||
|
||||
- Got rid of the safe_fname() function (and all the myriad calls) and
|
||||
replaced it with a new function in the log.c code that filters all the
|
||||
output going to the terminal.
|
||||
|
||||
- Unified the f_name() and the f_name_to() functions.
|
||||
|
||||
- Improved the hash-table code the sender uses to handle checksums to make
|
||||
it use slightly less memory and run just a little faster.
|
||||
|
||||
DEVELOPER RELATED:
|
||||
|
||||
- The diffs in the patches dir now require "patch -p1 <DIFF" instead of
|
||||
the previous -p0. Also, the version included in the release tar now
|
||||
affect generated files (e.g. configure, rsync.1, proto.h, etc.), so
|
||||
it is no longer necessary to run autoconf and/or yodl unless you're
|
||||
applying a patch that was checked out from CVS.
|
||||
|
||||
- Several diffs in the patches dir now use the proper --enable-FOO
|
||||
configure option instead of --with-FOO to turn on the inclusion of
|
||||
the newly patched feature.
|
||||
|
||||
- There is a new script, "prepare-source" than can be used to update the
|
||||
various generated files (proto.h, configure, etc.) even before configure
|
||||
has created the Makefile (this is mainly useful when patching the source
|
||||
with a patch that doesn't affect generated files).
|
||||
|
||||
- The testsuite now sets HOME so that it won't be affected by a file such
|
||||
as ~/.popt.
|
||||
|
||||
|
||||
NEWS for rsync 2.6.6 (28 Jul 2005)
|
||||
Protocol: 29 (unchanged)
|
||||
Changes since 2.6.5:
|
||||
@@ -770,6 +1091,8 @@ Changes since 2.6.2:
|
||||
user chose to combine the output of rsync's stdout and stderr (e.g.
|
||||
using the "2>&1").
|
||||
|
||||
- Fixed an option-parsing bug when --files-from got passed to a daemon.
|
||||
|
||||
ENHANCEMENTS:
|
||||
|
||||
- Added the --partial-dir=DIR option that lets you specify where to
|
||||
@@ -1036,6 +1359,9 @@ Changes since 2.6.0:
|
||||
- Fixed the ability to request an empty backup --suffix when sending
|
||||
files to an rsync daemon.
|
||||
|
||||
- Fixed an option-parsing bug when --files-from was sent to a server
|
||||
sender.
|
||||
|
||||
INTERNAL:
|
||||
|
||||
- Most of the I/O is now buffered, which results in a pretty large
|
||||
@@ -1687,6 +2013,7 @@ Changes since 2.4.6:
|
||||
|
||||
Partial Protocol History
|
||||
RELEASE DATE VER. DATE OF COMMIT* PROTOCOL
|
||||
22 Apr 2006 2.6.8 29
|
||||
11 Mar 2006 2.6.7 29
|
||||
28 Jul 2005 2.6.6 29
|
||||
01 Jun 2005 2.6.5 29
|
||||
|
||||
@@ -728,19 +728,21 @@ static void send_listing(int fd)
|
||||
int start_daemon(int f_in, int f_out)
|
||||
{
|
||||
char line[1024];
|
||||
char *motd;
|
||||
char *addr = client_addr(f_in);
|
||||
char *host = client_name(f_in);
|
||||
char *motd, *addr, *host;
|
||||
int i;
|
||||
|
||||
rprintf(FLOG, "connect from %s (%s)\n", host, addr);
|
||||
|
||||
io_set_sock_fds(f_in, f_out);
|
||||
|
||||
/* We must load the config file before calling any function that
|
||||
* might cause log-file output to occur. This ensures that the
|
||||
* "log file" param gets honored for the 2 non-forked use-cases
|
||||
* (when rsync is run by init and run by a remote shell). */
|
||||
if (!lp_load(config_file, 0))
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
|
||||
log_init();
|
||||
addr = client_addr(f_in);
|
||||
host = client_name(f_in);
|
||||
rprintf(FLOG, "connect from %s (%s)\n", host, addr);
|
||||
|
||||
if (!am_server) {
|
||||
set_socket_options(f_in, "SO_KEEPALIVE");
|
||||
|
||||
80
configure.in
80
configure.in
@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
RSYNC_VERSION=2.6.7
|
||||
RSYNC_VERSION=2.6.8
|
||||
AC_SUBST(RSYNC_VERSION)
|
||||
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
|
||||
|
||||
@@ -502,8 +502,7 @@ if test $ac_cv_func_getpgrp = yes; then
|
||||
AC_FUNC_GETPGRP
|
||||
fi
|
||||
|
||||
# Determine whether chown follows symlinks (it should).
|
||||
AC_CACHE_CHECK([whether chown() dereferences symlinks],rsync_cv_chown_follows_symlink,[
|
||||
AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
|
||||
AC_TRY_RUN([
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
@@ -514,14 +513,52 @@ AC_CACHE_CHECK([whether chown() dereferences symlinks],rsync_cv_chown_follows_sy
|
||||
char const *dangling_symlink = "conftest.dangle";
|
||||
unlink(dangling_symlink);
|
||||
if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
|
||||
if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(0);
|
||||
exit(1);
|
||||
if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_chown_follows_symlink=yes,rsync_cv_chown_follows_symlink=no,rsync_cv_chown_follows_symlink=yes)])
|
||||
if test $rsync_cv_chown_follows_symlink = no; then
|
||||
rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
|
||||
if test $rsync_cv_chown_modifies_symlink = yes; then
|
||||
AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
|
||||
AC_TRY_RUN([
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#define FILENAME "conftest.dangle"
|
||||
main() {
|
||||
unlink(FILENAME);
|
||||
if (symlink("conftest.no-such", FILENAME) < 0) abort();
|
||||
if (link(FILENAME, FILENAME "2") < 0) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
|
||||
if test $rsync_cv_can_hardlink_symlink = yes; then
|
||||
AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
|
||||
AC_TRY_RUN([
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#define FILENAME "conftest.fifi"
|
||||
main() {
|
||||
unlink(FILENAME);
|
||||
if (mkfifo(FILENAME, 0777) < 0) abort();
|
||||
if (link(FILENAME, FILENAME "2") < 0) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
|
||||
if test $rsync_cv_can_hardlink_special = yes; then
|
||||
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
@@ -650,35 +687,6 @@ if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
main() { struct in_addr ip; ip.s_addr = 0x12345678;
|
||||
if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
|
||||
strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); }
|
||||
exit(0);}],
|
||||
rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)])
|
||||
if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then
|
||||
AC_DEFINE(REPLACE_INET_NTOA, 1, [Define to 1 if inet_ntoa() needs to be replaced])
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
main() { struct in_addr ip;
|
||||
if (inet_aton("example", &ip) == 0) exit(0); exit(1);}],
|
||||
rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)])
|
||||
if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then
|
||||
AC_DEFINE(REPLACE_INET_ATON, 1, [Define to 1 if inet_aton() needs to be replaced])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -34,8 +34,6 @@ extern int list_only;
|
||||
extern int recurse;
|
||||
extern int io_error;
|
||||
extern int local_server;
|
||||
extern int saw_delete_opt;
|
||||
extern int saw_delete_excluded_opt;
|
||||
extern int prune_empty_dirs;
|
||||
extern int delete_mode;
|
||||
extern int delete_excluded;
|
||||
@@ -562,7 +560,7 @@ static int rule_matches(char *name, struct filter_struct *ex, int name_is_dir)
|
||||
if (litmatch_array(pattern, strings, slash_handling))
|
||||
return ret_match;
|
||||
} else if (anchored_match) {
|
||||
if (strcmp(name,pattern) == 0)
|
||||
if (strcmp(strings[0], pattern) == 0)
|
||||
return ret_match;
|
||||
} else {
|
||||
int l1 = strlen(name);
|
||||
@@ -1185,8 +1183,8 @@ void recv_filter_list(int f_in)
|
||||
char line[BIGPATHBUFLEN];
|
||||
int xflags = protocol_version >= 29 ? 0 : XFLG_OLD_PREFIXES;
|
||||
int receiver_wants_list = prune_empty_dirs
|
||||
|| (saw_delete_opt
|
||||
&& (!saw_delete_excluded_opt || protocol_version >= 29));
|
||||
|| (delete_mode
|
||||
&& (!delete_excluded || protocol_version >= 29));
|
||||
unsigned int len;
|
||||
|
||||
if (!local_server && (am_sender || receiver_wants_list)) {
|
||||
|
||||
2
fileio.c
2
fileio.c
@@ -232,7 +232,6 @@ char *map_ptr(struct map_struct *map, OFF_T offset, int32 len)
|
||||
}
|
||||
map->p_fd_offset = read_start;
|
||||
}
|
||||
map->p_fd_offset += read_size;
|
||||
map->p_offset = window_start;
|
||||
map->p_len = window_size;
|
||||
|
||||
@@ -246,6 +245,7 @@ char *map_ptr(struct map_struct *map, OFF_T offset, int32 len)
|
||||
memset(map->p + read_offset, 0, read_size);
|
||||
break;
|
||||
}
|
||||
map->p_fd_offset += nread;
|
||||
read_offset += nread;
|
||||
read_size -= nread;
|
||||
}
|
||||
|
||||
5
flist.c
5
flist.c
@@ -57,7 +57,6 @@ extern int copy_links;
|
||||
extern int copy_unsafe_links;
|
||||
extern int protocol_version;
|
||||
extern int sanitize_paths;
|
||||
extern const char *io_write_phase;
|
||||
extern struct stats stats;
|
||||
extern struct file_list *the_file_list;
|
||||
|
||||
@@ -334,8 +333,6 @@ static void send_file_entry(struct file_struct *file, int f)
|
||||
return;
|
||||
}
|
||||
|
||||
io_write_phase = "send_file_entry";
|
||||
|
||||
f_name(file, fname);
|
||||
|
||||
flags = file->flags & XMIT_TOP_DIR;
|
||||
@@ -487,8 +484,6 @@ static void send_file_entry(struct file_struct *file, int f)
|
||||
}
|
||||
|
||||
strlcpy(lastname, fname, MAXPATHLEN);
|
||||
|
||||
io_write_phase = "unknown";
|
||||
}
|
||||
|
||||
static struct file_struct *receive_file_entry(struct file_list *flist,
|
||||
|
||||
53
generator.c
53
generator.c
@@ -94,8 +94,6 @@ extern struct file_list *the_file_list;
|
||||
extern struct filter_list_struct server_filter_list;
|
||||
|
||||
static int deletion_count = 0; /* used to implement --max-delete */
|
||||
static int can_link_symlinks = 1; /* start out optimistic */
|
||||
static int can_link_devices = 1;
|
||||
|
||||
/* For calling delete_file() */
|
||||
#define DEL_FORCE_RECURSE (1<<1) /* recurse even w/o --force */
|
||||
@@ -702,12 +700,12 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
||||
/* This is only called for non-regular files. We return -2 if we've finished
|
||||
* handling the file, or -1 if no dest-linking occurred. */
|
||||
static int try_dests_non(struct file_struct *file, char *fname, int ndx,
|
||||
int itemizing, int *possible_ptr,
|
||||
int maybe_ATTRS_REPORT, enum logcode code)
|
||||
int itemizing, int maybe_ATTRS_REPORT,
|
||||
enum logcode code)
|
||||
{
|
||||
char fnamebuf[MAXPATHLEN], lnk[MAXPATHLEN];
|
||||
char fnamebuf[MAXPATHLEN];
|
||||
STRUCT_STAT st;
|
||||
int len, i = 0;
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
pathjoin(fnamebuf, MAXPATHLEN, basis_dir[i], fname);
|
||||
@@ -716,20 +714,38 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
|
||||
continue;
|
||||
if (S_ISLNK(file->mode)) {
|
||||
#ifdef SUPPORT_LINKS
|
||||
char lnk[MAXPATHLEN];
|
||||
int len;
|
||||
if ((len = readlink(fnamebuf, lnk, MAXPATHLEN-1)) <= 0)
|
||||
continue;
|
||||
lnk[len] = '\0';
|
||||
if (strcmp(lnk, file->u.link) != 0)
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
} else if (IS_SPECIAL(file->mode)) {
|
||||
if (!IS_SPECIAL(st.st_mode) || st.st_rdev != file->u.rdev)
|
||||
continue;
|
||||
} else if (IS_DEVICE(file->mode)) {
|
||||
if (!IS_DEVICE(st.st_mode) || st.st_rdev != file->u.rdev)
|
||||
continue;
|
||||
} else {
|
||||
rprintf(FERROR,
|
||||
"internal: try_dests_non() called with invalid mode (%o)\n",
|
||||
file->mode);
|
||||
exit_cleanup(RERR_UNSUPPORTED);
|
||||
}
|
||||
if (link_dest) {
|
||||
if (link_dest
|
||||
#ifndef CAN_HARDLINK_SYMLINK
|
||||
&& !S_ISLNK(file->mode)
|
||||
#endif
|
||||
#ifndef CAN_HARDLINK_SPECIAL
|
||||
&& !IS_SPECIAL(file->mode) && !IS_DEVICE(file->mode)
|
||||
#endif
|
||||
) {
|
||||
if (do_link(fnamebuf, fname) < 0) {
|
||||
/* TODO improve this to be based on errno? */
|
||||
*possible_ptr = 0;
|
||||
rsyserr(FERROR, errno,
|
||||
"failed to hard-link %s with %s",
|
||||
fnamebuf, fname);
|
||||
break;
|
||||
}
|
||||
if (preserve_hard_links && file->link_u.links)
|
||||
@@ -960,10 +976,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
return;
|
||||
if (!S_ISLNK(st.st_mode))
|
||||
statret = -1;
|
||||
} else if (basis_dir[0] != NULL && can_link_symlinks) {
|
||||
} else if (basis_dir[0] != NULL) {
|
||||
if (try_dests_non(file, fname, ndx, itemizing,
|
||||
&can_link_symlinks,
|
||||
maybe_ATTRS_REPORT, code) == -2) {
|
||||
#ifndef CAN_HARDLINK_SYMLINK
|
||||
if (link_dest) {
|
||||
/* Resort to --copy-dest behavior. */
|
||||
} else
|
||||
#endif
|
||||
if (!copy_dest)
|
||||
return;
|
||||
itemizing = code = 0;
|
||||
@@ -1000,11 +1020,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
|
||||
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
|
||||
|| (preserve_specials && IS_SPECIAL(file->mode))) {
|
||||
if (statret != 0
|
||||
&& (basis_dir[0] != NULL && can_link_devices)) {
|
||||
if (statret != 0 && basis_dir[0] != NULL) {
|
||||
if (try_dests_non(file, fname, ndx, itemizing,
|
||||
&can_link_devices,
|
||||
maybe_ATTRS_REPORT, code) == -2) {
|
||||
#ifndef CAN_HARDLINK_SPECIAL
|
||||
if (link_dest) {
|
||||
/* Resort to --copy-dest behavior. */
|
||||
} else
|
||||
#endif
|
||||
if (!copy_dest)
|
||||
return;
|
||||
itemizing = code = 0;
|
||||
|
||||
146
io.c
146
io.c
@@ -63,22 +63,6 @@ int ignore_timeout = 0;
|
||||
int batch_fd = -1;
|
||||
int batch_gen_fd = -1;
|
||||
|
||||
/**
|
||||
* The connection might be dropped at some point; perhaps because the
|
||||
* remote instance crashed. Just giving the offset on the stream is
|
||||
* not very helpful. So instead we try to make io_phase_name point to
|
||||
* something useful.
|
||||
*
|
||||
* For buffered/multiplexed I/O these names will be somewhat
|
||||
* approximate; perhaps for ease of support we would rather make the
|
||||
* buffer always flush when a single application-level I/O finishes.
|
||||
*
|
||||
* @todo Perhaps we want some simple stack functionality, but there's
|
||||
* no need to overdo it.
|
||||
**/
|
||||
const char *io_write_phase = phase_unknown;
|
||||
const char *io_read_phase = phase_unknown;
|
||||
|
||||
/* Ignore an EOF error if non-zero. See whine_about_eof(). */
|
||||
int kluge_around_eof = 0;
|
||||
|
||||
@@ -102,7 +86,7 @@ static char io_filesfrom_buf[2048];
|
||||
static char *io_filesfrom_bp;
|
||||
static char io_filesfrom_lastchar;
|
||||
static int io_filesfrom_buflen;
|
||||
static size_t contiguous_write_len = 0;
|
||||
static int defer_forwarding_messages = 0;
|
||||
static int select_timeout = SELECT_TIMEOUT;
|
||||
static int active_filecnt = 0;
|
||||
static OFF_T active_bytecnt = 0;
|
||||
@@ -122,15 +106,15 @@ static struct flist_ndx_list redo_list, hlink_list;
|
||||
|
||||
struct msg_list_item {
|
||||
struct msg_list_item *next;
|
||||
char *buf;
|
||||
int len;
|
||||
char buf[1];
|
||||
};
|
||||
|
||||
struct msg_list {
|
||||
struct msg_list_item *head, *tail;
|
||||
};
|
||||
|
||||
static struct msg_list msg_list;
|
||||
static struct msg_list msg2genr, msg2sndr;
|
||||
|
||||
static void flist_ndx_push(struct flist_ndx_list *lp, int ndx)
|
||||
{
|
||||
@@ -226,23 +210,22 @@ void set_msg_fd_out(int fd)
|
||||
}
|
||||
|
||||
/* Add a message to the pending MSG_* list. */
|
||||
static void msg_list_add(int code, char *buf, int len)
|
||||
static void msg_list_add(struct msg_list *lst, int code, char *buf, int len)
|
||||
{
|
||||
struct msg_list_item *ml;
|
||||
struct msg_list_item *m;
|
||||
int sz = len + 4 + sizeof m[0] - 1;
|
||||
|
||||
if (!(ml = new(struct msg_list_item)))
|
||||
if (!(m = (struct msg_list_item *)new_array(char, sz)))
|
||||
out_of_memory("msg_list_add");
|
||||
ml->next = NULL;
|
||||
if (!(ml->buf = new_array(char, len+4)))
|
||||
out_of_memory("msg_list_add");
|
||||
SIVAL(ml->buf, 0, ((code+MPLEX_BASE)<<24) | len);
|
||||
memcpy(ml->buf+4, buf, len);
|
||||
ml->len = len+4;
|
||||
if (msg_list.tail)
|
||||
msg_list.tail->next = ml;
|
||||
m->next = NULL;
|
||||
m->len = len + 4;
|
||||
SIVAL(m->buf, 0, ((code+MPLEX_BASE)<<24) | len);
|
||||
memcpy(m->buf + 4, buf, len);
|
||||
if (lst->tail)
|
||||
lst->tail->next = m;
|
||||
else
|
||||
msg_list.head = ml;
|
||||
msg_list.tail = ml;
|
||||
lst->head = m;
|
||||
lst->tail = m;
|
||||
}
|
||||
|
||||
/* Read a message from the MSG_* fd and handle it. This is called either
|
||||
@@ -290,7 +273,10 @@ static void read_msg_fd(void)
|
||||
exit_cleanup(RERR_STREAMIO);
|
||||
}
|
||||
read_loop(fd, buf, len);
|
||||
io_multiplex_write(MSG_DELETED, buf, len);
|
||||
if (defer_forwarding_messages)
|
||||
msg_list_add(&msg2sndr, MSG_DELETED, buf, len);
|
||||
else
|
||||
io_multiplex_write(MSG_DELETED, buf, len);
|
||||
break;
|
||||
case MSG_SUCCESS:
|
||||
if (len != 4 || !am_generator) {
|
||||
@@ -300,7 +286,10 @@ static void read_msg_fd(void)
|
||||
read_loop(fd, buf, len);
|
||||
if (remove_sent_files) {
|
||||
decrement_active_files(IVAL(buf,0));
|
||||
io_multiplex_write(MSG_SUCCESS, buf, len);
|
||||
if (defer_forwarding_messages)
|
||||
msg_list_add(&msg2sndr, MSG_SUCCESS, buf, len);
|
||||
else
|
||||
io_multiplex_write(MSG_SUCCESS, buf, len);
|
||||
}
|
||||
if (preserve_hard_links)
|
||||
flist_ndx_push(&hlink_list, IVAL(buf,0));
|
||||
@@ -320,12 +309,16 @@ static void read_msg_fd(void)
|
||||
if (n >= sizeof buf)
|
||||
n = sizeof buf - 1;
|
||||
read_loop(fd, buf, n);
|
||||
rwrite((enum logcode)tag, buf, n);
|
||||
if (am_generator && am_server && defer_forwarding_messages)
|
||||
msg_list_add(&msg2sndr, tag, buf, n);
|
||||
else
|
||||
rwrite((enum logcode)tag, buf, n);
|
||||
len -= n;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rprintf(FERROR, "unknown message %d:%d\n", tag, len);
|
||||
rprintf(FERROR, "unknown message %d:%d [%s]\n",
|
||||
tag, len, who_am_i());
|
||||
exit_cleanup(RERR_STREAMIO);
|
||||
}
|
||||
|
||||
@@ -357,7 +350,7 @@ void decrement_active_files(int ndx)
|
||||
/* Try to push messages off the list onto the wire. If we leave with more
|
||||
* to do, return 0. On error, return -1. If everything flushed, return 1.
|
||||
* This is only active in the receiver. */
|
||||
static int msg_list_flush(int flush_it_all)
|
||||
static int msg2genr_flush(int flush_it_all)
|
||||
{
|
||||
static int written = 0;
|
||||
struct timeval tv;
|
||||
@@ -366,9 +359,9 @@ static int msg_list_flush(int flush_it_all)
|
||||
if (msg_fd_out < 0)
|
||||
return -1;
|
||||
|
||||
while (msg_list.head) {
|
||||
struct msg_list_item *ml = msg_list.head;
|
||||
int n = write(msg_fd_out, ml->buf + written, ml->len - written);
|
||||
while (msg2genr.head) {
|
||||
struct msg_list_item *m = msg2genr.head;
|
||||
int n = write(msg_fd_out, m->buf + written, m->len - written);
|
||||
if (n < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
@@ -382,12 +375,11 @@ static int msg_list_flush(int flush_it_all)
|
||||
tv.tv_usec = 0;
|
||||
if (!select(msg_fd_out+1, NULL, &fds, NULL, &tv))
|
||||
check_timeout();
|
||||
} else if ((written += n) == ml->len) {
|
||||
free(ml->buf);
|
||||
msg_list.head = ml->next;
|
||||
if (!msg_list.head)
|
||||
msg_list.tail = NULL;
|
||||
free(ml);
|
||||
} else if ((written += n) == m->len) {
|
||||
msg2genr.head = m->next;
|
||||
if (!msg2genr.head)
|
||||
msg2genr.tail = NULL;
|
||||
free(m);
|
||||
written = 0;
|
||||
}
|
||||
}
|
||||
@@ -400,8 +392,8 @@ void send_msg(enum msgcode code, char *buf, int len)
|
||||
io_multiplex_write(code, buf, len);
|
||||
return;
|
||||
}
|
||||
msg_list_add(code, buf, len);
|
||||
msg_list_flush(NORMAL_FLUSH);
|
||||
msg_list_add(&msg2genr, code, buf, len);
|
||||
msg2genr_flush(NORMAL_FLUSH);
|
||||
}
|
||||
|
||||
int get_redo_num(int itemizing, enum logcode code)
|
||||
@@ -498,7 +490,7 @@ static int read_timeout(int fd, char *buf, size_t len)
|
||||
FD_ZERO(&r_fds);
|
||||
FD_ZERO(&w_fds);
|
||||
FD_SET(fd, &r_fds);
|
||||
if (msg_list.head) {
|
||||
if (msg2genr.head) {
|
||||
FD_SET(msg_fd_out, &w_fds);
|
||||
if (msg_fd_out > maxfd)
|
||||
maxfd = msg_fd_out;
|
||||
@@ -535,8 +527,8 @@ static int read_timeout(int fd, char *buf, size_t len)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msg_list.head && FD_ISSET(msg_fd_out, &w_fds))
|
||||
msg_list_flush(NORMAL_FLUSH);
|
||||
if (msg2genr.head && FD_ISSET(msg_fd_out, &w_fds))
|
||||
msg2genr_flush(NORMAL_FLUSH);
|
||||
|
||||
if (io_filesfrom_f_out >= 0) {
|
||||
if (io_filesfrom_buflen) {
|
||||
@@ -1056,6 +1048,7 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
|
||||
size_t n, total = 0;
|
||||
fd_set w_fds, r_fds;
|
||||
int maxfd, count, cnt, using_r_fds;
|
||||
int defer_save = defer_forwarding_messages;
|
||||
struct timeval tv;
|
||||
|
||||
no_flush++;
|
||||
@@ -1065,7 +1058,7 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
|
||||
FD_SET(fd,&w_fds);
|
||||
maxfd = fd;
|
||||
|
||||
if (msg_fd_in >= 0 && len-total >= contiguous_write_len) {
|
||||
if (msg_fd_in >= 0) {
|
||||
FD_ZERO(&r_fds);
|
||||
FD_SET(msg_fd_in,&r_fds);
|
||||
if (msg_fd_in > maxfd)
|
||||
@@ -1113,8 +1106,8 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
|
||||
if (fd == sock_f_out)
|
||||
close_multiplexing_out();
|
||||
rsyserr(FERROR, errno,
|
||||
"writefd_unbuffered failed to write %ld bytes: phase \"%s\" [%s]",
|
||||
(long)len, io_write_phase, who_am_i());
|
||||
"writefd_unbuffered failed to write %ld bytes [%s]",
|
||||
(long)len, who_am_i());
|
||||
/* If the other side is sending us error messages, try
|
||||
* to grab any messages they sent before they died. */
|
||||
while (fd == sock_f_out && io_multiplexing_in) {
|
||||
@@ -1127,6 +1120,7 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
|
||||
}
|
||||
|
||||
total += cnt;
|
||||
defer_forwarding_messages = 1;
|
||||
|
||||
if (fd == sock_f_out) {
|
||||
if (io_timeout || am_generator)
|
||||
@@ -1135,9 +1129,27 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
defer_forwarding_messages = defer_save;
|
||||
no_flush--;
|
||||
}
|
||||
|
||||
static void msg2sndr_flush(void)
|
||||
{
|
||||
if (defer_forwarding_messages)
|
||||
return;
|
||||
|
||||
while (msg2sndr.head && io_multiplexing_out) {
|
||||
struct msg_list_item *m = msg2sndr.head;
|
||||
if (!(msg2sndr.head = m->next))
|
||||
msg2sndr.tail = NULL;
|
||||
stats.total_written += m->len;
|
||||
defer_forwarding_messages = 1;
|
||||
writefd_unbuffered(sock_f_out, m->buf, m->len);
|
||||
defer_forwarding_messages = 0;
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an message to a multiplexed stream. If this fails then rsync
|
||||
* exits.
|
||||
@@ -1149,13 +1161,6 @@ static void mplex_write(enum msgcode code, char *buf, size_t len)
|
||||
|
||||
SIVAL(buffer, 0, ((MPLEX_BASE + (int)code)<<24) + len);
|
||||
|
||||
/* When the generator reads messages from the msg_fd_in pipe, it can
|
||||
* cause output to occur down the socket. Setting contiguous_write_len
|
||||
* prevents the reading of msg_fd_in once we actually start to write
|
||||
* this sequence of data (though we might read it before the start). */
|
||||
if (am_generator && msg_fd_in >= 0)
|
||||
contiguous_write_len = len + 4;
|
||||
|
||||
if (n > sizeof buffer - 4)
|
||||
n = 0;
|
||||
else
|
||||
@@ -1166,16 +1171,18 @@ static void mplex_write(enum msgcode code, char *buf, size_t len)
|
||||
len -= n;
|
||||
buf += n;
|
||||
|
||||
if (len)
|
||||
if (len) {
|
||||
defer_forwarding_messages = 1;
|
||||
writefd_unbuffered(sock_f_out, buf, len);
|
||||
|
||||
if (am_generator && msg_fd_in >= 0)
|
||||
contiguous_write_len = 0;
|
||||
defer_forwarding_messages = 0;
|
||||
msg2sndr_flush();
|
||||
}
|
||||
}
|
||||
|
||||
void io_flush(int flush_it_all)
|
||||
{
|
||||
msg_list_flush(flush_it_all);
|
||||
msg2genr_flush(flush_it_all);
|
||||
msg2sndr_flush();
|
||||
|
||||
if (!iobuf_out_cnt || no_flush)
|
||||
return;
|
||||
@@ -1236,13 +1243,6 @@ void write_int(int f,int32 x)
|
||||
writefd(f,b,4);
|
||||
}
|
||||
|
||||
void write_int_named(int f, int32 x, const char *phase)
|
||||
{
|
||||
io_write_phase = phase;
|
||||
write_int(f, x);
|
||||
io_write_phase = phase_unknown;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: int64 may actually be a 32-bit type if ./configure couldn't find any
|
||||
* 64-bit types on this platform.
|
||||
|
||||
43
lib/compat.c
43
lib/compat.c
@@ -150,49 +150,6 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef REPLACE_INET_NTOA
|
||||
char *rep_inet_ntoa(struct in_addr ip)
|
||||
{
|
||||
unsigned char *p = (unsigned char *)&ip.s_addr;
|
||||
static char buf[18];
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
snprintf(buf, 18, "%d.%d.%d.%d",
|
||||
(int)p[0], (int)p[1], (int)p[2], (int)p[3]);
|
||||
#else
|
||||
snprintf(buf, 18, "%d.%d.%d.%d",
|
||||
(int)p[3], (int)p[2], (int)p[1], (int)p[0]);
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef REPLACE_INET_ATON
|
||||
int inet_aton(const char *cp, struct in_addr *inp)
|
||||
{
|
||||
unsigned int a1, a2, a3, a4;
|
||||
unsigned long ret;
|
||||
|
||||
if (strcmp(cp, "255.255.255.255") == 0) {
|
||||
inp->s_addr = (unsigned) -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sscanf(cp, "%u.%u.%u.%u", &a1, &a2, &a3, &a4) != 4 ||
|
||||
a1 > 255 || a2 > 255 || a3 > 255 || a4 > 255) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4;
|
||||
|
||||
inp->s_addr = htonl(ret);
|
||||
|
||||
if (inp->s_addr == (unsigned) -1) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* some systems don't take the 2nd argument */
|
||||
int sys_gettimeofday(struct timeval *tv)
|
||||
{
|
||||
|
||||
@@ -802,7 +802,6 @@ False on failure.
|
||||
BOOL lp_load(char *pszFname, int globals_only)
|
||||
{
|
||||
extern int am_server;
|
||||
extern int am_daemon;
|
||||
extern int am_root;
|
||||
pstring n2;
|
||||
BOOL bRetval;
|
||||
@@ -815,7 +814,7 @@ BOOL lp_load(char *pszFname, int globals_only)
|
||||
|
||||
if (pszFname)
|
||||
pstrcpy(n2,pszFname);
|
||||
else if (am_server && am_daemon && !am_root)
|
||||
else if (am_server && !am_root)
|
||||
pstrcpy(n2,RSYNCD_USERCONF);
|
||||
else
|
||||
pstrcpy(n2,RSYNCD_SYSCONF);
|
||||
|
||||
8
log.c
8
log.c
@@ -769,11 +769,11 @@ void log_exit(int code, const char *file, int line)
|
||||
|
||||
/* VANISHED is not an error, only a warning */
|
||||
if (code == RERR_VANISHED) {
|
||||
rprintf(FINFO, "rsync warning: %s (code %d) at %s(%d) [%s]\n",
|
||||
name, code, file, line, who_am_i());
|
||||
rprintf(FINFO, "rsync warning: %s (code %d) at %s(%d) [%s=%s]\n",
|
||||
name, code, file, line, who_am_i(), RSYNC_VERSION);
|
||||
} else {
|
||||
rprintf(FERROR, "rsync error: %s (code %d) at %s(%d) [%s]\n",
|
||||
name, code, file, line, who_am_i());
|
||||
rprintf(FERROR, "rsync error: %s (code %d) at %s(%d) [%s=%s]\n",
|
||||
name, code, file, line, who_am_i(), RSYNC_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
options.c
11
options.c
@@ -58,8 +58,6 @@ int cvs_exclude = 0;
|
||||
int dry_run = 0;
|
||||
int do_xfers = 1;
|
||||
int ignore_times = 0;
|
||||
int saw_delete_opt = 0;
|
||||
int saw_delete_excluded_opt = 0;
|
||||
int delete_mode = 0;
|
||||
int delete_during = 0;
|
||||
int delete_before = 0;
|
||||
@@ -1178,11 +1176,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
|
||||
}
|
||||
delete_mode = delete_before = 1;
|
||||
}
|
||||
saw_delete_opt = delete_mode;
|
||||
saw_delete_excluded_opt = delete_excluded;
|
||||
if (!xfer_dirs) {
|
||||
delete_before = delete_during = delete_after = 0;
|
||||
delete_mode = delete_excluded = 0;
|
||||
if (!xfer_dirs && delete_mode) {
|
||||
snprintf(err_buf, sizeof err_buf,
|
||||
"--delete does not work without -r or -d.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (delete_mode && refused_delete) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Summary: A program for synchronizing files over a network.
|
||||
Name: rsync
|
||||
Version: 2.6.7
|
||||
Version: 2.6.8
|
||||
Release: 1
|
||||
Group: Applications/Internet
|
||||
Source: ftp://rsync.samba.org/pub/rsync/rsync-%{version}.tar.gz
|
||||
|
||||
@@ -98,7 +98,7 @@ system 'ls -ltr';
|
||||
|
||||
if ($upload) {
|
||||
$ENV{RSYNC_PARTIAL_DIR} = ''; # The rsync on samba.org is OLD.
|
||||
system "rsync -aviHP --delete . samba.org:/home/ftp/pub/rsync/nightly";
|
||||
system "rsync -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/nightly";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
@@ -163,7 +163,7 @@ foreach my $fn (@tweak_files) {
|
||||
s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
|
||||
s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
|
||||
} else {
|
||||
s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*$/$1 ($today)\n/m;
|
||||
s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/m;
|
||||
s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
|
||||
}
|
||||
open(OUT, '>', $fn) or die $!;
|
||||
@@ -205,18 +205,21 @@ if (!/skip/i) {
|
||||
system "patches/verify-patches -pun -an";
|
||||
}
|
||||
|
||||
my $tar_file = "$dest/rsync-$version.tar.gz";
|
||||
my $diff_file = "$dest/rsync-$lastversion-$version.diffs.gz";
|
||||
my $tar_name = "rsync-$version.tar.gz";
|
||||
my $diff_name = "rsync-$lastversion-$version.diffs.gz";
|
||||
my $tar_file = "$dest/$tar_name";
|
||||
my $diff_file = "$dest/$diff_name";
|
||||
|
||||
print $break, <<EOT;
|
||||
|
||||
About to do the following in the samba-rsync-ftp dir:
|
||||
- move the old tar/diff files into the appropriate old-* dirs
|
||||
- hard-link moved tar/diff files to old files on samba.org$skipping
|
||||
- create release tar, "$tar_file"
|
||||
- create release diffs, "$diff_file"
|
||||
- copy the moved tar/diff files on samba.org$skipping
|
||||
- create release tar, "$tar_name"
|
||||
- create release diffs, "$diff_name"
|
||||
- update README, *NEWS, TODO, and cvs.log
|
||||
- update rsync*.html man pages
|
||||
- gpg-sign the release files$skipping
|
||||
|
||||
EOT
|
||||
print "<Press Enter to continue> ";
|
||||
@@ -259,12 +262,12 @@ if ($diffdir ne $dest) {
|
||||
}
|
||||
|
||||
# Optimize our future upload (in the absence of --detect-renamed) by
|
||||
# hard-linking the above moved files on the remote server.
|
||||
# copying the above moved files on the remote server.
|
||||
if ($live) {
|
||||
my $remote_cmd = '';
|
||||
foreach (@moved_files) {
|
||||
my($path, $fn) = m#(.*)/([^/]+)$#;
|
||||
$remote_cmd .= "ln -f /home/ftp/pub/rsync/{$fn,$path};";
|
||||
$remote_cmd .= "cp -p /home/ftp/pub/rsync/{$fn,$path};";
|
||||
}
|
||||
system "ssh samba.org '$remote_cmd'";
|
||||
}
|
||||
@@ -306,12 +309,12 @@ system "rm -rf rsync-*";
|
||||
|
||||
if ($live) {
|
||||
chdir($dest) or die $!;
|
||||
system "gpg -ba rsync-$version.tar.gz";
|
||||
system "gpg -ba rsync-$lastversion-$version.diffs.gz";
|
||||
}
|
||||
|
||||
print $break, <<EOT;
|
||||
system "gpg -ba $tar_name; gpg -ba $diff_name";
|
||||
print $break, <<EOT;
|
||||
|
||||
All done. Remember to announce the release on *BOTH*
|
||||
rsync-announce\@lists.samba.org and rsync\@lists.samba.org!
|
||||
EOT
|
||||
} else {
|
||||
print $break, "All done.\n";
|
||||
}
|
||||
|
||||
2
params.c
2
params.c
@@ -491,7 +491,7 @@ static FILE *OpenConfFile( char *FileName )
|
||||
OpenedFile = fopen( FileName, "r" );
|
||||
if( NULL == OpenedFile )
|
||||
{
|
||||
rsyserr(FERROR, errno, "rsync: unable to open configuration file \"%s\"",
|
||||
rsyserr(FERROR, errno, "unable to open configuration file \"%s\"",
|
||||
FileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
# NOTE: if you use a diff from the "patches" directory in a release
|
||||
# tar, this is not needed (but doesn't hurt anything).
|
||||
dir=`dirname $0`
|
||||
if test x"$dir" = x -o x"$dir" = x.; then
|
||||
make -f prepare-source.mak
|
||||
else
|
||||
make -C "$dir" -f prepare-source.mak
|
||||
if test x"$dir" != x -o x"$dir" != x.; then
|
||||
cd "$dir"
|
||||
fi
|
||||
make -f prepare-source.mak
|
||||
|
||||
8
rsync.h
8
rsync.h
@@ -135,13 +135,15 @@
|
||||
#define FNAMECMP_FUZZY 0x83
|
||||
|
||||
/* For use by the itemize_changes code */
|
||||
#define ITEM_REPORT_ATIME (1<<0)
|
||||
#define ITEM_REPORT_CHECKSUM (1<<1)
|
||||
#define ITEM_REPORT_SIZE (1<<2)
|
||||
#define ITEM_REPORT_TIME (1<<3)
|
||||
#define ITEM_REPORT_PERMS (1<<4)
|
||||
#define ITEM_REPORT_OWNER (1<<5)
|
||||
#define ITEM_REPORT_GROUP (1<<6)
|
||||
#define ITEM_REPORT_XATTRS (1<<7)
|
||||
#define ITEM_REPORT_ACL (1<<7)
|
||||
#define ITEM_REPORT_XATTR (1<<8)
|
||||
#define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
|
||||
#define ITEM_XNAME_FOLLOWS (1<<12)
|
||||
#define ITEM_IS_NEW (1<<13)
|
||||
@@ -830,10 +832,6 @@ void rsyserr(enum logcode, int, const char *, ...)
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
;
|
||||
|
||||
#ifdef REPLACE_INET_NTOA
|
||||
#define inet_ntoa rep_inet_ntoa
|
||||
#endif
|
||||
|
||||
/* Make sure that the O_BINARY flag is defined. */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
|
||||
57
rsync.yo
57
rsync.yo
@@ -1,5 +1,5 @@
|
||||
mailto(rsync-bugs@samba.org)
|
||||
manpage(rsync)(1)(11 Mar 2006)()()
|
||||
manpage(rsync)(1)(22 Apr 2006)()()
|
||||
manpagename(rsync)(faster, flexible replacement for rcp)
|
||||
manpagesynopsis()
|
||||
|
||||
@@ -254,7 +254,7 @@ In order to connect to an rsync daemon, the remote system needs to have a
|
||||
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 rsyncd.conf(5) man page -- that is the config
|
||||
socket connections, see the bf(rsyncd.conf)(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).
|
||||
|
||||
@@ -813,20 +813,27 @@ See the bf(--perms) and bf(--executability) options for how the resulting
|
||||
permission value can be applied to the files in the transfer.
|
||||
|
||||
dit(bf(-o, --owner)) This option causes rsync to set the owner of the
|
||||
destination file to be the same as the source file. By default, the
|
||||
preservation is done by name, but may fall back to using the ID number
|
||||
in some circumstances (see the bf(--numeric-ids) option for a full
|
||||
discussion).
|
||||
This option has no effect if the receiving rsync is not run as the
|
||||
super-user and bf(--super) is not specified.
|
||||
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 bf(--super)
|
||||
option to force rsync to attempt super-user activities).
|
||||
Without this option, the owner is set to the invoking user on the
|
||||
receiving side.
|
||||
|
||||
The preservation of ownership will associate matching names by default, but
|
||||
may fall back to using the ID number in some circumstances (see also the
|
||||
bf(--numeric-ids) option for a full discussion).
|
||||
|
||||
dit(bf(-g, --group)) 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 with the bf(--no-super)
|
||||
option), only groups that the
|
||||
receiver is a member of will be preserved. By default, the preservation
|
||||
is done by name, but may fall back to using the ID number in some
|
||||
circumstances. See the bf(--numeric-ids) option for a full discussion.
|
||||
program is not running as the super-user (or if bf(--no-super) 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
|
||||
user on the receiving side.
|
||||
|
||||
The preservation of group information will associate matching names by
|
||||
default, but may fall back to using the ID number in some circumstances
|
||||
(see also the bf(--numeric-ids) option for a full discussion).
|
||||
|
||||
dit(bf(--devices)) This option causes rsync to transfer character and
|
||||
block device files to the remote system to recreate these devices.
|
||||
@@ -1078,7 +1085,7 @@ are delimited by whitespace).
|
||||
Finally, any file is ignored if it is in the same directory as a
|
||||
.cvsignore file and matches one of the patterns listed therein. Unlike
|
||||
rsync's filter/exclude files, these patterns are split on whitespace.
|
||||
See the bf(cvs(1)) manual for more information.
|
||||
See the bf(cvs)(1) manual for more information.
|
||||
|
||||
If you're combining bf(-C) with your own bf(--filter) rules, you should
|
||||
note that these CVS excludes are appended at the end of your own rules,
|
||||
@@ -1345,7 +1352,7 @@ option in the bf(--daemon) mode section.
|
||||
dit(bf(--sockopts)) This option can provide endless fun for people
|
||||
who like to tune their systems to the utmost degree. You can set all
|
||||
sorts of socket options which may make transfers faster (or
|
||||
slower!). Read the man page for the setsockopt() system call for
|
||||
slower!). Read the man page for the code(setsockopt()) system call for
|
||||
details on some of the options you may be able to set. By default no
|
||||
special socket options are set. This only affects direct socket
|
||||
connections to a remote rsync daemon. This option also exists in the
|
||||
@@ -1453,7 +1460,7 @@ dit(bf(--stats)) This tells rsync to print a verbose set of statistics
|
||||
on the file transfer, allowing you to tell how effective the rsync
|
||||
algorithm is for your data.
|
||||
|
||||
The current statistics are as follows: itemize(
|
||||
The current statistics are as follows: quote(itemize(
|
||||
it() bf(Number of files) is the count of all "files" (in the generic
|
||||
sense), which includes directories, symlinks, etc.
|
||||
it() bf(Number of files transferred) is the count of normal files that
|
||||
@@ -1483,7 +1490,7 @@ The current statistics are as follows: itemize(
|
||||
rsync received by the client side from the server side. "Non-message"
|
||||
bytes means that we don't count the bytes for a verbose message that the
|
||||
server sent to us, which makes the stats more consistent.
|
||||
)
|
||||
))
|
||||
|
||||
dit(bf(-8, --8-bit-output)) This tells rsync to leave all high-bit characters
|
||||
unescaped in the output instead of trying to test them to see if they're
|
||||
@@ -1720,11 +1727,11 @@ rsync daemon. See also these options in the bf(--daemon) mode section.
|
||||
dit(bf(--checksum-seed=NUM)) Set the MD4 checksum seed to the integer
|
||||
NUM. This 4 byte checksum seed is included in each block and file
|
||||
MD4 checksum calculation. By default the checksum seed is generated
|
||||
by the server and defaults to the current time(). This option
|
||||
by the server and defaults to the current code(time()). This option
|
||||
is used to set a specific checksum seed, which is useful for
|
||||
applications that want repeatable block and file checksums, or
|
||||
in the case where the user wants a more random checksum seed.
|
||||
Note that setting NUM to 0 causes rsync to use the default of time()
|
||||
Note that setting NUM to 0 causes rsync to use the default of code(time())
|
||||
for checksum seed.
|
||||
enddit()
|
||||
|
||||
@@ -1741,7 +1748,7 @@ If standard input is a socket then rsync will assume that it is being
|
||||
run via inetd, otherwise it will detach from the current terminal and
|
||||
become a background daemon. The daemon will read the config file
|
||||
(rsyncd.conf) on each connect made by a client and respond to
|
||||
requests accordingly. See the rsyncd.conf(5) man page for more
|
||||
requests accordingly. See the bf(rsyncd.conf)(5) man page for more
|
||||
details.
|
||||
|
||||
dit(bf(--address)) By default rsync will bind to the wildcard address when
|
||||
@@ -1880,7 +1887,6 @@ itemize(
|
||||
of the transfer.
|
||||
it() if the pattern ends with a / then it will only match a
|
||||
directory, not a file, link, or device.
|
||||
|
||||
it() rsync chooses between doing a simple string match and wildcard
|
||||
matching by checking if the pattern contains one of these three wildcard
|
||||
characters: '*', '?', and '[' .
|
||||
@@ -2258,7 +2264,8 @@ For convenience, one additional file is creating when the write-batch
|
||||
option is used. This file's name is created by appending
|
||||
".sh" to the batch filename. The .sh file contains
|
||||
a command-line suitable for updating a destination tree using that
|
||||
batch file. It can be executed using a Bourne(-like) shell, optionally
|
||||
batch file. It can be executed using a Bourne (or Bourne-like) shell,
|
||||
optionally
|
||||
passing in an alternate destination tree pathname which is then used
|
||||
instead of the original path. This is useful when the destination tree
|
||||
path differs from the original destination tree path.
|
||||
@@ -2435,7 +2442,7 @@ dit(bf(12)) Error in rsync protocol data stream
|
||||
dit(bf(13)) Errors with program diagnostics
|
||||
dit(bf(14)) Error in IPC code
|
||||
dit(bf(20)) Received SIGUSR1 or SIGINT
|
||||
dit(bf(21)) Some error returned by waitpid()
|
||||
dit(bf(21)) Some error returned by code(waitpid())
|
||||
dit(bf(22)) Error allocating core memory buffers
|
||||
dit(bf(23)) Partial transfer due to error
|
||||
dit(bf(24)) Partial transfer due to vanished source files
|
||||
@@ -2472,7 +2479,7 @@ manpagefiles()
|
||||
|
||||
manpageseealso()
|
||||
|
||||
rsyncd.conf(5)
|
||||
bf(rsyncd.conf)(5)
|
||||
|
||||
manpagebugs()
|
||||
|
||||
@@ -2492,7 +2499,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
|
||||
|
||||
manpagesection(VERSION)
|
||||
|
||||
This man page is current for version 2.6.7 of rsync.
|
||||
This man page is current for version 2.6.8 of rsync.
|
||||
|
||||
manpagesection(CREDITS)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
mailto(rsync-bugs@samba.org)
|
||||
manpage(rsyncd.conf)(5)(11 Mar 2006)()()
|
||||
manpage(rsyncd.conf)(5)(22 Apr 2006)()()
|
||||
manpagename(rsyncd.conf)(configuration file for rsync in daemon mode)
|
||||
manpagesynopsis()
|
||||
|
||||
@@ -86,7 +86,7 @@ is no motd file.
|
||||
|
||||
dit(bf(log file)) The "log file" option tells the rsync daemon to log
|
||||
messages to that file rather than using syslog. This is particularly
|
||||
useful on systems (such as AIX) where syslog() doesn't work for
|
||||
useful on systems (such as AIX) where code(syslog()) doesn't work for
|
||||
chrooted programs. If the daemon fails to open to specified file, it
|
||||
will fall back to using syslog and output an error about the failure.
|
||||
(Note that a failure to open the specified log file used to be a fatal
|
||||
@@ -114,7 +114,7 @@ being run by inetd, and is superseded by the bf(--address) command-line option.
|
||||
dit(bf(socket options)) This option can provide endless fun for people
|
||||
who like to tune their systems to the utmost degree. You can set all
|
||||
sorts of socket options which may make transfers faster (or
|
||||
slower!). Read the man page for the setsockopt() system call for
|
||||
slower!). Read the man page for the code(setsockopt()) 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 are superseded by the
|
||||
bf(--sockopts) command-line option.
|
||||
@@ -154,7 +154,7 @@ The default for "use chroot" is true.
|
||||
|
||||
In order to preserve usernames and groupnames, rsync needs to be able to
|
||||
use the standard library functions for looking up names and IDs (i.e.
|
||||
getpwuid(), getgrgid(), getpwname(), and getgrnam()). This means a
|
||||
code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())). This means a
|
||||
process in the chroot namespace will need to have access to the resources
|
||||
used by these library functions (traditionally /etc/passwd and
|
||||
/etc/group). If these resources are not available, rsync will only be
|
||||
@@ -294,7 +294,7 @@ usernames and passwords are stored in the file specified by the
|
||||
connect without a password (this is called "anonymous rsync").
|
||||
|
||||
See also the "CONNECTING TO AN RSYNC DAEMON OVER A REMOTE SHELL
|
||||
PROGRAM" section in rsync(1) for information on how handle an
|
||||
PROGRAM" section in bf(rsync)(1) for information on how handle an
|
||||
rsyncd.conf-level username that differs from the remote-shell-level
|
||||
username when using a remote shell to connect to an rsync daemon.
|
||||
|
||||
@@ -497,7 +497,7 @@ quote(itemize(
|
||||
it() bf(RSYNC_EXIT_STATUS): (post-xfer only) rsync's exit value. This will be 0 for a
|
||||
successful run, a positive value for an error that rsync returned
|
||||
(e.g. 23=partial xfer), or a -1 if rsync failed to exit properly.
|
||||
it() bf(RSYNC_RAW_STATUS): (post-xfer only) the raw exit value from waitpid().
|
||||
it() bf(RSYNC_RAW_STATUS): (post-xfer only) the raw exit value from code(waitpid()).
|
||||
))
|
||||
|
||||
Even though the commands can be associated with a particular module, they
|
||||
@@ -591,7 +591,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
|
||||
|
||||
manpagesection(VERSION)
|
||||
|
||||
This man page is current for version 2.6.7 of rsync.
|
||||
This man page is current for version 2.6.8 of rsync.
|
||||
|
||||
manpagesection(CREDITS)
|
||||
|
||||
|
||||
12
runtests.sh
12
runtests.sh
@@ -163,11 +163,13 @@ else
|
||||
echo " preserve_scratch=no"
|
||||
fi
|
||||
|
||||
# We'll use setfacl if it's around and it supports the -k option.
|
||||
# Check if setfacl is around and if it supports the -k or -s option.
|
||||
if setfacl --help 2>/dev/null | grep ' -k,' >/dev/null; then
|
||||
setfacl=setfacl
|
||||
setfacl_nodef='setfacl -k'
|
||||
elif setfacl -s u::7,g::5,o:5 testsuite 2>/dev/null; then
|
||||
setfacl_nodef='setfacl -s u::7,g::5,o:5'
|
||||
else
|
||||
setfacl=true
|
||||
setfacl_nodef=true
|
||||
fi
|
||||
|
||||
if [ ! -f "$rsync_bin" ]; then
|
||||
@@ -183,7 +185,7 @@ fi
|
||||
RSYNC="$rsync_bin"
|
||||
#RSYNC="valgrind --tool=addrcheck $rsync_bin"
|
||||
|
||||
export rsync_bin RSYNC
|
||||
export rsync_bin RSYNC setfacl_nodef
|
||||
|
||||
skipped=0
|
||||
missing=0
|
||||
@@ -204,7 +206,7 @@ prep_scratch() {
|
||||
[ -d "$scratchdir" ] && rm -rf "$scratchdir"
|
||||
mkdir "$scratchdir"
|
||||
# Get rid of default ACLs and dir-setgid to avoid confusing some tests.
|
||||
$setfacl -k "$scratchdir"
|
||||
$setfacl_nodef "$scratchdir"
|
||||
chmod g-s "$scratchdir"
|
||||
return 0
|
||||
}
|
||||
|
||||
32
socket.c
32
socket.c
@@ -32,6 +32,8 @@
|
||||
**/
|
||||
|
||||
#include "rsync.h"
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
extern char *bind_address;
|
||||
extern int default_af_hint;
|
||||
@@ -333,9 +335,9 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
|
||||
int af_hint)
|
||||
{
|
||||
int one = 1;
|
||||
int s, *socks, maxs, i;
|
||||
int s, *socks, maxs, i, ecnt;
|
||||
struct addrinfo hints, *all_ai, *resp;
|
||||
char portbuf[10];
|
||||
char portbuf[10], **errmsgs;
|
||||
int error;
|
||||
|
||||
memset(&hints, 0, sizeof hints);
|
||||
@@ -353,17 +355,25 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
|
||||
/* Count max number of sockets we might open. */
|
||||
for (maxs = 0, resp = all_ai; resp; resp = resp->ai_next, maxs++) {}
|
||||
|
||||
if (!(socks = new_array(int, maxs + 1)))
|
||||
socks = new_array(int, maxs + 1);
|
||||
errmsgs = new_array(char *, maxs);
|
||||
if (!socks || !errmsgs)
|
||||
out_of_memory("open_socket_in");
|
||||
|
||||
/* We may not be able to create the socket, if for example the
|
||||
* machine knows about IPv6 in the C library, but not in the
|
||||
* kernel. */
|
||||
for (resp = all_ai, i = 0; resp; resp = resp->ai_next) {
|
||||
for (resp = all_ai, i = ecnt = 0; resp; resp = resp->ai_next) {
|
||||
s = socket(resp->ai_family, resp->ai_socktype,
|
||||
resp->ai_protocol);
|
||||
|
||||
if (s == -1) {
|
||||
int r = asprintf(&errmsgs[ecnt++],
|
||||
"socket(%d,%d,%d) failed: %s\n",
|
||||
(int)resp->ai_family, (int)resp->ai_socktype,
|
||||
(int)resp->ai_protocol, strerror(errno));
|
||||
if (r < 0)
|
||||
out_of_memory("open_socket_in");
|
||||
/* See if there's another address that will work... */
|
||||
continue;
|
||||
}
|
||||
@@ -385,6 +395,11 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
|
||||
/* Now we've got a socket - we need to bind it. */
|
||||
if (bind(s, resp->ai_addr, resp->ai_addrlen) < 0) {
|
||||
/* Nope, try another */
|
||||
int r = asprintf(&errmsgs[ecnt++],
|
||||
"bind() failed: %s (address-family %d)\n",
|
||||
strerror(errno), (int)resp->ai_family);
|
||||
if (r < 0)
|
||||
out_of_memory("open_socket_in");
|
||||
close(s);
|
||||
continue;
|
||||
}
|
||||
@@ -396,6 +411,15 @@ static int *open_socket_in(int type, int port, const char *bind_addr,
|
||||
if (all_ai)
|
||||
freeaddrinfo(all_ai);
|
||||
|
||||
/* Only output the socket()/bind() messages if we were totally
|
||||
* unsuccessful, or if the daemon is being run with -vv. */
|
||||
for (s = 0; s < ecnt; s++) {
|
||||
if (!i || verbose > 1)
|
||||
rwrite(FLOG, errmsgs[s], strlen(errmsgs[s]));
|
||||
free(errmsgs[s]);
|
||||
}
|
||||
free(errmsgs);
|
||||
|
||||
if (!i) {
|
||||
rprintf(FERROR,
|
||||
"unable to bind any inbound sockets on port %d\n",
|
||||
|
||||
172
support/file-attr-restore
Executable file
172
support/file-attr-restore
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/perl
|
||||
# This script will parse the output of "find ARG [ARG...] -ls" and
|
||||
# apply (at your discretion) the permissions, owner, and group info
|
||||
# it reads onto any existing files and dirs (it doesn't try to affect
|
||||
# symlinks). Run this with --help (-h) for a usage summary.
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
our($p_opt, $o_opt, $g_opt, $map_file, $dry_run, $verbosity, $help_opt);
|
||||
|
||||
&Getopt::Long::Configure('bundling');
|
||||
&usage if !&GetOptions(
|
||||
'all|a' => sub { $p_opt = $o_opt = $g_opt = 1 },
|
||||
'perms|p' => \$p_opt,
|
||||
'owner|o' => \$o_opt,
|
||||
'groups|g' => \$g_opt,
|
||||
'map|m=s' => \$map_file,
|
||||
'dry-run|n' => \$dry_run,
|
||||
'help|h' => \$help_opt,
|
||||
'verbose|v+' => \$verbosity,
|
||||
) || $help_opt;
|
||||
|
||||
our(%uid_hash, %gid_hash);
|
||||
|
||||
$" = ', '; # How to join arrays referenced in double-quotes.
|
||||
|
||||
&parse_map_file($map_file) if defined $map_file;
|
||||
|
||||
my $detail_line = qr{
|
||||
^ \s* \d+ \s+ # ignore inode
|
||||
\d+ \s+ # ignore size
|
||||
([-bcdlps]) # 1. File type
|
||||
( [-r][-w][-xsS] # 2. user-permissions
|
||||
[-r][-w][-xsS] # 3. group-permissions
|
||||
[-r][-w][-xtT] ) \s+ # 4. other-permissions
|
||||
\d+ \s+ # ignore number of links
|
||||
(\S+) \s+ # 5. owner
|
||||
(\S+) \s+ # 6. group
|
||||
(?: \d+ \s+ )? # ignore size (when present)
|
||||
\w+ \s+ \d+ \s+ # ignore month and date
|
||||
\d+ (?: : \d+ )? \s+ # ignore time or year
|
||||
([^\r\n]+) $ # 7. name
|
||||
}x;
|
||||
|
||||
while (<>) {
|
||||
my($type, $perms, $owner, $group, $name) = /$detail_line/;
|
||||
die "Invalid input line $.:\n$_" unless defined $name;
|
||||
die "A filename is not properly escaped:\n$_" unless $name =~ /^[^"\\]*(\\(\d\d\d|\D)[^"\\]*)*$/;
|
||||
my $fn = eval "\"$name\"";
|
||||
if ($type eq '-') {
|
||||
undef $type unless -f $fn;
|
||||
} elsif ($type eq 'd') {
|
||||
undef $type unless -d $fn;
|
||||
} elsif ($type eq 'b') {
|
||||
undef $type unless -b $fn;
|
||||
} elsif ($type eq 'c') {
|
||||
undef $type unless -c $fn;
|
||||
} elsif ($type eq 'p') {
|
||||
undef $type unless -p $fn;
|
||||
} elsif ($type eq 's') {
|
||||
undef $type unless -S $fn;
|
||||
} else {
|
||||
if ($verbosity) {
|
||||
if ($type eq 'l') {
|
||||
$name =~ s/ -> .*//;
|
||||
$type = 'symlink';
|
||||
} else {
|
||||
$type = "type '$type'";
|
||||
}
|
||||
print "Skipping $name ($type ignored)\n";
|
||||
}
|
||||
next;
|
||||
}
|
||||
if (!defined $type) {
|
||||
my $reason = -e _ ? "types don't match" : 'missing';
|
||||
print "Skipping $name ($reason)\n";
|
||||
next;
|
||||
}
|
||||
my($cur_mode, $cur_uid, $cur_gid) = (stat(_))[2,4,5];
|
||||
$cur_mode &= 07777;
|
||||
my $highs = join('', $perms =~ /..(.)..(.)..(.)/);
|
||||
$highs =~ tr/-rwxSTst/00001111/;
|
||||
$perms =~ tr/-STrwxst/00011111/;
|
||||
my $mode = $p_opt ? oct('0b' . $highs . $perms) : $cur_mode;
|
||||
my $uid = $o_opt ? $uid_hash{$owner} : $cur_uid;
|
||||
if (!defined $uid) {
|
||||
if ($owner =~ /^\d+$/) {
|
||||
$uid = $owner;
|
||||
} else {
|
||||
$uid = getpwnam($owner);
|
||||
}
|
||||
$uid_hash{$owner} = $uid;
|
||||
}
|
||||
my $gid = $g_opt ? $gid_hash{$group} : $cur_gid;
|
||||
if (!defined $gid) {
|
||||
if ($group =~ /^\d+$/) {
|
||||
$gid = $group;
|
||||
} else {
|
||||
$gid = getgrnam($group);
|
||||
}
|
||||
$gid_hash{$group} = $gid;
|
||||
}
|
||||
|
||||
my @changes;
|
||||
if ($mode != $cur_mode) {
|
||||
push(@changes, 'permissions');
|
||||
if (!$dry_run && !chmod($mode, $fn)) {
|
||||
warn "chmod($mode, \"$name\") failed: $!\n";
|
||||
}
|
||||
}
|
||||
if ($uid != $cur_uid || $gid != $cur_gid) {
|
||||
push(@changes, 'owner') if $uid != $cur_uid;
|
||||
push(@changes, 'group') if $gid != $cur_gid;
|
||||
if (!$dry_run) {
|
||||
if (!chown($uid, $gid, $fn)) {
|
||||
warn "chown($uid, $gid, \"$name\") failed: $!\n";
|
||||
}
|
||||
if (($mode & 06000) && !chmod($mode, $fn)) {
|
||||
warn "post-chown chmod($mode, \"$name\") failed: $!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (@changes) {
|
||||
print "$name: changed @changes\n";
|
||||
} elsif ($verbosity) {
|
||||
print "$name: OK\n";
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
||||
sub parse_map_file
|
||||
{
|
||||
my($fn) = @_;
|
||||
open(IN, $fn) or die "Unable to open $fn: $!\n";
|
||||
while (<IN>) {
|
||||
if (/^user\s+(\S+)\s+(\S+)/) {
|
||||
$uid_hash{$1} = $2;
|
||||
} elsif (/^group\s+(\S+)\s+(\S+)/) {
|
||||
$gid_hash{$1} = $2;
|
||||
} else {
|
||||
die "Invalid line #$. in mapfile `$fn':\n$_";
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
die <<EOT;
|
||||
Usage: file-attr-restore [OPTIONS] FILE [FILE...]
|
||||
-a, --all Restore all the attributes (-pog)
|
||||
-p, --perms Restore the permissions
|
||||
-o, --owner Restore the ownership
|
||||
-g, --groups Restore the group
|
||||
-m, --map=FILE Read user/group mappings from FILE
|
||||
-n, --dry-run Don't actually make the changes
|
||||
-v, --verbose Increase verbosity
|
||||
-h, --help Show this help text
|
||||
|
||||
The FILE arg(s) should have been created by running the "find"
|
||||
program with "-ls" as the output specifier.
|
||||
|
||||
The input file for the --map option must be in this format:
|
||||
|
||||
user FROM TO
|
||||
group FROM TO
|
||||
|
||||
The "FROM" should be an user/group mentioned in the input, and the TO
|
||||
should be either a uid/gid number, or a local user/group name.
|
||||
EOT
|
||||
}
|
||||
@@ -52,9 +52,22 @@ if ($only_section) {
|
||||
|
||||
line: while (<LOG>) {
|
||||
|
||||
my $syslog_prefix = '\w\w\w +\d+ \d\d:\d\d:\d\d \S+ rsyncd';
|
||||
my $rsyncd_prefix = '\d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d ';
|
||||
|
||||
next unless ($day,$time,$op,$host,$module,$file,$bytes)
|
||||
= m#^ (\d+/\d\d/\d\d)\s+(\d\d:\d\d:\d\d)\s+\[\d+\]\s+(send|recv|[<>]f\S+)\s+
|
||||
(\S+)\s+\[\d+\.\d+\.\d+\.\d+\]\s+(\S+)\s+\(\S*\)\s+(.*)\s+(\d+) $ #x;
|
||||
= m{^
|
||||
( \w\w\w\s+\d+ | \d+/\d\d/\d\d ) \s+ # day
|
||||
(\d\d:\d\d:\d\d) \s+ # time
|
||||
[^[]* \[\d+\]:? \s+ # pid (ignored)
|
||||
(send|recv|[<>]f\S+) \s+ # op (%o or %i)
|
||||
(\S+) \s+ # host
|
||||
\[\d+\.\d+\.\d+\.\d+\] \s+ # IP (ignored)
|
||||
(\S+) \s+ # module
|
||||
\(\S*\) \s+ # user (ignored)
|
||||
(.*) \s+ # file name
|
||||
(\d+) # file length in bytes
|
||||
$ }x;
|
||||
|
||||
# TODO actually divide the data by into send/recv categories
|
||||
if ($op =~ /^>/) {
|
||||
|
||||
@@ -203,5 +203,13 @@ $RSYNC -av --delete-excluded --exclude='*' "$fromdir/" "$todir/"
|
||||
checkit "$RSYNC -avv -f dir-merge,-_.excl \
|
||||
\"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
|
||||
|
||||
relative_opts='--relative --chmod=Du+w --copy-unsafe-links'
|
||||
$RSYNC -av $relative_opts "$fromdir/foo" "$chkdir/"
|
||||
rm -rf "$chkdir$fromdir/foo/down"
|
||||
$RSYNC -av $relative_opts --existing --filter='-! */' "$fromdir/foo" "$chkdir/"
|
||||
|
||||
checkit "$RSYNC -avv $relative_opts --exclude=\"$fromdir/foo/down\" \
|
||||
\"$fromdir/foo\" \"$todir\"" "$chkdir$fromdir/foo" "$todir$fromdir/foo"
|
||||
|
||||
# The script would have aborted on error, so getting here means we've won.
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user