Compare commits

...

58 Commits

Author SHA1 Message Date
Wayne Davison
c1456d83a7 Tweaked the date. 2004-01-01 19:00:11 +00:00
Wayne Davison
1cbbaea957 Preparing for release of 2.6.0 2004-01-01 11:36:16 +00:00
Wayne Davison
f6aeaa74d1 One more tweak to --modify-window verbage. 2003-12-30 18:17:16 +00:00
Wayne Davison
6839140eb5 Shorten some of the lines in the --help output. 2003-12-30 18:16:25 +00:00
Wayne Davison
915dd20705 Shortened a few lines, plus a couple minor tweaks. 2003-12-30 17:44:01 +00:00
Wayne Davison
c53217a2b8 Changed the VERSION section to refer to 2.x instead of 2.0. 2003-12-29 09:58:06 +00:00
Wayne Davison
b2ac00eb16 Preparing for release of 2.6.0pre2 2003-12-28 21:11:38 +00:00
Wayne Davison
45ddbf6204 Make the upper copyright year "2004". 2003-12-28 20:48:06 +00:00
Wayne Davison
276877cf77 Aged news from NEWS to OLDNEWS. 2003-12-27 00:14:21 +00:00
Wayne Davison
6b45fcf160 Undid previous change. 2003-12-26 23:04:01 +00:00
Wayne Davison
49c24eccd4 A change that wasn't needed. 2003-12-26 22:59:53 +00:00
Wayne Davison
0d7d3763f2 Use %{version} to refer to the current version. 2003-12-24 17:48:25 +00:00
Wayne Davison
241dc65eee Getting rid of klunky *.tmpl files. 2003-12-24 17:46:46 +00:00
Wayne Davison
860bdd4571 Mention the new-backup-dir mode change. 2003-12-24 01:46:38 +00:00
Wayne Davison
55bf051bbc Getting rid of an extra newline that accidentally crept into the code. 2003-12-24 01:46:07 +00:00
Wayne Davison
423dba8ea1 Simplified an internal function's name to remove a potentially
cryptic suffix.
2003-12-24 01:14:16 +00:00
Wayne Davison
517c7b4dee Updated the copyright year. 2003-12-20 18:00:13 +00:00
Wayne Davison
18ced14631 Output a warning about the new remote-shell default if the --with-rsh
option wasn't used.
2003-12-20 17:57:47 +00:00
Wayne Davison
ce67256218 Output a newline before the heap statistics. 2003-12-20 16:57:24 +00:00
Wayne Davison
9e83fa99fe - Mention the extra newlines in the verbose/stats output.
- Made some spelling corrections.
2003-12-20 16:56:51 +00:00
Wayne Davison
256a9e376c Added a couple missing items from John Van Essen. 2003-12-20 16:51:13 +00:00
Wayne Davison
ef5075e092 Quiet a compiler warning. 2003-12-19 22:19:54 +00:00
Wayne Davison
65653a6596 Mention the change we made to help ssh cleanup the tty on Ctrl-C. 2003-12-19 20:21:17 +00:00
Wayne Davison
d5a0b48379 Do a small msleep() in the sig_int() handler before shutting down.
This kluge allows things like SIGINT to find our children before
we go throwing around SIGUSR1's at them.
2003-12-19 06:52:02 +00:00
Wayne Davison
314a74d731 Got rid of the RSYNC_RSH_IO stuff for now. 2003-12-17 09:29:35 +00:00
Wayne Davison
90e22f4b51 Backed out the RSYNC_RSH_IO support for now. 2003-12-17 09:28:45 +00:00
J.W. Schultz
ab304c268c Removed hardlink reporting bug from TODO list -- seems to be
fixed.
2003-12-17 00:52:01 +00:00
J.W. Schultz
16a3fec02d Added keword base reporting to TODO features list. 2003-12-17 00:49:50 +00:00
J.W. Schultz
abb0b532f8 Reorganized and cleaned up TODO list. 2003-12-17 00:47:39 +00:00
Wayne Davison
43cd760fc1 - Changed the places that talked about rsh being the default shell.
- Document the new RSYNC_RSH_IO environment variable.
2003-12-16 23:07:19 +00:00
Wayne Davison
9af87151ec We now support an environment variable named RSYNC_RSH_IO which lets the
user set the blocking-IO value for the shell specified by RSYNC_RSH.
2003-12-16 23:06:25 +00:00
Wayne Davison
8dd99390f5 Added RSYNC_RSH_IO_ENV. 2003-12-16 23:04:59 +00:00
Wayne Davison
e636af6b23 Mention change to ssh. 2003-12-16 19:48:25 +00:00
Wayne Davison
e3217f1448 Tweaked an obsolete comment. 2003-12-16 18:02:15 +00:00
Wayne Davison
66b711633f Improved the default-blocking-I/O code to discern rsh from ssh
properly.
2003-12-16 18:02:03 +00:00
Wayne Davison
f40f2fc8ce Made the default remote-shell be "ssh" (override with --with-rsh=FOO). 2003-12-16 18:01:06 +00:00
Wayne Davison
e6f9e388cf Moved the information on the single-use ssh key so that the --server
option wasn't being mentioned early in the rsync manpage (which has
confused at least one user trying to figure out the --daemon mode
command-line syntax).
2003-12-15 20:10:21 +00:00
Wayne Davison
3c1e2ad956 Document new error code 24. 2003-12-15 19:49:38 +00:00
Wayne Davison
e6d2799170 Updated version. 2003-12-15 19:04:04 +00:00
Wayne Davison
2cfbf4bc0e Changed the version to 2.6.0pre1. 2003-12-15 19:00:20 +00:00
Wayne Davison
f7731f1fc2 Removed some obsolete items. 2003-12-15 18:45:27 +00:00
Wayne Davison
7d3f8ae2df Make sure we only use blocking-I/O if blocking_io is > 0. 2003-12-15 18:45:07 +00:00
Wayne Davison
a60fdd63f4 Changed version to 2.6.0. 2003-12-15 18:25:10 +00:00
Wayne Davison
3a7dec59bc Changed version to 2.6.0 in preparation for new release. 2003-12-15 18:22:12 +00:00
Wayne Davison
880ae34190 Got rid of setgroups() caveat for OSX -- we fixed that a while back. 2003-12-15 18:20:06 +00:00
Wayne Davison
d00daf1f3f Mentioned the vanished-file warning enhancement. 2003-12-15 08:44:55 +00:00
Wayne Davison
17fadf7d40 Twiddled some whitespace and multi-line comments. 2003-12-15 08:14:27 +00:00
Wayne Davison
06c28400fa New "io_error" variable handling for RERR_VANISHED support. 2003-12-15 08:10:31 +00:00
Wayne Davison
6e35c72fdb Return new RERR_VANISHED code, as appropriate. 2003-12-15 08:08:44 +00:00
Wayne Davison
e2d22fee53 Added new IOERR_* defines. 2003-12-15 08:07:38 +00:00
Wayne Davison
1bca1de6cc Handle new RERR_VANISHED error. 2003-12-15 08:06:52 +00:00
Wayne Davison
e0ed4e4087 Added RERR_VANISHED. 2003-12-15 08:04:14 +00:00
Wayne Davison
4a7319be12 Neatened up some whitespace issues and made multi-line comments more
consistent.
2003-12-15 01:45:01 +00:00
Wayne Davison
55d5937dd6 Simplified the setting of the reading_remotely variable in function
read_filesfrom_line() now that remote_filesfrom_file is set more
often.
2003-12-15 00:54:44 +00:00
Wayne Davison
63596e1c4a If we're the server and --files-from is "-", set remote_filesfrom_file
to "-" as well (since the data is coming over the socket from the remote
side).
2003-12-15 00:53:07 +00:00
Wayne Davison
603e6b05c7 Neatened up the indentation. 2003-12-12 17:13:22 +00:00
J.W. Schultz
dfad66a838 Sanity check s2length on recept. 2003-12-06 21:35:34 +00:00
Wayne Davison
58cadc8608 Merged in the security fixes from 2.5.7. 2003-12-06 21:07:27 +00:00
34 changed files with 1326 additions and 1147 deletions

View File

@@ -48,10 +48,6 @@ completely implement the "New Sockets" API.
<http://www.ipv6.org/impl/mac.html> says that Apple do not support
IPv6 yet. If your build fails, try again with --disable-ipv6.
There is an unresolved problem with the OSX implimentation
of setgroups causing rsyncd to fail. The workaround is to
#undef HAVE_SETGROUPS in config.h
IBM AIX NOTES
-------------

139
NEWS
View File

@@ -1,26 +1,34 @@
NEWS for rsync version 2.5.7
NEWS for rsync 2.6.0 (1 Jan 2004)
Protocol: 27 (changed)
Changes since version 2.5.6:
Changes since 2.5.7:
ENHANCEMENTS:
* "ssh" is now the default remote shell for rsync. If you want to
change this, configure like this: "./configure --with-rsh=rsh".
* Added --files-from, --no-relative, --no-implied-dirs, and --from0.
Note that --from0 affects the line-ending character for all the
--*-from options. (Wayne Davison)
files read by the --*-from options. (Wayne Davison)
* Length of csum2 is now per-file starting with protocol verison
* Length of csum2 is now per-file starting with protocol version
27. (J.W. Schultz)
* Per-file dynamic block size is now sqrt(file length).
The per-file checksum size is determined according
to an algorythm provided by Donovan Baarda which
reduces the probability of rsync algorithm
corrupting data and falling back using the whole md4
* Per-file dynamic block size is now sqrt(file length). The
per-file checksum size is determined according to an algorithm
provided by Donovan Baarda which reduces the probability of rsync
algorithm corrupting data and falling back using the whole md4
checksums. (J.W. Schultz, Donovan Baarda)
* The --stats option no longer includes the (debug) malloc summary
unless the verbose option was specified at least twice.
* Added a new error/warning code for when files vanish from the
sending side. Made vanished source files not interfere with the
file-deletion pass when --delete-after was specified.
* Various trailing-info sections are now preceded by a newline.
BUG FIXES:
* Fixed several exclude/include matching bugs when using wild-cards.
@@ -42,17 +50,17 @@ Changes since version 2.5.6:
against the entire path, not just the name portion, even if
there aren't any interior slashes in the term. E.g. "foo**bar"
would exclude "/path/foo-bar" (just like before) as well as
"/foo-path/baz-bar" (for instance).
"/foo-path/baz-bar" (unlike before).
* The exclude list specified in the daemon's config file is now
properly applied to the pulled items no matter how deep the
user's file args are in the source tree. (Wayne Davison)
user's file-args are in the source tree. (Wayne Davison)
* For protocol version >= 27, mdfour_tail() is called when the
block size (including checksum_seed) is a multiple of 64.
Previously it was not called, giving the wrong MD4 checksum.
(Craig Barratt)
* For protocol version >= 27, a 64 bit bit counter is used in
mdfour.c as required by the RFC. Previously only a 32 bit bit
counter was used, causing incorrect MD4 file checksums for
@@ -71,6 +79,12 @@ Changes since version 2.5.6:
* Fixed file I/O error detection. (John Van Essen)
* Fixed bogus "malformed address {hostname}" message in rsyncd log
when checking IP address against hostnames from "hosts allow"
and "hosts deny" parameters in config file.
* Print heap statistics when verbose >= 2 instead of when >= 1.
* Fixed a compression (-z) bug when syncing a mostly-matching file
that contains already-compressed data. (Yasuoka Masahiko and
Wayne Davison)
@@ -78,6 +92,10 @@ Changes since version 2.5.6:
* Fixed a bug in the --backup code that could cause deleted files
to not get backed up.
* When the backup code makes new directories, create them with mode
0700 instead of 0755 (since the directory permissions in the
backup tree are not yet copied from the main tree).
* Call setgroups() in a more portable manner.
* Improved file-related error messages to better indicate exactly
@@ -96,6 +114,9 @@ Changes since version 2.5.6:
readdir fail caused by network filesystems issues and truncated
files. (David Norwood, Michael Brown, J.W. Schultz)
* Added a fix that should give ssh time to restore the tty settings
if the user presses Ctrl-C at an ssh password prompt.
INTERNAL:
* Eliminated vestigial support for old versions that we stopped
@@ -111,97 +132,3 @@ Changes since version 2.5.6:
Added an undocumented option, --protocol=N, to force the value
we advertise to the other side (primarily for testing purposes).
(Wayne Davison)
NEWS for rsync version 2.5.6, aka the dwd-between-jobs release
Protocol: 26 (unchanged)
Changes since version 2.5.5:
ENHANCEMENTS:
* The --delete-after option now implies --delete. (Wayne Davison)
* The --suffix option can now be used with --backup-dir. (Michael
Zimmerman)
* Combining "::" syntax with the -rsh/-e option now uses the
specified remote-shell as a transport to talk to a (newly-spawned)
server-daemon. This allows someone to use daemon features, such
as modules, over a secure protocol, such as ssh. (JD Paul)
* The rsync:// syntax for daemon connections is now accepted in the
destination field.
* If the file name given to --include-from or --exclude-from is "-",
rsync will read from standard input. (J.W. Schultz)
* New option --link-dest which is like --compare-dest except that
unchanged files are hard-linked in to the destination directory.
(J.W. Schultz)
* Don't report an error if an excluded file disappears during an
rsync run. (Eugene Chupriyanov and Bo Kersey)
* Added .svn to --cvs-exclude list to support subversion. (Jon
Middleton)
* Properly support IPv6 addresses in the rsyncd.conf "hosts allow"
and "hosts deny" fields. (Hideaki Yoshifuji)
* Changed exclude file handling to permit DOS or MAC style line
terminations. (J.W. Schultz)
* Ignore errors from chmod when -p/-a/--preserve-perms is not set.
(Dave Dykstra)
BUG FIXES:
* Fix "forward name lookup failed" errors on AIX 4.3.3. (John
L. Allen, Martin Pool)
* Generate each file's rolling-checksum data as we send it, not
in a separate (memory-eating) pass before hand. This prevents
timeout errors on really large files. (Stefan Nehlsen)
* Fix compilation on Tru64. (Albert Chin, Zoong Pham)
* Better handling of some client-server errors. (Martin Pool)
* Fixed a crash that would occur when sending a list of files that
contains a duplicate name (if it sorts to the end of the file
list) and using --delete. (Wayne Davison)
* Fixed the file-name duplicate-removal code when dealing with multiple
dups in a row. (Wayne Davison)
* Fixed a bug that caused rsync to lose the exit status of its child
processes and sometimes return an exit code of 0 instead of showing
an error. (David R. Staples, Dave Dykstra)
* Fixed bug in --copy-unsafe-links that caused it to be completely
broken. (Dave Dykstra)
* Prevent infinite recursion in cleanup code under certain circumstances.
(Sviatoslav Sviridov and Marc Espie)
* Fixed a bug that prevented rsync from creating intervening directories
when --relative-paths/-R is set. (Craig Barratt)
* Prevent "Connection reset by peer" messages from Cygwin. (Randy O'Meara)
INTERNAL:
* Many code cleanups and improved internal documentation. (Martin
Pool, Nelson Beebe)
* Portability fixes. (Dave Dykstra and Wayne Davison)
* More test cases. (Martin Pool)
* Some test-case fixes. (Brian Poole, Wayne Davison)
* Updated included popt to the latest vendor drop, version 1.6.4.
(Jos Backus)
* Updated config.guess and config.sub to latest versions; this
means rsync should build on more platforms. (Paul Green)

247
OLDNEWS
View File

@@ -1,5 +1,110 @@
rsync 2.5.5 "Snowy River" (2 April 2002)
protocol: 26 (unchanged)
NEWS for rsync 2.5.7 (4 Dec 2003)
Protocol: 26 (unchanged)
Changes since 2.5.6:
SECURITY FIXES:
* Fix buffer handling bugs. (Andrew Tridgell, Martin Pool, Paul
Russell, Andrea Barisani)
NEWS for rsync 2.5.6, aka "the dwd-between-jobs release" (26 Jan 2003)
Protocol: 26 (unchanged)
Changes since 2.5.5:
ENHANCEMENTS:
* The --delete-after option now implies --delete. (Wayne Davison)
* The --suffix option can now be used with --backup-dir. (Michael
Zimmerman)
* Combining "::" syntax with the -rsh/-e option now uses the
specified remote-shell as a transport to talk to a (newly-spawned)
server-daemon. This allows someone to use daemon features, such
as modules, over a secure protocol, such as ssh. (JD Paul)
* The rsync:// syntax for daemon connections is now accepted in the
destination field.
* If the file name given to --include-from or --exclude-from is "-",
rsync will read from standard input. (J.W. Schultz)
* New option --link-dest which is like --compare-dest except that
unchanged files are hard-linked in to the destination directory.
(J.W. Schultz)
* Don't report an error if an excluded file disappears during an
rsync run. (Eugene Chupriyanov and Bo Kersey)
* Added .svn to --cvs-exclude list to support subversion. (Jon
Middleton)
* Properly support IPv6 addresses in the rsyncd.conf "hosts allow"
and "hosts deny" fields. (Hideaki Yoshifuji)
* Changed exclude file handling to permit DOS or MAC style line
terminations. (J.W. Schultz)
* Ignore errors from chmod when -p/-a/--preserve-perms is not set.
(Dave Dykstra)
BUG FIXES:
* Fix "forward name lookup failed" errors on AIX 4.3.3. (John
L. Allen, Martin Pool)
* Generate each file's rolling-checksum data as we send it, not
in a separate (memory-eating) pass before hand. This prevents
timeout errors on really large files. (Stefan Nehlsen)
* Fix compilation on Tru64. (Albert Chin, Zoong Pham)
* Better handling of some client-server errors. (Martin Pool)
* Fixed a crash that would occur when sending a list of files that
contains a duplicate name (if it sorts to the end of the file
list) and using --delete. (Wayne Davison)
* Fixed the file-name duplicate-removal code when dealing with multiple
dups in a row. (Wayne Davison)
* Fixed a bug that caused rsync to lose the exit status of its child
processes and sometimes return an exit code of 0 instead of showing
an error. (David R. Staples, Dave Dykstra)
* Fixed bug in --copy-unsafe-links that caused it to be completely
broken. (Dave Dykstra)
* Prevent infinite recursion in cleanup code under certain circumstances.
(Sviatoslav Sviridov and Marc Espie)
* Fixed a bug that prevented rsync from creating intervening directories
when --relative-paths/-R is set. (Craig Barratt)
* Prevent "Connection reset by peer" messages from Cygwin. (Randy O'Meara)
INTERNAL:
* Many code cleanups and improved internal documentation. (Martin
Pool, Nelson Beebe)
* Portability fixes. (Dave Dykstra and Wayne Davison)
* More test cases. (Martin Pool)
* Some test-case fixes. (Brian Poole, Wayne Davison)
* Updated included popt to the latest vendor drop, version 1.6.4.
(Jos Backus)
* Updated config.guess and config.sub to latest versions; this
means rsync should build on more platforms. (Paul Green)
NEWS for rsync 2.5.5, aka Snowy River (2 Apr 2002)
Protocol: 26 (unchanged)
Changes since 2.5.4:
ENHANCEMENTS:
@@ -38,16 +143,15 @@ protocol: 26 (unchanged)
* Improved network error handling. (Greg A. Woods)
rsync 2.5.4 (13 March 2002)
protocol: 26 (unchanged)
"Imitation lizard skin"
NEWS for rsync 2.5.4, aka "Imitation lizard skin" (13 Mar 2002)
Protocol: 26 (unchanged)
Changes since 2.5.3:
BUG FIXES:
* Additional fix for zlib double-free bug. (Martin Pool, Andrew
Tridgell) (CVE CAN-2002-0059)
ENHANCEMENTS:
* Merge in changes from zlib 1.1.3 to zlib 1.1.4. (Jos Backus)
@@ -57,10 +161,9 @@ protocol: 26 (unchanged)
* Additional test cases for --compress. (Martin Pool)
rsync 2.5.3 (11 March 2002)
protocol: 26 (unchanged)
"Happy 26"
NEWS for rsync 2.5.3, aka "Happy 26" (11 Mar 2002)
Protocol: 26 (unchanged)
Changes since 2.5.2:
SECURITY FIXES:
@@ -73,7 +176,7 @@ protocol: 26 (unchanged)
* Fix zlib double-free bug. (Owen Taylor, Mark J Cox) (CVE
CAN-2002-0059)
* Fixed problem that in many cases caused the error message
* Fixed problem that in many cases caused the error message
unexpected read size of 0 in map_ptr
and resulted in the wrong data being copied.
@@ -94,7 +197,7 @@ protocol: 26 (unchanged)
* Merge in changes from zlib 1.1.2 to zlib 1.1.3. (Note that
rsync still uses a custom version of zlib; you can not just link
against a system library. See zlib/README.rsync)
* Command to initiate connections is only shown with -vv, rather
than -v as in 2.5.2. Output from plain -v is more similar to
what was historically used so as not to break scripts that try
@@ -108,8 +211,10 @@ protocol: 26 (unchanged)
* If the daemon is unable to fork a child to accept a connection,
print an error message. (Colin Walters)
rsync 2.5.2 (26 Jan 2002)
protocol: 26 (changed)
NEWS for rsync 2.5.2 (26 Jan 2002)
Protocol: 26 (changed)
Changes since 2.5.1:
SECURITY FIXES:
@@ -136,7 +241,7 @@ protocol: 26 (changed)
connection.
* --statistics now shows memory heap usage on platforms that
support mallinfo().
support mallinfo().
* "The Ted T'so school of program optimization": make progress
visible and people will think it's faster. (With --progress,
@@ -145,15 +250,17 @@ protocol: 26 (changed)
* Improvements to batch mode support. This is still experimental
but testing would be welcome. (Jos Backus)
* New --ignore-existing option, patch previously distributed with
Vipul's Razor. (Debian #124286)
rsync 2.5.1 (2002-01-03)
protocol: 25 (unchanged)
NEWS for rsync 2.5.1 (3 Jan 2002)
Protocol: 25 (unchanged)
Changes since 2.5.0:
BUG FIXES:
BUG FIXES:
* Fix for segfault in --daemon mode configuration parser. (Paul
Mackerras)
@@ -175,18 +282,19 @@ protocol: 25 (unchanged)
ENHANCEMENTS:
* --progress and -P now show estimated data transfer rate (in a
multiple of bytes/s) and estimated time to completion. (Rik
Faith)
multiple of bytes/s) and estimated time to completion. (Rik
Faith)
* --no-detach option, required to run as a W32 service and also
useful when running on Unix under daemontools, AIX's SRC, or a
debugger. (Max Bowsher, Jos Backus)
useful when running on Unix under daemontools, AIX's SRC, or a
debugger. (Max Bowsher, Jos Backus)
* Clearer error messages for some conditions.
rsync 2.5.0 (2001-11-30)
protocol: 25 (changed)
NEWS for rsync 2.5.0 (30 Nov 2001)
Protocol: 25 (changed)
Changes since 2.4.6:
ANNOUNCEMENTS
@@ -248,7 +356,7 @@ protocol: 25 (changed)
* Attempt to fix error handling lockup bug.
* Give a non-0 exit code if *any* of the files we have been asked
to transfer fail to transfer
to transfer fail to transfer.
* For log messages containing ridiculously long strings that might
overflow a buffer rsync no longer aborts, but rather prints an
@@ -259,7 +367,7 @@ protocol: 25 (changed)
* Improved support for UNICOS (tested on Cray T3E and Cray SV1)
* autoconf2.52 (or later) is now required to rebuild the autoconf
scripts. It is not required to simply build rsync.
scripts. It is not required to simply build rsync.
* Platforms thought to work in this release:
@@ -302,41 +410,46 @@ protocol: 25 (changed)
build farm.
Partial Protocol History
DATE RELEASE PROTOCOL
2003/01/26 20:11:16 release-2-5-6 26
2002/02/23 00:17:50 release-2-5-3 26
2002/01/25 23:00:21 release-2-5-2 26
2001/12/18 06:47:40 release-2-5-1 25
release-2-4-6 24
2000/08/16 08:34:18 release-2-4-5 24
2000/07/29 04:52:05 release-2-4-4 24
2000/03/30 14:15:00 release-2-4-2 24
2000/01/29 23:49:36 release-2-4-1 24
2000/01/29 02:56:37 release-2-4-0 23
release-2-3-3 21
1999/06/26 01:06:38 release-2-3-2 21
release-2-3-1 20
1999/03/15 21:17:59 release-2-3-0 20
1998/11/15 01:21:42 release-2-2-1 19
1998/11/03 07:08:28 release-2-2-0 19
1998/09/09 06:31:14 release-2-1-1 19
1998/07/17 14:43:05 release-2-0-19 19
1998/06/18 12:17:24 release-2-0-18 19
1998/06/18 09:51:56 release-2-0-17 19
1998/06/01 03:42:22 release-2-0-16 19
1998/05/27 13:47:34 release-2-0-13 19
1998/05/26 14:19:00 release-2-0-12 18
1998/05/21 05:55:33 release-2-0-11 18
1998/05/18 08:20:34 release-2-0-9 18
1998/05/17 05:56:33 release-2-0-8 17
1998/05/15 07:34:21 release-2-0-2 17
1998/05/13 15:44:11 release-2-0-0 17
1998/04/17 06:07:26 release-1-7-4 17
1998/04/05 06:43:55 release-1-7-2 17
1998/03/26 04:18:57 release-1-7-0 17 MAX=30
1998/01/13 15:57:32 release-1-6-9 15 MAX=20
1997/12/17 11:07:30 release-1-6-7 14
1997/12/15 18:36:21 release-1-6-4 14
RELEASE DATE VER. DATE OF COMMIT PROTOCOL
01 Jan 2004 2.6.0 10 Apr 2003 27 (MAX=40)
04 Dec 2003 2.5.7 26
26 Jan 2003 2.5.6 26
02 Apr 2002 2.5.5 26
13 Mar 2002 2.5.4 26
11 Mar 2002 2.5.3 26
26 Jan 2002 2.5.2 11 Jan 2002 26
03 Jan 2002 2.5.1 25
30 Nov 2001 2.5.0 23 Aug 2001 25
06 Sep 2000 2.4.6 24
19 Aug 2000 2.4.5 24
29 Jul 2000 2.4.4 24
09 Apr 2000 2.4.3 24
30 Mar 2000 2.4.2 24
30 Jan 2000 2.4.1 29 Jan 2000 24
29 Jan 2000 2.4.0 28 Jan 2000 23
25 Jan 2000 2.3.3 23 Jan 2000 22
08 Nov 1999 2.3.2 26 Jun 1999 21
06 Apr 1999 2.3.1 20
15 Mar 1999 2.3.0 15 Mar 1999 20
25 Nov 1998 2.2.1 19
03 Nov 1998 2.2.0 19
09 Sep 1998 2.1.1 19
20 Jul 1998 2.1.0 19
17 Jul 1998 2.0.19 19
18 Jun 1998 2.0.17 19
01 Jun 1998 2.0.16 19
27 May 1998 2.0.13 27 May 1998 19
26 May 1998 2.0.12 18
22 May 1998 2.0.11 18
18 May 1998 2.0.9 18 May 1998 18
17 May 1998 2.0.8 17
15 May 1998 2.0.1 17
14 May 1998 2.0.0 17
17 Apr 1998 1.7.4 17
13 Apr 1998 1.7.3 17
05 Apr 1998 1.7.2 17
26 Mar 1998 1.7.1 17
26 Mar 1998 1.7.0 26 Mar 1998 17 (MAX=30)
13 Jan 1998 1.6.9 13 Jan 1998 15 (MAX=20)
* DATE OF COMMIT is the date the protocl change was committed
to cvs, not the release date.
* DATE OF COMMIT is the date the protocol change was committed to CVS.

1164
TODO
View File

File diff suppressed because it is too large Load Diff

21
batch.c
View File

@@ -185,15 +185,14 @@ struct file_list *create_flist_from_batch(void)
fdb_open = 1;
fdb_close = 0;
batch_flist = (struct file_list *) malloc(sizeof(batch_flist[0]));
batch_flist = new(struct file_list);
if (!batch_flist) {
out_of_memory("create_flist_from_batch");
}
batch_flist->count = 0;
batch_flist->malloced = 1000;
batch_flist->files =
(struct file_struct **) malloc(sizeof(batch_flist->files[0]) *
batch_flist->malloced);
batch_flist->files = new_array(struct file_struct *,
batch_flist->malloced);
if (!batch_flist->files) {
out_of_memory("create_flist_from_batch");
}
@@ -207,14 +206,10 @@ struct file_list *create_flist_from_batch(void)
batch_flist->malloced += 1000;
else
batch_flist->malloced *= 2;
batch_flist->files =
(struct file_struct **) realloc(batch_flist->
files,
sizeof
(batch_flist->
files[0]) *
batch_flist->
malloced);
batch_flist->files
= realloc_array(batch_flist->files,
struct file_struct *,
batch_flist->malloced);
if (!batch_flist->files)
out_of_memory("create_flist_from_batch");
}
@@ -282,7 +277,7 @@ void read_batch_flist_info(struct file_struct **fptr)
char buff[256];
struct file_struct *file;
file = (struct file_struct *) malloc(sizeof(*file));
file = new(struct file_struct);
if (!file)
out_of_memory("read_batch_flist_info");
memset((char *) file, 0, sizeof(*file));

View File

@@ -58,7 +58,7 @@ void get_checksum2(char *buf,int len,char *sum)
if (len > len1) {
if (buf1) free(buf1);
buf1 = (char *)malloc(len+4);
buf1 = new_array(char, len+4);
len1 = len;
if (!buf1) out_of_memory("get_checksum2");
}

View File

@@ -131,8 +131,11 @@ void _exit_cleanup(int code, const char *file, int line)
}
}
if (code == 0 && (io_error || log_got_error)) {
code = RERR_PARTIAL;
if (code == 0) {
if ((io_error & ~IOERR_VANISHED) || log_got_error)
code = RERR_PARTIAL;
else if (io_error)
code = RERR_VANISHED;
}
if (code) log_exit(code, file, line);

View File

@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h])
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.52)
RSYNC_VERSION=2.5.6
RSYNC_VERSION=2.6.0
AC_SUBST(RSYNC_VERSION)
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
@@ -90,14 +90,14 @@ AC_ARG_WITH(included-popt,
[ --with-included-popt use bundled popt library, not from system])
AC_ARG_WITH(rsync-path,
[ --with-rsync-path=PATH set default --rsync-path to PATH (default: \"rsync\")],
[ --with-rsync-path=PATH set default --rsync-path to PATH (default: rsync)],
[ RSYNC_PATH="$with_rsync_path" ],
[ RSYNC_PATH="rsync" ])
AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
AC_ARG_WITH(rsh,
AC_HELP_STRING([--with-rsh=CMD], [set rsh command to CMD (default: \"remsh\" or \"rsh\")]))
AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)]))
AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [remote shell is remsh not rsh])
@@ -105,11 +105,8 @@ AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [remote shell is remsh not rsh])
if test x"$with_rsh" != x
then
RSYNC_RSH="$with_rsh"
elif test x"$HAVE_REMSH" = x1
then
RSYNC_RSH="remsh"
else
RSYNC_RSH="rsh"
RSYNC_RSH="ssh"
fi
AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
@@ -627,6 +624,21 @@ AC_SUBST(BUILD_POPT)
AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
AC_OUTPUT
if test x"$with_rsh" = x; then
if test x"$HAVE_REMSH" = x1; then
rmsh1='remsh:'
rmsh2='=remsh'
else
rmsh1='rsh: '
rmsh2='=rsh '
fi
AC_MSG_RESULT()
AC_MSG_RESULT([ **********************************************************************])
AC_MSG_RESULT([ * As of v2.6.0, the default remote shell is ssh instead of rsh!! *])
AC_MSG_RESULT([ * To use previous default of $rmsh1 ./configure --with-rsh$rmsh2 *])
AC_MSG_RESULT([ **********************************************************************])
fi
AC_MSG_RESULT()
AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
AC_MSG_RESULT()

View File

@@ -26,7 +26,7 @@
#define RERR_SYNTAX 1 /* syntax or usage error */
#define RERR_PROTOCOL 2 /* protocol incompatibility */
#define RERR_FILESELECT 3 /* errors selecting input/output files, dirs */
#define RERR_UNSUPPORTED 4 /* requested action not supported */
#define RERR_UNSUPPORTED 4 /* requested action not supported */
#define RERR_STARTCLIENT 5 /* error starting client-server protocol */
#define RERR_SOCKETIO 10 /* error in socket IO */
@@ -39,6 +39,7 @@
#define RERR_WAITCHILD 21 /* some error returned by waitpid() */
#define RERR_MALLOC 22 /* error allocating core memory buffers */
#define RERR_PARTIAL 23 /* partial transfer */
#define RERR_VANISHED 24 /* file(s) vanished on sender side */
#define RERR_TIMEOUT 30 /* timeout in data send/receive */

View File

@@ -40,7 +40,7 @@ static struct exclude_struct *make_exclude(const char *pattern, int include)
char *cp;
int pat_len;
ret = (struct exclude_struct *)malloc(sizeof(*ret));
ret = new(struct exclude_struct);
if (!ret) out_of_memory("make_exclude");
memset(ret, 0, sizeof(*ret));
@@ -57,8 +57,8 @@ static struct exclude_struct *make_exclude(const char *pattern, int include)
if (exclude_path_prefix)
ret->match_flags |= MATCHFLG_ABS_PATH;
if (exclude_path_prefix && *pattern == '/') {
ret->pattern = malloc(strlen(exclude_path_prefix)
+ strlen(pattern) + 1);
ret->pattern = new_array(char,
strlen(exclude_path_prefix) + strlen(pattern) + 1);
if (!ret->pattern) out_of_memory("make_exclude");
sprintf(ret->pattern, "%s%s", exclude_path_prefix, pattern);
}
@@ -245,7 +245,7 @@ void add_exclude(struct exclude_struct ***listp, const char *pattern, int includ
if (list)
for (; list[len]; len++) {}
list = *listp = (struct exclude_struct **)Realloc(list,sizeof(struct exclude_struct *)*(len+2));
list = *listp = realloc_array(list, struct exclude_struct *, len+2);
if (!list || !(list[len] = make_exclude(pattern, include)))
out_of_memory("add_exclude");

View File

@@ -105,7 +105,7 @@ int write_file(int f,char *buf,size_t len)
struct map_struct *map_file(int fd,OFF_T len)
{
struct map_struct *map;
map = (struct map_struct *)malloc(sizeof(*map));
map = new(struct map_struct);
if (!map) out_of_memory("map_file");
map->fd = fd;
@@ -160,7 +160,7 @@ char *map_ptr(struct map_struct *map,OFF_T offset,int len)
/* make sure we have allocated enough memory for the window */
if (window_size > map->p_size) {
map->p = (char *)Realloc(map->p, window_size);
map->p = realloc_array(map->p, char, window_size);
if (!map->p) out_of_memory("map_ptr");
map->p_size = window_size;
}

55
flist.c
View File

@@ -58,7 +58,6 @@ extern int implied_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int io_error;
extern int sanitize_paths;
extern int read_batch;
@@ -68,6 +67,8 @@ extern struct exclude_struct **exclude_list;
extern struct exclude_struct **server_exclude_list;
extern struct exclude_struct **local_exclude_list;
int io_error;
static struct file_struct null_file;
static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
@@ -123,10 +124,10 @@ static struct string_area *string_area_new(int size)
if (size <= 0)
size = ARENA_SIZE;
a = malloc(sizeof(*a));
a = new(struct string_area);
if (!a)
out_of_memory("string_area_new");
a->current = a->base = malloc(size);
a->current = a->base = new_array(char, size);
if (!a->current)
out_of_memory("string_area_new buffer");
a->end = a->base + size;
@@ -327,7 +328,6 @@ static char *flist_dir;
static void flist_expand(struct file_list *flist)
{
if (flist->count >= flist->malloced) {
size_t new_bytes;
void *new_ptr;
if (flist->malloced < 1000)
@@ -335,16 +335,19 @@ static void flist_expand(struct file_list *flist)
else
flist->malloced *= 2;
new_bytes = sizeof(flist->files[0]) * flist->malloced;
if (flist->files)
new_ptr = realloc(flist->files, new_bytes);
else
new_ptr = malloc(new_bytes);
if (flist->files) {
new_ptr = realloc_array(flist->files,
struct file_struct *,
flist->malloced);
} else {
new_ptr = new_array(struct file_struct *,
flist->malloced);
}
if (verbose >= 2) {
rprintf(FINFO, "expand file_list to %.0f bytes, did%s move\n",
(double) new_bytes,
(double)sizeof(flist->files[0])
* flist->malloced,
(new_ptr == flist->files) ? " not" : "");
}
@@ -502,7 +505,7 @@ static void receive_file_entry(struct file_struct **fptr,
else
l2 = read_byte(f);
file = (struct file_struct *) malloc(sizeof(*file));
file = new(struct file_struct);
if (!file)
out_of_memory("receive_file_entry");
memset((char *) file, 0, sizeof(*file));
@@ -569,7 +572,7 @@ static void receive_file_entry(struct file_struct **fptr,
rprintf(FERROR, "overflow: l=%d\n", l);
overflow("receive_file_entry");
}
file->link = (char *) malloc(l + 1);
file->link = new_array(char, l + 1);
if (!file->link)
out_of_memory("receive_file_entry 2");
read_sbuf(f, file->link, l);
@@ -590,7 +593,7 @@ static void receive_file_entry(struct file_struct **fptr,
#endif
if (always_checksum) {
file->sum = (char *) malloc(MD4_SUM_LENGTH);
file->sum = new_array(char, MD4_SUM_LENGTH);
if (!file->sum)
out_of_memory("md4 sum");
if (protocol_version < 21) {
@@ -692,7 +695,7 @@ struct file_struct *make_file(char *fname, struct string_area **ap,
return NULL;
}
}
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "readlink %s failed: %s\n",
full_fname(fname), strerror(save_errno));
return NULL;
@@ -723,7 +726,7 @@ struct file_struct *make_file(char *fname, struct string_area **ap,
if (verbose > 2)
rprintf(FINFO, "make_file(%s,*,%d)\n", fname, exclude_level);
file = (struct file_struct *) malloc(sizeof(*file));
file = new(struct file_struct);
if (!file)
out_of_memory("make_file");
memset((char *) file, 0, sizeof(*file));
@@ -842,7 +845,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
d = opendir(dir);
if (!d) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "opendir %s failed: %s\n",
full_fname(dir), strerror(errno));
return;
@@ -852,7 +855,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
l = strlen(fname);
if (fname[l - 1] != '/') {
if (l == MAXPATHLEN - 1) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "skipping long-named directory: %s\n",
full_fname(fname));
closedir(d);
@@ -870,7 +873,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
strcpy(p, ".cvsignore");
add_exclude_file(&exclude_list,fname,MISSING_OK,ADD_EXCLUDE);
} else {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FINFO,
"cannot cvs-exclude in long-named directory %s\n",
full_fname(fname));
@@ -886,7 +889,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
send_file_name(f, flist, fname, recurse, 0);
}
if (errno) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "readdir(%s): (%d) %s\n",
dir, errno, strerror(errno));
}
@@ -961,7 +964,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
if (link_stat(fname, &st) != 0) {
if (f != -1) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "link_stat %s failed: %s\n",
full_fname(fname), strerror(errno));
}
@@ -1028,7 +1031,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
olddir = push_dir(dir, 1);
if (!olddir) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "push_dir %s failed: %s\n",
full_fname(dir), strerror(errno));
continue;
@@ -1101,15 +1104,13 @@ struct file_list *recv_file_list(int f)
start_read = stats.total_read;
flist = (struct file_list *) malloc(sizeof(flist[0]));
flist = new(struct file_list);
if (!flist)
goto oom;
flist->count = 0;
flist->malloced = 1000;
flist->files =
(struct file_struct **) malloc(sizeof(flist->files[0]) *
flist->malloced);
flist->files = new_array(struct file_struct *, flist->malloced);
if (!flist->files)
goto oom;
@@ -1251,7 +1252,7 @@ struct file_list *flist_new(void)
{
struct file_list *flist;
flist = (struct file_list *) malloc(sizeof(flist[0]));
flist = new(struct file_list);
if (!flist)
out_of_memory("send_file_list");

View File

@@ -135,7 +135,7 @@ void write_sum_head(int f, struct sum_struct *sum)
* This might be made one of several selectable heuristics.
*/
static void sum_sizes_sqroot_baarda(struct sum_struct *sum, uint64 len)
static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len)
{
extern int block_size;
int blength, s2length, b;
@@ -233,7 +233,7 @@ static void generate_and_send_sums(struct map_struct *buf, OFF_T len, int f_out)
struct sum_struct sum;
OFF_T offset = 0;
sum_sizes_sqroot_baarda(&sum, len);
sum_sizes_sqroot(&sum, len);
write_sum_head(f_out, &sum);

View File

@@ -57,9 +57,7 @@ void init_hard_links(struct file_list *flist)
if (hlink_list)
free(hlink_list);
if (!(hlink_list =
(struct file_struct *) malloc(sizeof(hlink_list[0]) *
flist->count)))
if (!(hlink_list = new_array(struct file_struct, flist->count)))
out_of_memory("init_hard_links");
for (i = 0; i < flist->count; i++)

6
io.c
View File

@@ -270,7 +270,6 @@ static int read_timeout(int fd, char *buf, size_t len)
continue;
}
if (io_error_fd != -1 && FD_ISSET(io_error_fd, &r_fds)) {
read_error_fd();
}
@@ -375,8 +374,7 @@ int read_filesfrom_line(int fd, char *fname)
extern int io_timeout;
extern int eol_nulls;
extern char *remote_filesfrom_file;
extern int am_server;
int reading_remotely = remote_filesfrom_file || (am_server && fd == 0);
int reading_remotely = remote_filesfrom_file != NULL;
int nulls = eol_nulls || reading_remotely;
start:
@@ -688,7 +686,7 @@ void io_start_buffering(int fd)
{
if (io_buffer) return;
multiplex_out_fd = fd;
io_buffer = (char *)malloc(IO_BUFFER_SIZE);
io_buffer = new_array(char, IO_BUFFER_SIZE);
if (!io_buffer) out_of_memory("writefd");
io_buffer_count = 0;
}

View File

@@ -441,10 +441,10 @@ static int add_a_service(service *pservice, char *name)
i = iNumServices;
ServicePtrs = (service **)Realloc(ServicePtrs,sizeof(service *)*num_to_alloc);
ServicePtrs = realloc_array(ServicePtrs, service *, num_to_alloc);
if (ServicePtrs)
pSERVICE(iNumServices) = (service *)malloc(sizeof(service));
pSERVICE(iNumServices) = new(service);
if (!ServicePtrs || !pSERVICE(iNumServices))
return(-1);

174
log.c
View File

@@ -1,18 +1,18 @@
/* -*- c-file-style: "linux"; -*-
Copyright (C) 1998-2001 by Andrew Tridgell <tridge@samba.org>
Copyright (C) 2000-2001 by Martin Pool <mbp@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -39,26 +39,27 @@ struct {
int code;
char const *name;
} const rerr_names[] = {
{ RERR_SYNTAX , "syntax or usage error" },
{ RERR_PROTOCOL , "protocol incompatibility" },
{ RERR_FILESELECT , "errors selecting input/output files, dirs" },
{ RERR_UNSUPPORTED, "requested action not supported" },
{ RERR_STARTCLIENT, "error starting client-server protocol" },
{ RERR_SOCKETIO , "error in socket IO" },
{ RERR_FILEIO , "error in file IO" },
{ RERR_STREAMIO , "error in rsync protocol data stream" },
{ RERR_MESSAGEIO , "errors with program diagnostics" },
{ RERR_IPC , "error in IPC code" },
{ RERR_SIGNAL , "received SIGUSR1 or SIGINT" },
{ RERR_WAITCHILD , "some error returned by waitpid()" },
{ RERR_MALLOC , "error allocating core memory buffers" },
{ RERR_PARTIAL , "some files could not be transferred" },
{ RERR_TIMEOUT , "timeout in data send/receive" },
{ RERR_SYNTAX , "syntax or usage error" },
{ RERR_PROTOCOL , "protocol incompatibility" },
{ RERR_FILESELECT , "errors selecting input/output files, dirs" },
{ RERR_UNSUPPORTED, "requested action not supported" },
{ RERR_STARTCLIENT, "error starting client-server protocol" },
{ RERR_SOCKETIO , "error in socket IO" },
{ RERR_FILEIO , "error in file IO" },
{ RERR_STREAMIO , "error in rsync protocol data stream" },
{ RERR_MESSAGEIO , "errors with program diagnostics" },
{ RERR_IPC , "error in IPC code" },
{ RERR_SIGNAL , "received SIGUSR1 or SIGINT" },
{ RERR_WAITCHILD , "some error returned by waitpid()" },
{ RERR_MALLOC , "error allocating core memory buffers" },
{ RERR_PARTIAL , "some files could not be transferred" },
{ RERR_VANISHED , "some files vanished before they could be transfered" },
{ RERR_TIMEOUT , "timeout in data send/receive" },
{ RERR_CMD_FAILED , "remote shell failed" },
{ RERR_CMD_KILLED , "remote shell killed" },
{ RERR_CMD_RUN, "remote command could not be run" },
{ RERR_CMD_NOTFOUND, "remote command not found" },
{ 0, NULL }
{ RERR_CMD_NOTFOUND, "remote command not found" },
{ 0, NULL }
};
@@ -68,12 +69,12 @@ struct {
*/
static char const *rerr_name(int code)
{
int i;
for (i = 0; rerr_names[i].name; i++) {
if (rerr_names[i].code == code)
return rerr_names[i].name;
}
return NULL;
int i;
for (i = 0; rerr_names[i].name; i++) {
if (rerr_names[i].code == code)
return rerr_names[i].name;
}
return NULL;
}
struct err_list {
@@ -90,10 +91,10 @@ static struct err_list *err_list_tail;
static void err_list_add(int code, char *buf, int len)
{
struct err_list *el;
el = (struct err_list *)malloc(sizeof(*el));
el = new(struct err_list);
if (!el) exit_cleanup(RERR_MALLOC);
el->next = NULL;
el->buf = malloc(len+4);
el->buf = new_array(char, len+4);
if (!el->buf) exit_cleanup(RERR_MALLOC);
memcpy(el->buf+4, buf, len);
SIVAL(el->buf, 0, ((code+MPLEX_BASE)<<24) | len);
@@ -117,7 +118,7 @@ void err_list_push(void)
struct err_list *el = err_list_head;
int n = write(log_error_fd, el->buf+el->written, el->len - el->written);
/* don't check for an error if the best way of handling the error is
to ignore it */
* to ignore it */
if (n == -1) break;
if (n > 0) {
el->written += n;
@@ -137,7 +138,7 @@ static void logit(int priority, char *buf)
if (logfname) {
if (!logfile)
log_open();
fprintf(logfile,"%s [%d] %s",
fprintf(logfile,"%s [%d] %s",
timestring(time(NULL)), (int)getpid(), buf);
fflush(logfile);
} else {
@@ -154,8 +155,8 @@ void log_init(void)
log_initialised = 1;
/* this looks pointless, but it is needed in order for the
C library on some systems to fetch the timezone info
before the chroot */
* C library on some systems to fetch the timezone info
* before the chroot */
t = time(NULL);
localtime(&t);
@@ -203,7 +204,7 @@ void log_close(void)
}
/* setup the error file descriptor - used when we are a server
that is receiving files */
* that is receiving files */
void set_error_fd(int fd)
{
log_error_fd = fd;
@@ -211,7 +212,7 @@ void set_error_fd(int fd)
}
/* this is the underlying (unformatted) rsync debugging function. Call
it with FINFO, FERROR or FLOG */
* it with FINFO, FERROR or FLOG */
void rwrite(enum logcode code, char *buf, int len)
{
FILE *f=NULL;
@@ -238,7 +239,7 @@ void rwrite(enum logcode code, char *buf, int len)
return;
}
/* next, if we are a server and multiplexing is enabled,
/* next, if we are a server and multiplexing is enabled,
* pass it to the other side. */
if (am_server && io_multiplex_write(code, buf, len)) {
return;
@@ -272,14 +273,14 @@ void rwrite(enum logcode code, char *buf, int len)
if (code == FERROR) {
log_got_error = 1;
f = stderr;
}
}
if (code == FINFO) {
if (am_server)
if (am_server)
f = stderr;
else
f = stdout;
}
}
if (!f) exit_cleanup(RERR_MESSAGEIO);
@@ -293,7 +294,7 @@ void rwrite(enum logcode code, char *buf, int len)
* FLOG. */
void rprintf(enum logcode code, const char *format, ...)
{
va_list ap;
va_list ap;
char buf[1024];
int len;
@@ -342,11 +343,11 @@ void rprintf(enum logcode code, const char *format, ...)
* message catalog we need to call it once before chroot-ing. */
void rsyserr(enum logcode code, int errcode, const char *format, ...)
{
va_list ap;
va_list ap;
char buf[1024];
int len;
size_t sys_len;
char *sysmsg;
char *sysmsg;
va_start(ap, format);
/* Note: might return <0 */
@@ -358,17 +359,17 @@ void rsyserr(enum logcode code, int errcode, const char *format, ...)
if ((size_t) len > sizeof(buf)-1)
exit_cleanup(RERR_MESSAGEIO);
sysmsg = strerror(errcode);
sys_len = strlen(sysmsg);
if ((size_t) len + 3 + sys_len > sizeof(buf) - 1)
exit_cleanup(RERR_MESSAGEIO);
sysmsg = strerror(errcode);
sys_len = strlen(sysmsg);
if ((size_t) len + 3 + sys_len > sizeof(buf) - 1)
exit_cleanup(RERR_MESSAGEIO);
strcpy(buf + len, ": ");
len += 2;
strcpy(buf + len, sysmsg);
len += sys_len;
strcpy(buf + len, "\n");
len++;
strcpy(buf + len, ": ");
len += 2;
strcpy(buf + len, sysmsg);
len += sys_len;
strcpy(buf + len, "\n");
len++;
rwrite(code, buf, len);
}
@@ -386,19 +387,19 @@ void rflush(enum logcode code)
if (code == FLOG) {
return;
}
}
if (code == FERROR) {
f = stderr;
}
}
if (code == FINFO) {
extern int am_server;
if (am_server)
if (am_server)
f = stderr;
else
f = stdout;
}
}
if (!f) exit_cleanup(RERR_MESSAGEIO);
fflush(f);
@@ -407,7 +408,7 @@ void rflush(enum logcode code)
/* a generic logging routine for send/recv, with parameter
substitiution */
* substitiution */
static void log_formatted(enum logcode code,
char *format, char *op, struct file_struct *file,
struct stats *initial_stats)
@@ -431,57 +432,56 @@ static void log_formatted(enum logcode code,
memset(buf, 0, sizeof buf);
strlcpy(buf, format, sizeof(buf));
for (s=&buf[0];
s && (p=strchr(s,'%')); ) {
for (s = &buf[0]; s && (p = strchr(s,'%')); ) {
n = NULL;
s = p + 1;
switch (p[1]) {
case 'h': if (am_daemon) n = client_name(0); break;
case 'a': if (am_daemon) n = client_addr(0); break;
case 'l':
snprintf(buf2,sizeof(buf2),"%.0f",
(double)file->length);
case 'l':
snprintf(buf2,sizeof(buf2),"%.0f",
(double)file->length);
n = buf2;
break;
case 'p':
snprintf(buf2,sizeof(buf2),"%d",
(int)getpid());
case 'p':
snprintf(buf2,sizeof(buf2),"%d",
(int)getpid());
n = buf2;
break;
case 'o': n = op; break;
case 'f':
snprintf(buf2, sizeof(buf2), "%s/%s",
file->basedir?file->basedir:"",
case 'f':
snprintf(buf2, sizeof(buf2), "%s/%s",
file->basedir?file->basedir:"",
f_name(file));
clean_fname(buf2);
n = buf2;
n = buf2;
if (*n == '/') n++;
break;
case 'm': n = lp_name(module_id); break;
case 't': n = timestring(time(NULL)); break;
case 'P': n = lp_path(module_id); break;
case 'u': n = auth_user; break;
case 'b':
case 'b':
if (am_sender) {
b = stats.total_written -
b = stats.total_written -
initial_stats->total_written;
} else {
b = stats.total_read -
b = stats.total_read -
initial_stats->total_read;
}
snprintf(buf2,sizeof(buf2),"%.0f", (double)b);
snprintf(buf2,sizeof(buf2),"%.0f", (double)b);
n = buf2;
break;
case 'c':
case 'c':
if (!am_sender) {
b = stats.total_written -
b = stats.total_written -
initial_stats->total_written;
} else {
b = stats.total_read -
b = stats.total_read -
initial_stats->total_read;
}
snprintf(buf2,sizeof(buf2),"%.0f", (double)b);
snprintf(buf2,sizeof(buf2),"%.0f", (double)b);
n = buf2;
break;
}
@@ -562,13 +562,19 @@ void log_exit(int code, const char *file, int line)
(double)stats.total_read,
(double)stats.total_size);
} else {
const char *name;
const char *name;
name = rerr_name(code);
if (!name)
name = "unexplained error";
rprintf(FERROR,"rsync error: %s (code %d) at %s(%d)\n",
name, code, file, line);
name = rerr_name(code);
if (!name)
name = "unexplained error";
/* VANISHED is not an error, only a warning */
if (code == RERR_VANISHED) {
rprintf(FINFO, "rsync warning: %s (code %d) at %s(%d)\n",
name, code, file, line);
} else {
rprintf(FERROR, "rsync error: %s (code %d) at %s(%d)\n",
name, code, file, line);
}
}
}

49
main.c
View File

@@ -171,7 +171,7 @@ static void show_malloc_stats(void)
mi = mallinfo();
rprintf(FINFO, RSYNC_NAME "[%d] (%s%s%s) heap statistics:\n",
rprintf(FINFO, "\n" RSYNC_NAME "[%d] (%s%s%s) heap statistics:\n",
getpid(),
am_server ? "server " : "",
am_daemon ? "daemon " : "",
@@ -205,8 +205,9 @@ static pid_t do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int
extern int read_batch;
if (!read_batch && !local_server) {
char *rsh_env = getenv(RSYNC_RSH_ENV);
if (!cmd)
cmd = getenv(RSYNC_RSH_ENV);
cmd = rsh_env;
if (!cmd)
cmd = RSYNC_RSH;
cmd = strdup(cmd);
@@ -218,7 +219,7 @@ static pid_t do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int
}
/* check to see if we've already been given '-l user' in
the remote-shell command */
* the remote-shell command */
for (i = 0; i < argc-1; i++) {
if (!strcmp(args[i], "-l") && args[i+1][0] != '-')
dash_l_set = 1;
@@ -241,11 +242,17 @@ static pid_t do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int
args[argc++] = rsync_path;
if ((blocking_io == -1) && (strcmp(cmd, RSYNC_RSH) == 0))
blocking_io = 1;
if (blocking_io < 0) {
char *cp;
if ((cp = strrchr(cmd, '/')) != NULL)
cp++;
else
cp = cmd;
if (strcmp(cp, "rsh") == 0 || strcmp(cp, "remsh") == 0)
blocking_io = 1;
}
server_options(args,&argc);
}
args[argc++] = ".";
@@ -437,8 +444,8 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
close(recv_pipe[1]);
io_flush();
/* finally we go to sleep until our parent kills us
with a USR2 signal. We sleep for a short time as on
some OSes a signal won't interrupt a sleep! */
* with a USR2 signal. We sleep for a short time as on
* some OSes a signal won't interrupt a sleep! */
while (msleep(20))
;
}
@@ -856,7 +863,7 @@ static int start_client(int argc, char *argv[])
&f_in,&f_out);
/* if we're running an rsync server on the remote host over a
remote shell command, we need to do the RSYNCD protocol first */
* remote shell command, we need to do the RSYNCD protocol first */
if (daemon_over_rsh) {
int tmpret;
tmpret = start_inband_exchange(shell_user, shell_path,
@@ -898,14 +905,14 @@ static RETSIGTYPE sigchld_handler(UNUSED(int val))
* zombie children, maybe that's why he did it.
*/
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
/* save the child's exit status */
for (cnt = 0; cnt < MAXCHILDPROCS; cnt++) {
if (pid_stat_table[cnt].pid == 0) {
pid_stat_table[cnt].pid = pid;
pid_stat_table[cnt].status = status;
break;
}
}
/* save the child's exit status */
for (cnt = 0; cnt < MAXCHILDPROCS; cnt++) {
if (pid_stat_table[cnt].pid == 0) {
pid_stat_table[cnt].pid = pid;
pid_stat_table[cnt].status = status;
break;
}
}
}
#endif
}
@@ -996,7 +1003,7 @@ int main(int argc,char *argv[])
}
/* we set a 0 umask so that correct file permissions can be
carried across */
* carried across */
orig_umask = (int)umask(0);
if (!parse_arguments(&argc, (const char ***) &argv, 1)) {
@@ -1015,9 +1022,9 @@ int main(int argc,char *argv[])
signal(SIGPIPE, SIG_IGN);
/* Initialize push_dir here because on some old systems getcwd
(implemented by forking "pwd" and reading its output) doesn't
work when there are other child processes. Also, on all systems
that implement getcwd that way "pwd" can't be found after chroot. */
* (implemented by forking "pwd" and reading its output) doesn't
* work when there are other child processes. Also, on all systems
* that implement getcwd that way "pwd" can't be found after chroot. */
push_dir(NULL,0);
if (write_batch && !am_server) {

View File

@@ -62,9 +62,9 @@ static void build_hash_table(struct sum_struct *s)
int i;
if (!tag_table)
tag_table = (int *)malloc(sizeof(tag_table[0])*TABLESIZE);
tag_table = new_array(int, TABLESIZE);
targets = (struct target *)malloc(sizeof(targets[0])*s->count);
targets = new_array(struct target, s->count);
if (!tag_table || !targets)
out_of_memory("build_hash_table");

View File

@@ -62,7 +62,6 @@ int implied_dirs = 1;
int numeric_ids = 0;
int force_delete = 0;
int io_timeout = 0;
int io_error = 0;
int read_only = 0;
int module_id = -1;
int am_server = 0;
@@ -162,7 +161,7 @@ static void print_rsync_version(enum logcode f)
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
rprintf(f,
"Copyright (C) 1996-2002 by Andrew Tridgell and others\n");
"Copyright (C) 1996-2004 by Andrew Tridgell and others\n");
rprintf(f, "<http://rsync.samba.org/>\n");
rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, "
"%shard links, %ssymlinks, batchfiles, \n",
@@ -219,9 +218,9 @@ void usage(enum logcode F)
rprintf(F," -R, --relative use relative path names\n");
rprintf(F," --no-relative turn off --relative\n");
rprintf(F," --no-implied-dirs don't send implied dirs with -R\n");
rprintf(F," -b, --backup make backups (default %s suffix)\n",BACKUP_SUFFIX);
rprintf(F," -b, --backup make backups (see --suffix & --backup-dir)\n");
rprintf(F," --backup-dir make backups into this directory\n");
rprintf(F," --suffix=SUFFIX override backup suffix\n");
rprintf(F," --suffix=SUFFIX backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update update only (don't overwrite newer files)\n");
rprintf(F," -l, --links copy symlinks as symlinks\n");
rprintf(F," -L, --copy-links copy the referent of symlinks\n");
@@ -242,7 +241,7 @@ void usage(enum logcode F)
rprintf(F," -e, --rsh=COMMAND specify the remote shell\n");
rprintf(F," --rsync-path=PATH specify path to rsync on the remote machine\n");
rprintf(F," --existing only update files that already exist\n");
rprintf(F," --ignore-existing ignore files that already exist on the receiving side\n");
rprintf(F," --ignore-existing ignore files that already exist on receiving side\n");
rprintf(F," --delete delete files that don't exist on the sending side\n");
rprintf(F," --delete-excluded also delete excluded files on the receiving side\n");
rprintf(F," --delete-after delete after transferring, not before\n");
@@ -252,9 +251,9 @@ void usage(enum logcode F)
rprintf(F," --force force deletion of directories even if not empty\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --timeout=TIME set IO timeout in seconds\n");
rprintf(F," -I, --ignore-times don't exclude files that match length and time\n");
rprintf(F," --size-only only use file size when determining if a file should be transferred\n");
rprintf(F," --modify-window=NUM Timestamp window (seconds) for file match (default=%d)\n",modify_window);
rprintf(F," -I, --ignore-times turn off mod time & file size quick check\n");
rprintf(F," --size-only ignore mod time for quick check (use size)\n");
rprintf(F," --modify-window=NUM compare mod times with reduced accuracy\n");
rprintf(F," -T --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --link-dest=DIR create hardlinks to DIR for unchanged files\n");
@@ -266,7 +265,7 @@ void usage(enum logcode F)
rprintf(F," --include=PATTERN don't exclude files matching PATTERN\n");
rprintf(F," --include-from=FILE don't exclude patterns listed in FILE\n");
rprintf(F," --files-from=FILE read FILE for list of source-file names\n");
rprintf(F," -0 --from0 file names we read are separated by nulls, not newlines\n");
rprintf(F," -0 --from0 all *-from file lists are delimited by nulls\n");
rprintf(F," --version print version number\n");
rprintf(F," --daemon run as a rsync daemon\n");
rprintf(F," --no-detach do not detach from the parent\n");
@@ -657,8 +656,11 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
usage(FERROR);
exit_cleanup(RERR_SYNTAX);
}
if (strcmp(files_from, "-") == 0)
if (strcmp(files_from, "-") == 0) {
filesfrom_fd = 0;
if (am_server)
remote_filesfrom_file = "-";
}
else if ((colon = find_colon(files_from)) != 0) {
if (am_server) {
usage(FERROR);
@@ -825,7 +827,7 @@ void server_options(char **args,int *argc)
/* Only send --suffix if it specifies a non-default value. */
if (strcmp(backup_suffix, backup_dir? "" : BACKUP_SUFFIX) != 0) {
char *s = malloc(9+backup_suffix_len+1);
char *s = new_array(char, 9+backup_suffix_len+1);
if (!s)
out_of_memory("server_options");
/* We use the following syntax to avoid weirdness with '~'. */

View File

@@ -1,10 +1,10 @@
Summary: Program for efficient remote updates of files.
Name: rsync
Version: 2.5.6
Version: 2.6.0
Release: 1
Copyright: GPL
Group: Applications/Networking
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.5.6.tar.gz
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-%{version}.tar.gz
URL: http://samba.anu.edu.au/rsync/
Packager: Andrew Tridgell <tridge@samba.anu.edu.au>
BuildRoot: /tmp/rsync

View File

@@ -1,93 +0,0 @@
Summary: Program for efficient remote updates of files.
Name: rsync
Version: PVERSION
Release: PRELEASE
Copyright: GPL
Group: Applications/Networking
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-PVERSION.tar.gz
URL: http://samba.anu.edu.au/rsync/
Packager: Andrew Tridgell <tridge@samba.anu.edu.au>
BuildRoot: /tmp/rsync
%description
rsync is a replacement for rcp that has many more features.
rsync uses the "rsync algorithm" which provides a very fast method for
bringing remote files into sync. It does this by sending just the
differences in the files across the link, without requiring that both
sets of files are present at one of the ends of the link beforehand.
A technical report describing the rsync algorithm is included with
this package.
%changelog
* Thu Jan 30 2003 Horst von Brand <vonbrand@inf.utfsm.cl>
Fixed "Sept" date in %changelog here
Use %{_mandir} to point to manpages
Support for compressed manpages (* at end catches them in %files)
Add doc/README-SGML and doc/rsync.sgml to %doc
* Mon Sep 11 2000 John H Terpstra <jht@turbolinux.com>
Changed target paths to be Linux Standards Base compliant
* Mon Jan 25 1999 Stefan Hornburg <racke@linuxia.de>
quoted RPM_OPT_FLAGS for the sake of robustness
* Mon May 18 1998 Andrew Tridgell <tridge@samba.anu.edu.au>
reworked for auto-building when I release rsync (tridge@samba.anu.edu.au)
* Sat May 16 1998 John H Terpstra <jht@aquasoft.com.au>
Upgraded to Rsync 2.0.6
-new feature anonymous rsync
* Mon Apr 6 1998 Douglas N. Arnold <dna@math.psu.edu>
Upgrade to rsync version 1.7.2.
* Sun Mar 1 1998 Douglas N. Arnold <dna@math.psu.edu>
Built 1.6.9-1 based on the 1.6.3-2 spec file of John A. Martin.
Changes from 1.6.3-2 packaging: added latex and dvips commands
to create tech_report.ps.
* Mon Aug 25 1997 John A. Martin <jam@jamux.com>
Built 1.6.3-2 after finding no rsync-1.6.3-1.src.rpm although there
was an ftp://ftp.redhat.com/pub/contrib/alpha/rsync-1.6.3-1.alpha.rpm
showing no packager nor signature but giving
"Source RPM: rsync-1.6.3-1.src.rpm".
Changes from 1.6.2-1 packaging: added '$RPM_OPT_FLAGS' to make, strip
to '%build', removed '%prefix'.
* Thu Apr 10 1997 Michael De La Rue <miked@ed.ac.uk>
rsync-1.6.2-1 packaged. (This entry by jam to credit Michael for the
previous package(s).)
%prep
%setup
%build
./configure --prefix=/usr --mandir=%{_mandir}
make CFLAGS="$RPM_OPT_FLAGS"
strip rsync
%install
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man{1,5}
install -m755 rsync $RPM_BUILD_ROOT/usr/bin
install -m644 rsync.1 $RPM_BUILD_ROOT/%{_mandir}/man1
install -m644 rsyncd.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr(-,root,root) /usr/bin/rsync
%attr(-,root,root) %{_mandir}/man1/rsync.1*
%attr(-,root,root) %{_mandir}/man5/rsyncd.conf.5*
%attr(-,root,root) %doc tech_report.tex
%attr(-,root,root) %doc README
%attr(-,root,root) %doc COPYING
%attr(-,root,root) %doc doc/README-SGML doc/rsync.sgml

View File

@@ -207,7 +207,7 @@ static BOOL Section( FILE *InFile, BOOL (*sfunc)(char *) )
if( i > (bSize - 2) )
{
bSize += BUFR_INC;
bufr = Realloc( bufr, bSize );
bufr = realloc_array( bufr, char, bSize );
if( NULL == bufr )
{
rprintf(FERROR, "%s Memory re-allocation failure.", func);
@@ -301,7 +301,7 @@ static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(char *, char *), int c )
if( i > (bSize - 2) ) /* Ensure there's space for next char. */
{
bSize += BUFR_INC;
bufr = Realloc( bufr, bSize );
bufr = realloc_array( bufr, char, bSize );
if( NULL == bufr )
{
rprintf(FERROR, "%s Memory re-allocation failure.", func) ;
@@ -366,7 +366,7 @@ static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(char *, char *), int c )
if( i > (bSize - 2) ) /* Make sure there's enough room. */
{
bSize += BUFR_INC;
bufr = Realloc( bufr, bSize );
bufr = realloc_array( bufr, char, bSize );
if( NULL == bufr )
{
rprintf(FERROR, "%s Memory re-allocation failure.", func) ;
@@ -530,7 +530,7 @@ BOOL pm_process( char *FileName,
else /* If we don't have a buffer */
{ /* allocate one, then parse, */
bSize = BUFR_INC; /* then free. */
bufr = (char *)malloc( bSize );
bufr = new_array( char, bSize );
if( NULL == bufr )
{
rprintf(FERROR,"%s memory allocation failure.\n", func);

3
pipe.c
View File

@@ -73,9 +73,8 @@ pid_t piped_child(char **command, int *f_in, int *f_out)
close(from_child_pipe[1]);
umask(orig_umask);
set_blocking(STDIN_FILENO);
if (blocking_io) {
if (blocking_io > 0)
set_blocking(STDOUT_FILENO);
}
execvp(command[0], command);
rprintf(FERROR, "Failed to exec %s : %s\n",
command[0], strerror(errno));

View File

@@ -1,19 +1,19 @@
/* -*- c-file-style: "linux" -*-
*
* Copyright (C) 1996-2000 by Andrew Tridgell
*
* Copyright (C) 1996-2000 by Andrew Tridgell
* Copyright (C) Paul Mackerras 1996
* Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -28,8 +28,8 @@ static OFF_T start_ofs;
static unsigned long msdiff(struct timeval *t1, struct timeval *t2)
{
return (t2->tv_sec - t1->tv_sec) * 1000
+ (t2->tv_usec - t1->tv_usec) / 1000;
return (t2->tv_sec - t1->tv_sec) * 1000
+ (t2->tv_usec - t1->tv_usec) / 1000;
}
@@ -43,38 +43,37 @@ static unsigned long msdiff(struct timeval *t1, struct timeval *t2)
static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now,
int is_last)
{
int pct = (ofs == size) ? 100 : (int)((100.0*ofs)/size);
unsigned long diff = msdiff(&start_time, now);
double rate = diff ? (double) (ofs-start_ofs) * 1000.0 / diff / 1024.0 : 0;
const char *units;
/* If we've finished transferring this file, show the time taken;
* otherwise show expected time to complete. That's kind of
* inconsistent, but people can probably cope. Hopefully we'll
* get more consistent and complete progress reporting soon. --
* mbp */
double remain = is_last
? (double) diff / 1000.0
: rate ? (double) (size-ofs) / rate / 1000.0 : 0.0;
int remain_h, remain_m, remain_s;
int pct = (ofs == size) ? 100 : (int)((100.0*ofs)/size);
unsigned long diff = msdiff(&start_time, now);
double rate = diff ? (double) (ofs-start_ofs) * 1000.0 / diff / 1024.0 : 0;
const char *units;
/* If we've finished transferring this file, show the time taken;
* otherwise show expected time to complete. That's kind of
* inconsistent, but people can probably cope. Hopefully we'll
* get more consistent and complete progress reporting soon. --
* mbp */
double remain = is_last ? (double) diff / 1000.0
: rate ? (double) (size-ofs) / rate / 1000.0 : 0.0;
int remain_h, remain_m, remain_s;
if (rate > 1024*1024) {
rate /= 1024.0 * 1024.0;
units = "GB/s";
} else if (rate > 1024) {
rate /= 1024.0;
units = "MB/s";
} else {
units = "kB/s";
}
if (rate > 1024*1024) {
rate /= 1024.0 * 1024.0;
units = "GB/s";
} else if (rate > 1024) {
rate /= 1024.0;
units = "MB/s";
} else {
units = "kB/s";
}
remain_s = (int) remain % 60;
remain_m = (int) (remain / 60.0) % 60;
remain_h = (int) (remain / 3600.0);
rprintf(FINFO, "%12.0f %3d%% %7.2f%s %4d:%02d:%02d%s",
(double) ofs, pct, rate, units,
remain_h, remain_m, remain_s,
is_last ? "\n" : "\r");
remain_s = (int) remain % 60;
remain_m = (int) (remain / 60.0) % 60;
remain_h = (int) (remain / 3600.0);
rprintf(FINFO, "%12.0f %3d%% %7.2f%s %4d:%02d:%02d%s",
(double) ofs, pct, rate, units,
remain_h, remain_m, remain_s,
is_last ? "\n" : "\r");
}
void end_progress(OFF_T size)
@@ -86,10 +85,10 @@ void end_progress(OFF_T size)
gettimeofday(&now, NULL);
rprint_progress(size, size, &now, True);
}
last_ofs = 0;
start_ofs = 0;
print_time.tv_sec = print_time.tv_usec = 0;
start_time.tv_sec = start_time.tv_usec = 0;
last_ofs = 0;
start_ofs = 0;
print_time.tv_sec = print_time.tv_usec = 0;
start_time.tv_sec = start_time.tv_usec = 0;
}
void show_progress(OFF_T ofs, OFF_T size)
@@ -99,9 +98,9 @@ void show_progress(OFF_T ofs, OFF_T size)
if (!start_time.tv_sec) {
gettimeofday(&now, NULL);
start_time.tv_sec = now.tv_sec;
start_time.tv_sec = now.tv_sec;
start_time.tv_usec = now.tv_usec;
start_ofs = ofs;
start_ofs = ofs;
if (am_server)
return;
}
@@ -111,11 +110,10 @@ void show_progress(OFF_T ofs, OFF_T size)
gettimeofday(&now, NULL);
}
if (ofs > last_ofs + 1000
&& msdiff(&print_time, &now) > 250) {
if (ofs > last_ofs + 1000 && msdiff(&print_time, &now) > 250) {
rprint_progress(ofs, size, &now, False);
last_ofs = ofs;
print_time.tv_sec = now.tv_sec;
print_time.tv_sec = now.tv_sec;
print_time.tv_usec = now.tv_usec;
}
}

View File

@@ -1,18 +1,18 @@
/* -*- c-file-style: "linux" -*-
Copyright (C) 1996-2000 by Andrew Tridgell
Copyright (C) Paul Mackerras 1996
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -47,9 +47,9 @@ static struct delete_list {
static int dlist_len, dlist_alloc_len;
/* yuck! This function wouldn't have been necessary if I had the sorting
algorithm right. Unfortunately fixing the sorting algorithm would introduce
a backward incompatibility as file list indexes are sent over the link.
*/
* algorithm right. Unfortunately fixing the sorting algorithm would introduce
* a backward incompatibility as file list indexes are sent over the link.
*/
static int delete_already_done(struct file_list *flist,int j)
{
int i;
@@ -57,7 +57,7 @@ static int delete_already_done(struct file_list *flist,int j)
if (link_stat(f_name(flist->files[j]), &st)) return 1;
for (i=0;i<dlist_len;i++) {
for (i = 0; i < dlist_len; i++) {
if (st.st_ino == delete_list[i].inode &&
(DEV64_T)st.st_dev == delete_list[i].dev)
return 1;
@@ -70,7 +70,8 @@ static void add_delete_entry(struct file_struct *file)
{
if (dlist_len == dlist_alloc_len) {
dlist_alloc_len += 1024;
delete_list = (struct delete_list *)Realloc(delete_list, sizeof(delete_list[0])*dlist_alloc_len);
delete_list = realloc_array(delete_list, struct delete_list,
dlist_alloc_len);
if (!delete_list) out_of_memory("add_delete_entry");
}
@@ -91,11 +92,11 @@ static void delete_one(char *fn, int is_dir)
} else if (verbose) {
rprintf(FINFO, "deleting %s\n", fn);
}
} else {
} else {
if (do_rmdir(fn) != 0) {
if (errno != ENOTEMPTY && errno != EEXIST) {
rprintf(FERROR, "delete_one: rmdir %s failed: %s\n",
full_fname(fn), strerror(errno));
full_fname(fn), strerror(errno));
}
} else if (verbose) {
rprintf(FINFO, "deleting directory %s\n", fn);
@@ -112,8 +113,8 @@ static int is_backup_file(char *fn)
/* this deletes any files on the receiving side that are not present
on the sending side. For version 1.6.4 I have changed the behaviour
to match more closely what most people seem to expect of this option */
* on the sending side. For version 1.6.4 I have changed the behaviour
* to match more closely what most people seem to expect of this option */
void delete_files(struct file_list *flist)
{
struct file_list *local_file_list;
@@ -133,7 +134,7 @@ void delete_files(struct file_list *flist)
}
for (j=0;j<flist->count;j++) {
if (!S_ISDIR(flist->files[j]->mode) ||
if (!S_ISDIR(flist->files[j]->mode) ||
!(flist->files[j]->flags & FLAG_DELETE)) continue;
if (protocol_version < 19 &&
@@ -181,7 +182,7 @@ void delete_files(struct file_list *flist)
* put it in. Otherwise, the tmp filename is in the same
* directory as the given name. Note that there may be no
* directory at all in the given name!
*
*
* The tmp filename is basically the given filename with a
* dot prepended, and .XXXXXX appended (for mkstemp() to
* put its unique gunk in). Take care to not exceed
@@ -189,7 +190,7 @@ void delete_files(struct file_list *flist)
* the basename basically becomes 8 chars longer. In that
* case, the original name is shortened sufficiently to
* make it all fit.
*
*
* Of course, there's no real reason for the tmp name to
* look like the original, except to satisfy us humans.
* As long as it's unique, rsync will work.
@@ -217,7 +218,7 @@ static int get_tmpname(char *fnametmp, char *fname)
}
} else {
f = fname;
}
}
fnametmp[length++] = '.';
fnametmp[length] = '\0'; /* always NULL terminated */
@@ -229,7 +230,7 @@ static int get_tmpname(char *fnametmp, char *fname)
return 0;
}
strlcpy(fnametmp + length, f, maxname);
strlcpy(fnametmp + length, f, maxname);
strcat(fnametmp + length, ".XXXXXX");
return 1;
@@ -248,11 +249,11 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
static char file_sum1[MD4_SUM_LENGTH];
static char file_sum2[MD4_SUM_LENGTH];
char *map=NULL;
read_sum_head(f_in, &sum);
sum_init();
for (i=recv_token(f_in,&data); i != 0; i=recv_token(f_in,&data)) {
if (do_progress)
show_progress(offset, total_size);
@@ -267,7 +268,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
stats.literal_data += i;
cleanup_got_literal = 1;
sum_update(data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
@@ -277,27 +278,27 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
}
offset += i;
continue;
}
}
i = -(i+1);
offset2 = i*(OFF_T)sum.blength;
len = sum.blength;
if (i == (int) sum.count-1 && sum.remainder != 0)
len = sum.remainder;
stats.matched_data += len;
if (verbose > 3)
rprintf(FINFO,"chunk[%d] of size %d at %.0f offset=%.0f\n",
i,len,(double)offset2,(double)offset);
if (buf) {
map = map_ptr(buf,offset2,len);
see_token(map, len);
sum_update(map,len);
}
if (fd != -1 && write_file(fd,map,len) != (int) len) {
rprintf(FERROR, "write failed on %s: %s\n",
full_fname(fname), strerror(errno));
@@ -321,8 +322,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
if (verbose > 2) {
rprintf(FINFO,"got file_sum\n");
}
if (fd != -1
&& memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0) {
if (fd != -1 && memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0) {
return 0;
}
return 1;
@@ -334,7 +334,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
*
* Receiver process runs on the same host as the generator process. */
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
{
{
int fd1,fd2;
STRUCT_STAT st;
char *fname;
@@ -347,7 +347,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
struct file_struct *file;
int phase=0;
int recv_ok;
extern struct stats stats;
extern struct stats stats;
extern int preserve_perms;
extern int delete_after;
extern int orig_umask;
@@ -357,7 +357,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
}
while (1) {
while (1) {
cleanup_disable();
i = read_int(f_in);
@@ -374,7 +374,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
}
if (i < 0 || i >= flist->count) {
rprintf(FERROR,"Invalid file index %d in recv_files (count=%d)\n",
rprintf(FERROR,"Invalid file index %d in recv_files (count=%d)\n",
i, flist->count);
exit_cleanup(RERR_PROTOCOL);
}
@@ -402,7 +402,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
fnamecmp = fname;
/* open the file */
/* open the file */
fd1 = do_open(fnamecmp, O_RDONLY, 0);
if ((fd1 == -1) && (compare_dest != NULL)) {
@@ -442,8 +442,8 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (fd1 != -1 && !preserve_perms) {
/* if the file exists already and we aren't preserving
permissions then act as though the remote end sent
us the file permissions we already have */
* permissions then act as though the remote end sent
* us the file permissions we already have */
file->mode = st.st_mode;
}
@@ -464,17 +464,17 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
strlcpy(template, fnametmp, sizeof(template));
/* we initially set the perms without the
setuid/setgid bits to ensure that there is no race
condition. They are then correctly updated after
the lchown. Thanks to snabb@epipe.fi for pointing
this out. We also set it initially without group
access because of a similar race condition. */
* setuid/setgid bits to ensure that there is no race
* condition. They are then correctly updated after
* the lchown. Thanks to snabb@epipe.fi for pointing
* this out. We also set it initially without group
* access because of a similar race condition. */
fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
/* in most cases parent directories will already exist
because their information should have been previously
transferred, but that may not be the case with -R */
if (fd2 == -1 && relative_paths && errno == ENOENT &&
* because their information should have been previously
* transferred, but that may not be the case with -R */
if (fd2 == -1 && relative_paths && errno == ENOENT &&
create_directory_path(fnametmp, orig_umask) == 0) {
strlcpy(fnametmp, template, sizeof(fnametmp));
fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
@@ -487,7 +487,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (fd1 != -1) close(fd1);
continue;
}
cleanup_set(fnametmp, fname, file, buf, fd1, fd2);
if (!am_server && verbose) { /* log transfer */
@@ -498,13 +498,13 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
recv_ok = receive_data(f_in,buf,fd2,fname,file->length);
log_recv(file, &initial_stats);
if (buf) unmap_file(buf);
if (fd1 != -1) {
close(fd1);
}
close(fd2);
if (verbose > 2)
rprintf(FINFO,"renaming %s to %s\n",fnametmp,fname);
@@ -533,8 +533,8 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (preserve_hard_links)
do_hard_links();
/* now we need to fix any directory permissions that were
modified during the transfer */
/* now we need to fix any directory permissions that were
* modified during the transfer */
for (i = 0; i < flist->count; i++) {
file = flist->files[i];
if (!file->basename || !S_ISDIR(file->mode)) continue;
@@ -543,7 +543,7 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
if (verbose > 2)
rprintf(FINFO,"recv_files finished\n");
return 0;
}

11
rsync.c
View File

@@ -133,7 +133,7 @@ static int is_in_group(gid_t gid)
/* treat failure (-1) as if not member of any group */
ngroups = getgroups(0, 0);
if (ngroups > 0) {
gidset = (GETGROUPS_T *) malloc(ngroups * sizeof(GETGROUPS_T));
gidset = new_array(GETGROUPS_T, ngroups);
ngroups = getgroups(ngroups, gidset);
}
}
@@ -237,6 +237,15 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
void sig_int(void)
{
/* KLUGE: if the user hits Ctrl-C while ssh is prompting
* for a password, then our cleanup's sending of a SIGUSR1
* signal to all our children may kill ssh before it has a
* chance to restore the tty settings (i.e. turn echo back
* on). By sleeping for a short time, ssh gets a bigger
* chance to do the right thing. If child processes are
* not ssh waiting for a password, then this tiny delay
* shouldn't hurt anything. */
msleep(400);
exit_cleanup(RERR_SIGNAL);
}

20
rsync.h
View File

@@ -24,6 +24,7 @@
#define BLOCK_SIZE 700
#define RSYNC_RSH_ENV "RSYNC_RSH"
#define RSYNC_RSH_IO_ENV "RSYNC_RSH_IO"
#define RSYNC_NAME "rsync"
#define RSYNCD_SYSCONF "/etc/rsyncd.conf"
@@ -81,6 +82,9 @@
#define MAX_MAP_SIZE (256*1024)
#define IO_BUFFER_SIZE (4092)
#define IOERR_GENERAL (1<<0) /* For backward compatibility, this must == 1 */
#define IOERR_VANISHED (1<<1)
#define MAX_ARGS 1000
#define MPLEX_BASE 7
@@ -104,9 +108,7 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2, FLOG=3 };
#include "config.h"
/* The default RSYNC_RSH is always set in config.h, either to "remsh",
* "rsh", or otherwise something specified by the user. HAVE_REMSH
* controls parameter munging for HP/UX, etc. */
/* The default RSYNC_RSH is always set in config.h. */
#include <sys/types.h>
@@ -429,10 +431,10 @@ struct map_struct {
OFF_T p_fd_offset; /* offset of cursor in fd ala lseek */
};
#define MATCHFLG_WILD 0x0001 /* pattern has '*', '[', and/or '?' */
#define MATCHFLG_WILD2 0x0002 /* pattern has '**' */
#define MATCHFLG_WILD2_PREFIX 0x0004 /* pattern starts with '**' */
#define MATCHFLG_ABS_PATH 0x0008 /* path-match on absolute path */
#define MATCHFLG_WILD (1<<0) /* pattern has '*', '[', and/or '?' */
#define MATCHFLG_WILD2 (1<<1) /* pattern has '**' */
#define MATCHFLG_WILD2_PREFIX (1<<2) /* pattern starts with '**' */
#define MATCHFLG_ABS_PATH (1<<3) /* path-match on absolute path */
struct exclude_struct {
char *pattern;
int match_flags;
@@ -626,6 +628,10 @@ extern int errno;
#endif
/* Convenient wrappers for malloc and realloc. Use them. */
#define new(type) ((type *)malloc(sizeof(type)))
#define new_array(type, num) ((type *)_new_array(sizeof(type), (num)))
#define realloc_array(ptr, type, num) ((type *)_realloc_array((ptr), sizeof(type), (num)))
/* use magic gcc attributes to catch format errors */
void rprintf(enum logcode , const char *, ...)

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsync)(1)(26 Jan 2003)()()
manpage(rsync)(1)(1 Jan 2004)()()
manpagename(rsync)(faster, flexible replacement for rcp)
manpagesynopsis()
@@ -35,7 +35,7 @@ itemize(
it() support for copying links, devices, owners, groups and permissions
it() exclude and exclude-from options similar to GNU tar
it() a CVS exclude mode for ignoring the same files that CVS would ignore
it() can use any transparent remote shell, including rsh or ssh
it() can use any transparent remote shell, including ssh or rsh
it() does not require root privileges
it() pipelining of file transfers to minimize latency costs
it() support for anonymous or authenticated rsync servers (ideal for
@@ -51,8 +51,8 @@ itemize(
source nor destination path contains a : separator
it() for copying from the local machine to a remote machine using
a remote shell program as the transport (such as rsh or
ssh). This is invoked when the destination path contains a
a remote shell program as the transport (such as ssh or
rsh). This is invoked when the destination path contains a
single : separator.
it() for copying from a remote machine to the local machine
@@ -93,9 +93,9 @@ See the file README for installation instructions.
Once installed, you can use rsync to any machine that you can access via
a remote shell (as well as some that you can access using the rsync
daemon-mode protocol). For remote transfers, rsync typically uses rsh
daemon-mode protocol). For remote transfers, a modern rsync uses ssh
for its communications, but it may have been configured to use a
different remote shell by default, such as ssh.
different remote shell by default, such as rsh or remsh.
You can also specify any remote shell you like, either by using the -e
command line option, or by setting the RSYNC_RSH environment variable.
@@ -194,8 +194,8 @@ users. On those systems using --password-file is recommended.
manpagesection(CONNECTING TO AN RSYNC SERVER OVER A REMOTE SHELL PROGRAM)
It is sometimes useful to be able to set up file transfers using rsync
server capabilities on the remote machine, while still using rsh or
ssh for transport. This is especially useful when you want to connect
server capabilities on the remote machine, while still using ssh or
rsh for transport. This is especially useful when you want to connect
to a remote machine via ssh (for encryption or to get through a
firewall), but you still want to have access to the rsync server
features (see RUNNING AN RSYNC SERVER OVER A REMOTE SHELL PROGRAM,
@@ -234,18 +234,8 @@ user is root (e.g. chroot, setuid/setgid, etc.). There is no need to
configure inetd or the services map to include the rsync server port
if you run an rsync server only via a remote shell program.
To run an rsync server out of a single-use ssh key, use the
"command=em(COMMAND)" syntax in the remote user's
authorized_keys entry, where command would be
quote(rsync --server --daemon .)
NOTE: rsync's argument parsing expects the trailing ".", so make sure
that it's there. If you want to use a rsyncd.conf(5)-style
configuration file other than the default, you can added a
--config option to the em(command):
quote(rsync --server --daemon --config=em(file) .)
To run an rsync server out of a single-use ssh key, see this section
in the rsyncd.conf(5) man page.
manpagesection(EXAMPLES)
@@ -295,9 +285,9 @@ verb(
-R, --relative use relative path names
--no-relative turn off --relative
--no-implied-dirs don't send implied dirs with -R
-b, --backup make backups (see --suffix)
-b, --backup make backups (see --suffix & --backup-dir)
--backup-dir make backups into this directory
--suffix=SUFFIX define backup suffix (default ~ w/o --backup-dir)
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
-u, --update update only (don't overwrite newer files)
-l, --links copy symlinks as symlinks
-L, --copy-links copy the referent of symlinks
@@ -315,24 +305,24 @@ verb(
--no-whole-file turn off --whole-file
-x, --one-file-system don't cross filesystem boundaries
-B, --block-size=SIZE checksum blocking size (default 700)
-e, --rsh=COMMAND specify the remote shell to use
-e, --rsh=COMMAND specify the remote shell
--rsync-path=PATH specify path to rsync on the remote machine
--existing only update files that already exist
--ignore-existing ignore files that already exist on the receiving side
--delete delete files that don't exist on the sending side
--delete-excluded also delete excluded files on the receiving side
--ignore-existing ignore files that already exist on receiver
--delete delete files that don't exist on sender
--delete-excluded also delete excluded files on receiver
--delete-after delete after transferring, not before
--ignore-errors delete even if there are IO errors
--max-delete=NUM don't delete more than NUM files
--partial keep partially transferred files
--force force deletion of directories even if not empty
--force force deletion of dirs even if not empty
--numeric-ids don't map uid/gid values by user/group name
--timeout=TIME set IO timeout in seconds
-I, --ignore-times don't exclude files that match length and time
--size-only only use file size when determining if a file should be transferred
--modify-window=NUM Timestamp window (seconds) for file match (default=0)
-I, --ignore-times turn off mod time & file size quick check
--size-only ignore mod time for quick check (use size)
--modify-window=NUM compare mod times with reduced accuracy
-T --temp-dir=DIR create temporary files in directory DIR
--compare-dest=DIR also compare destination files relative to DIR
--compare-dest=DIR also compare received files relative to DIR
--link-dest=DIR create hardlinks to DIR for unchanged files
-P equivalent to --partial --progress
-z, --compress compress file data
@@ -342,7 +332,7 @@ verb(
--include=PATTERN don't exclude files matching PATTERN
--include-from=FILE don't exclude patterns listed in FILE
--files-from=FILE read FILE for list of source-file names
-0 --from0 file names we read are separated by nulls, not newlines
-0 --from0 all file lists are delimited by nulls
--version print version number
--daemon run as a rsync daemon
--no-detach do not detach from the parent
@@ -356,8 +346,8 @@ verb(
--log-format=FORMAT log file transfers using specified format
--password-file=FILE get password from FILE
--bwlimit=KBPS limit I/O bandwidth, KBytes per second
--read-batch=PREFIX read batch fileset starting with PREFIX
--write-batch=PREFIX write batch fileset starting with PREFIX
--read-batch=PREFIX read batch fileset starting with PREFIX
-h, --help show this help screen
@@ -391,11 +381,11 @@ from the remote server. This flag is useful when invoking rsync from
cron.
dit(bf(-I, --ignore-times)) Normally rsync will skip any files that are
already the same length and have the same time-stamp. This option turns
off this behavior.
already the same size and have the same modification time-stamp.
This option turns off this "quick check" behavior.
dit(bf(--size-only)) Normally rsync will skip any files that are
already the same length and have the same time-stamp. With the
already the same size and have the same modification time-stamp. With the
--size-only option files will be skipped if they have the same size,
regardless of timestamp. This is useful when starting to use rsync
after using another mirroring system which may not preserve timestamps
@@ -608,8 +598,8 @@ the rsync algorithm. See the technical report for details.
dit(bf(-e, --rsh=COMMAND)) This option allows you to choose an alternative
remote shell program to use for communication between the local and
remote copies of rsync. Typically, rsync is configured to use rsh by
default, but you may prefer to use ssh because of its high security.
remote copies of rsync. Typically, rsync is configured to use ssh by
default, but you may prefer to use rsh on a local network.
If this option is used with bf([user@]host::module/path), then the
remote shell em(COMMMAND) will be used to run an rsync server on the
@@ -810,11 +800,10 @@ dit(bf(--port=PORT)) This specifies an alternate TCP port number to use
rather than the default port 873.
dit(bf(--blocking-io)) This tells rsync to use blocking IO when launching
a remote shell transport. If -e or --rsh are not specified or are set to
the default "rsh", this defaults to blocking IO, otherwise it defaults to
non-blocking IO. You may find the --blocking-io option is needed for some
remote shells that can't handle non-blocking IO. (Note that ssh prefers
non-blocking IO.)
a remote shell transport. If the remote shell is either rsh or remsh,
rsync defaults to using
blocking IO, otherwise it defaults to using non-blocking IO. (Note that
ssh prefers non-blocking IO.)
dit(bf(--no-blocking-io)) Turn off --blocking-io, for use when it is the
default.
@@ -1017,9 +1006,9 @@ Example:
verb(
$ rsync --write-batch=pfx -a /source/dir/ /adest/dir/
$ rcp pfx.rsync_* remote:
$ rsh remote rsync --read-batch=pfx -a /bdest/dir/
$ ssh remote rsync --read-batch=pfx -a /bdest/dir/
# or alternatively
$ rsh remote ./pfx.rsync_argvs /bdest/dir/
$ ssh remote ./pfx.rsync_argvs /bdest/dir/
)
In this example, rsync is used to update /adest/dir/ with /source/dir/
@@ -1091,7 +1080,7 @@ for its transport. The way to diagnose this problem is to run your
remote shell like this:
verb(
rsh remotehost /bin/true > out.dat
ssh remotehost /bin/true > out.dat
)
then look at out.dat. If everything is working correctly then out.dat
@@ -1126,7 +1115,8 @@ dit(bf(14)) Error in IPC code
dit(bf(20)) Received SIGUSR1 or SIGINT
dit(bf(21)) Some error returned by waitpid()
dit(bf(22)) Error allocating core memory buffers
dit(bf(23)) Partial transfer
dit(bf(23)) Partial transfer due to error
dit(bf(24)) Partial transfer due to vanished source files
dit(bf(30)) Timeout in data send/receive
enddit()

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsyncd.conf)(5)(26 Jan 2003)()()
manpage(rsyncd.conf)(5)(1 Jan 2004)()()
manpagename(rsyncd.conf)(configuration file for rsync server)
manpagesynopsis()
@@ -399,6 +399,32 @@ encryption.
Future versions of rsync may support SSL for better authentication and
encryption, but that is still being investigated.
manpagesection(RUNNING AN RSYNC SERVER OVER A REMOTE SHELL PROGRAM)
If rsync is run with both the --daemon and --rsh (-e) options, it will
spawn an rsync daemon using a remote shell connection. Several
configuration options will not be available unless the remote user is
root (e.g. chroot, setuid/setgid, etc.). There is no need to configure
inetd or the services map to include the rsync server port if you run an
rsync server only via a remote shell program.
ADVANCED: To run an rsync server out of a single-use ssh key, use the
"command=em(COMMAND)" syntax in the remote user's authorized_keys entry,
where command would be
quote(rsync --server --daemon .)
NOTE: rsync's argument parsing expects the trailing ".", so make sure
that it's there. If you want to use a rsyncd.conf(5)-style
configuration file other than the default, you can added a
--config option to the em(command):
quote(rsync --server --daemon --config=em(file) .)
Note that the "--server" here is the internal option that rsync uses to
run the remote version of rsync that it communicates with, and thus you
should not be using the --server option under normal circumstances.
manpagesection(EXAMPLES)
A simple rsyncd.conf file that allow anonymous rsync to a ftp area at
@@ -468,7 +494,7 @@ Please report bugs! The rsync bug tracking system is online at
url(http://rsync.samba.org/)(http://rsync.samba.org/)
manpagesection(VERSION)
This man page is current for version 2.0 of rsync
This man page is current for version 2.x of rsync.
manpagesection(CREDITS)

View File

@@ -42,10 +42,16 @@ void read_sum_head(int f, struct sum_struct *sum)
sum->count = read_int(f);
sum->blength = read_int(f);
if (protocol_version < 27)
if (protocol_version < 27) {
sum->s2length = csum_length;
else
} else {
sum->s2length = read_int(f);
if (sum->s2length > MD4_SUM_LENGTH) {
rprintf(FERROR, "Invalid checksum length %ld\n",
(long)sum->s2length);
exit_cleanup(RERR_PROTOCOL);
}
}
sum->remainder = read_int(f);
}
@@ -58,7 +64,7 @@ static struct sum_struct *receive_sums(int f)
int i;
OFF_T offset = 0;
s = (struct sum_struct *)malloc(sizeof(*s));
s = new(struct sum_struct);
if (!s) out_of_memory("receive_sums");
read_sum_head(f, s);
@@ -73,7 +79,7 @@ static struct sum_struct *receive_sums(int f)
if (s->count == 0)
return(s);
s->sums = (struct sum_buf *)malloc(sizeof(s->sums[0])*s->count);
s->sums = new_array(struct sum_buf, s->count);
if (!s->sums) out_of_memory("receive_sums");
for (i = 0; i < (int) s->count; i++) {
@@ -156,7 +162,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (file->basedir) {
strlcpy(fname, file->basedir, MAXPATHLEN);
if (strlen(fname) == MAXPATHLEN-1) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "send_files failed on long-named directory %s\n",
full_fname(fname));
return;
@@ -181,7 +187,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
s = receive_sums(f_in);
if (!s) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "receive_sums failed\n");
return;
}
@@ -192,16 +198,22 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (!read_batch) {
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) {
io_error = 1;
rprintf(FERROR, "send_files failed to open %s: %s\n",
full_fname(fname), strerror(errno));
if (errno == ENOENT) {
io_error |= IOERR_VANISHED;
rprintf(FINFO, "file has vanished: %s\n",
full_fname(fname));
} else {
io_error |= IOERR_GENERAL;
rprintf(FERROR, "send_files failed to open %s: %s\n",
full_fname(fname), strerror(errno));
}
free_sums(s);
continue;
}
/* map the local file */
if (do_fstat(fd, &st) != 0) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR, "fstat failed: %s\n", strerror(errno));
free_sums(s);
close(fd);
@@ -280,12 +292,10 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (buf) {
j = unmap_file(buf);
if (j) {
io_error = 1;
io_error |= IOERR_GENERAL;
rprintf(FERROR,
"read errors mapping %s: (%d) %s\n",
full_fname(fname),
j,
strerror(j));
full_fname(fname), j, strerror(j));
}
}
close(fd);

View File

@@ -68,7 +68,7 @@ static int simple_recv_token(int f,char **data)
int n;
if (!buf) {
buf = (char *)malloc(CHUNK_SIZE);
buf = new_array(char, CHUNK_SIZE);
if (!buf) out_of_memory("simple_recv_token");
}
@@ -174,7 +174,7 @@ send_deflated_token(int f, int token,
rprintf(FERROR, "compression init failed\n");
exit_cleanup(RERR_STREAMIO);
}
if ((obuf = malloc(OBUF_SIZE)) == NULL)
if ((obuf = new_array(char, OBUF_SIZE)) == NULL)
out_of_memory("send_deflated_token");
init_done = 1;
} else
@@ -336,8 +336,8 @@ recv_deflated_token(int f, char **data)
rprintf(FERROR, "inflate init failed\n");
exit_cleanup(RERR_STREAMIO);
}
if ((cbuf = malloc(MAX_DATA_COUNT)) == NULL
|| (dbuf = malloc(AVAIL_OUT_SIZE(CHUNK_SIZE))) == NULL)
if (!(cbuf = new_array(char, MAX_DATA_COUNT))
|| !(dbuf = new_array(char, AVAIL_OUT_SIZE(CHUNK_SIZE))))
out_of_memory("recv_deflated_token");
init_done = 1;
} else {

View File

@@ -41,7 +41,7 @@ static struct idlist *gidlist;
static struct idlist *add_list(int id, char *name)
{
struct idlist *list = (struct idlist *)malloc(sizeof(list[0]));
struct idlist *list = new(struct idlist);
if (!list) out_of_memory("add_list");
list->next = NULL;
list->name = strdup(name);
@@ -241,7 +241,7 @@ void recv_uid_list(int f, struct file_list *flist)
id = read_int(f);
while (id != 0) {
int len = read_byte(f);
name = (char *)malloc(len+1);
name = new_array(char, len+1);
if (!name) out_of_memory("recv_uid_list");
read_sbuf(f, name, len);
if (!list) {
@@ -264,7 +264,7 @@ void recv_uid_list(int f, struct file_list *flist)
id = read_int(f);
while (id != 0) {
int len = read_byte(f);
name = (char *)malloc(len+1);
name = new_array(char, len+1);
if (!name) out_of_memory("recv_uid_list");
read_sbuf(f, name, len);
if (!list) {

27
util.c
View File

@@ -559,13 +559,6 @@ void strlower(char *s)
}
}
void *Realloc(void *p, int size)
{
if (!p) return (void *)malloc(size);
return (void *)realloc(p, size);
}
void clean_fname(char *name)
{
char *p;
@@ -1008,3 +1001,23 @@ int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6)
return ret;
}
#endif
#define MALLOC_MAX 0x40000000
void *_new_array(unsigned int size, unsigned long num)
{
if (num >= MALLOC_MAX/size)
return NULL;
return malloc(size * num);
}
void *_realloc_array(void *ptr, unsigned int size, unsigned long num)
{
if (num >= MALLOC_MAX/size)
return NULL;
/* No realloc should need this, but just in case... */
if (!ptr)
return malloc(size * num);
return realloc(ptr, size * num);
}