Compare commits

...

88 Commits

Author SHA1 Message Date
Martin Pool
ffdb58a51a Bump to 2.5.5. 2002-04-02 01:41:58 +00:00
Martin Pool
c053133207 If configured with --enable-maintainer-mode, then on receipt of a
fatal signal rsync will try to open an xterm running gdb, similarly to
Samba's "panic action" or GNOME's bug-buddy.
2002-03-27 05:10:44 +00:00
Martin Pool
9098bbf3b3 Improved network error handling. (Greg A. Woods) 2002-03-27 01:03:13 +00:00
Martin Pool
68618b8810 Shell scripts should explicitly "exit 0" for portability. Thanks Jos. 2002-03-26 10:36:45 +00:00
Martin Pool
e553d27f41 Fix suggested by Jos for hands.test. Some of the functionality
previously built into Phil's test was clashing with the runtests.sh
framework.  I think one of the core problems might be that scripts
which don't explicitly "exit 0" have return codes which vary depending
on the particular shell.  (c.f. the autoconf portability guide.)

This might break the Debian test suite but I'm afraid I don't know
enough about how it works yet.  Hopefully eventually it can become
just a wrapper around our 'make check'.
2002-03-26 10:28:57 +00:00
Martin Pool
d092924c63 Updated spec file from Jason Haar. Seems to mostly just change the
path for manuals, and bumps the version.
2002-03-26 05:15:09 +00:00
Martin Pool
34027489e0 Ignore autoconf cache. (??) 2002-03-26 01:27:24 +00:00
Martin Pool
d1239eae92 Jos points out that test -L is still broken on Solaris. Now we try up
front to detect a command that will work properly, and use that
consistently.

Also, in test report, show setting of $preserve_scratch.

Reset version.
2002-03-26 01:25:47 +00:00
Martin Pool
331050969b Bump version to 2.5.5rc1. 2002-03-25 23:22:08 +00:00
Martin Pool
259c3e72b0 Add note about possible hardlink bug. 2002-03-25 23:09:31 +00:00
Martin Pool
8f7a38336d Make the situation w.r.t. dynamically linking zlib and libpopt clear. 2002-03-25 09:42:36 +00:00
Martin Pool
999dfffc9b Add link to Apple bug. 2002-03-25 07:29:43 +00:00
Martin Pool
527a51cec5 Doc 2002-03-25 07:07:03 +00:00
Martin Pool
20c15aead5 Hm, strange off-by-one bug. 2002-03-25 06:59:17 +00:00
Martin Pool
fb859e5674 Apparently the OS X port of gcc gags on __attribute__. 2002-03-25 06:49:08 +00:00
Martin Pool
4f2dcb1714 If we discover a hardlink with -vv say what it's a link to. 2002-03-25 06:27:44 +00:00
Martin Pool
64e74631e0 Fix from Jos for batch mode on Solaris. 2002-03-25 06:06:29 +00:00
Martin Pool
fba31efb74 Disambiguate hard link messages. 2002-03-25 05:54:31 +00:00
Martin Pool
435f1ed70d Apparently SGI make doesn't like $< in non-implicit rules. 2002-03-25 04:36:56 +00:00
Martin Pool
94f34ca10a Doc. 2002-03-25 04:04:23 +00:00
Martin Pool
b0633744fa Note about mkdir bug. 2002-03-25 03:56:38 +00:00
Martin Pool
c127e8aaec Add a test case for trim_trailing_slashes, and make it handle other cases. 2002-03-25 03:51:17 +00:00
Martin Pool
bf4e725d5d Code that was meant to trim trailing slashes from mkdir() paths
actually did not; fix it.
2002-03-25 03:29:47 +00:00
Martin Pool
663717f465 Need to also delete getgroups when cleaning. 2002-03-25 03:26:28 +00:00
Martin Pool
12b159ac41 Define NGROUPS if not already done. 2002-03-25 03:18:36 +00:00
Martin Pool
9299c8f0b4 Clean testtmp*, because we now put tests in their own directories.
Add "make cleantests"
2002-03-25 03:16:35 +00:00
Martin Pool
dfef3f1099 Change chgrp.test to use our getgroups rather than the system's. 2002-03-25 03:01:37 +00:00
Martin Pool
fa3690f488 Initial revision. 2002-03-25 02:58:59 +00:00
Martin Pool
4acbfa2ade Add our own little tool to call getgroups(2) because it's too hard to
find a portable shell command that does it.
2002-03-25 02:55:52 +00:00
Martin Pool
ef86d74736 Clean up text. 2002-03-22 22:36:22 +00:00
Martin Pool
118f39d45b Clean up text. 2002-03-22 22:33:49 +00:00
Martin Pool
77867907ed Doc permissions while testing. 2002-03-22 06:22:53 +00:00
Martin Pool
98c1b32565 Rather than literally "nobody", try using uid/gid = 65534 as
"nobody".  The existing code kind-of assumes this.
2002-03-22 06:12:51 +00:00
Martin Pool
7a176e87d5 Better messages. 2002-03-22 06:09:09 +00:00
Martin Pool
79c9d8a180 Proper messages for skipped tests. 2002-03-22 06:07:50 +00:00
Martin Pool
7d8219327b If tests are skipped, explain why. 2002-03-22 06:03:46 +00:00
Martin Pool
4ac4bdbb38 More sgml cleanups. 2002-03-22 06:02:28 +00:00
Martin Pool
f494f2864c Doc about checkit. 2002-03-22 05:59:12 +00:00
Martin Pool
017f22b47f Add /usr/xpg4/bin/ to PATH to help solaris. 2002-03-22 05:52:09 +00:00
Martin Pool
dec41b556b Cope on systems without the whoami command. 2002-03-22 05:20:47 +00:00
Martin Pool
be2961da2c If there's an error in start_socket_client, print an explanation as
well as failing.

Doc.

Trying to work out why daemon-gzip-download.test fails on SCO with

  rsync error: unexplained error (code 190) at main.c(886)
2002-03-22 05:19:19 +00:00
Martin Pool
914cc65c9d Doc. 2002-03-22 05:14:44 +00:00
Martin Pool
6479c2ed3f Notes on logging etc 2002-03-22 05:11:39 +00:00
Martin Pool
c1a04ecbfd Doc. 2002-03-22 05:08:53 +00:00
Martin Pool
69b06c50c4 Use id -G rather than groups to get a list of groups for this
user, so that we can cope on systems like Cygwin that tend to have
group names containing spaces.
2002-03-22 05:06:36 +00:00
Martin Pool
6aaf8d8c10 * Make "make install-strip" works properly, and "make install"
accepts a DESTDIR variable for help in building binary packages.
      (Peter Breitenlohner)
2002-03-20 05:53:40 +00:00
Martin Pool
4cf64834ed Patch from Paul Haas:
* Fix situation where failure to fork (e.g. because out of process
      slots) would cause rsync to kill all processes owned by the
      current user.  Yes, really!  (Paul Haas, Martin Pool)

Also, add a little more documentation and paranoia to make sure we
never call kill(2) with a negative pid.
2002-03-20 01:09:49 +00:00
David Dykstra
b8709f5046 Now that whole_file and no_whole_file are separate variables, have the
--whole-file and --no-whole-file options set/reset both variables so if
more than one option is specified the last one will be the one honored.
2002-03-19 20:16:42 +00:00
Martin Pool
24448f741f Clean up sgml.
Add note about building with gcc.
2002-03-19 05:52:34 +00:00
Martin Pool
76533c52dc todo: Versions of read() and write() that corrupt the stream, or abruptly fail 2002-03-19 05:23:04 +00:00
Martin Pool
3ff984d7a7 Fix --help layout. 2002-03-19 05:09:19 +00:00
Martin Pool
7a52790b50 Fix overly long line in version. 2002-03-19 05:01:36 +00:00
Martin Pool
7b329a2d79 Follow advice from GPL to insert a disclaimer of warranty in the
version and help information.
2002-03-19 05:00:05 +00:00
Martin Pool
599dc93c64 Doc: Pipe program that makes slow/jerky connections. 2002-03-19 04:14:30 +00:00
Martin Pool
8b54f00466 Include all fields in the options table to quieten gcc warnings about
missing initializers.
2002-03-19 04:10:07 +00:00
Martin Pool
8469faef03 Intentional test of assert :_) 2002-03-19 03:59:51 +00:00
Martin Pool
bceec82f35 Previous solution for --no-whole-file would probably break when
connecting to old servers that don't have --no-whole-file.

Instead, we handle no_whole_file and whole_file separately, without
the magic -1 value.  We don't modify no_whole_file after
initialization.
2002-03-19 03:39:42 +00:00
Martin Pool
ed521de525 Sending --no-whole-file is no good because it will not work with old
versions of rsync.
2002-03-19 03:27:33 +00:00
Martin Pool
d157de203a Typo. 2002-03-19 03:23:08 +00:00
Martin Pool
1bfbf40bd5 Fix --whole-file problem that caused it to be the default even for
remote connections.  (Frank Schulz)

<http://lists.samba.org/pipermail/rsync/2002-March/006526.html>

Also, add documentation for whole_file and add assertions that the
value is valid.
2002-03-19 03:21:53 +00:00
Martin Pool
6d19c6742c Need a test for "refuse options" 2002-03-16 09:26:33 +00:00
Martin Pool
a628b06977 Note about 100295@bugs.debian.org 2002-03-16 09:11:56 +00:00
Martin Pool
6b2d24de2c Make sure that freeaddrinfo is called on all code paths leading away
from a call to getaddrinfo.  (Dave Dykstra)
<20011219085021.A23107@lucent.com>
2002-03-16 09:00:44 +00:00
Martin Pool
e23d790fa7 Doc: Note from Dave Dykstra that getaddrinfo calls must be paired with
freeaddrinfo().
2002-03-16 08:23:08 +00:00
Martin Pool
2a5904a580 Add more rules for make distclean. 2002-03-16 08:21:15 +00:00
Martin Pool
4610ac79c2 "make distclean": We try to delete built files from both the source
and build directories, just in case somebody previously configured
things in the source directory.
2002-03-16 08:18:19 +00:00
Martin Pool
142f5be922 Note about --progress patch. 2002-03-16 00:00:43 +00:00
Martin Pool
b17dd0c435 Note about debian #28416 2002-03-15 14:01:43 +00:00
Martin Pool
3669201179 Add debian bug # 2002-03-15 13:42:42 +00:00
Martin Pool
a5c48193c7 Keep stderr and stdout properly separated (Debian #23626) 2002-03-15 13:38:12 +00:00
Martin Pool
4366275bab Doc: Debian uses "nogroup" instead of group "nobody", so our defaults
are not so good.
2002-03-15 12:53:21 +00:00
Martin Pool
c579310a00 If we've finished transferring a 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. (Cameron Simpson)
2002-03-15 12:45:10 +00:00
Martin Pool
96553aa7ef Typo. 2002-03-15 06:29:22 +00:00
Martin Pool
2094283b80 On Solaris, put /usr/ucb/bin at the end of the path to help find
utilities we might need.  (Like 'whoami' in this case.)
2002-03-15 06:28:58 +00:00
Martin Pool
4c631ac621 Try to handle 'test -L' on Sun. 2002-03-15 01:22:09 +00:00
Martin Pool
d96d3893dd Try to handle 'test -L' on Sun. 2002-03-15 01:08:53 +00:00
Martin Pool
b73b51a9e4 More notes 2002-03-15 01:04:25 +00:00
Martin Pool
3c1edccb7b Suggestion from david.e.sewell to add --diff. 2002-03-15 01:03:24 +00:00
David Dykstra
b23c290630 Eliminate extraneous "done" messages in verbose mode. Problem reported by
Lee Eakin.
2002-03-14 21:20:20 +00:00
Martin Pool
c7b562becf Correct the plural in "1 file to consider." (Greg Louis) 2002-03-14 12:00:12 +00:00
Martin Pool
5648a81936 Add phony target to run Splint. 2002-03-14 10:42:52 +00:00
Martin Pool
daa3d0e2da "make install-strip" works. (Greg Louis) 2002-03-14 10:38:55 +00:00
Martin Pool
c9a66d41fe Roll over news file; put in page markers. 2002-03-14 10:33:59 +00:00
Martin Pool
0ee1bd82c5 Bump version to 2.5.5cvs 2002-03-14 03:10:23 +00:00
Martin Pool
53e1f937bc Show user name and uname -a in the test output header, to aid in bug
reports.  (We mostly want to know if they're root or not.)
2002-03-14 03:04:36 +00:00
Martin Pool
604f343c49 Doc: "opening tcp connection to %s port %d" is kind of misleading when
running the test case.
2002-03-14 02:55:11 +00:00
Martin Pool
e9c4c3018b More notes on testing. 2002-03-13 04:25:10 +00:00
Martin Pool
db1babe6a9 If a child of the rsync daemon dies with a signal, we should notice
that when we reap it and log a message.
2002-03-13 00:25:00 +00:00
38 changed files with 872 additions and 240 deletions

View File

@@ -1,9 +1,13 @@
ID
Makefile
autom4te.cache
confdefs.h
config.cache
config.h
config.log
config.status
conftest.c
conftest.log
gmon.out
rsync
shconfig
@@ -13,6 +17,3 @@ testtmp
testtmp.*
tls
zlib/dummy
confdefs.h
conftest.c
conftest.log

View File

@@ -14,6 +14,9 @@ cut-down copy of release 1.5 is included in the rsync distribution,
and will be used it there is no popt library on your build host, or if
the --with-included-popt option is passed to ./configure.
If you configure using --enable-maintainer-mode, then rsync will try
to pop up an xterm on DISPLAY=:0 if it crashes. You might find this
useful, but it should be turned off for production builds.
HP-UX NOTES

View File

@@ -12,6 +12,7 @@ CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
INSTALLCMD=@INSTALL@
INSTALLMAN=@INSTALL@
srcdir=@srcdir@
VPATH=$(srcdir)
@@ -39,7 +40,7 @@ OBJS=$(OBJS1) $(OBJS2) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
TLS_OBJ = tls.o syscall.o lib/permstring.o
# Programs we must have to run the test cases
CHECK_PROGS = rsync tls
CHECK_PROGS = rsync tls getgroups trimslash
# note that the -I. is needed to handle config.h when using VPATH
.c.o:
@@ -52,15 +53,15 @@ all: rsync
man: rsync.1 rsyncd.conf.5
install: all
-mkdir -p ${bindir}
${INSTALLCMD} -m 755 rsync ${bindir}
-mkdir -p ${mandir}/man1
-mkdir -p ${mandir}/man5
${INSTALLCMD} -m 644 $(srcdir)/rsync.1 ${mandir}/man1
${INSTALLCMD} -m 644 $(srcdir)/rsyncd.conf.5 ${mandir}/man5
-mkdir -p ${DESTDIR}${bindir}
${INSTALLCMD} ${STRIP} -m 755 rsync ${DESTDIR}${bindir}
-mkdir -p ${DESTDIR}${mandir}/man1
-mkdir -p ${DESTDIR}${mandir}/man5
${INSTALLMAN} -m 644 $(srcdir)/rsync.1 ${DESTDIR}${mandir}/man1
${INSTALLMAN} -m 644 $(srcdir)/rsyncd.conf.5 ${DESTDIR}${mandir}/man5
install-strip:
$(MAKE) INSTALLCMD='$(INSTALLCMD) -s' install
$(MAKE) STRIP='-s' install
rsync: $(OBJS)
@echo "Please ignore warnings below about mktemp -- it is used in a safe way"
@@ -71,6 +72,13 @@ $(OBJS): config.h
tls: $(TLS_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
getgroups: getgroups.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
TRIMSLASH_OBJ = trimslash.o syscall.o
trimslash: $(TRIMSLASH_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
Makefile: Makefile.in configure config.status
echo "WARNING: You need to run ./config.status --recheck"
@@ -87,13 +95,23 @@ rsyncd.conf.5: rsyncd.conf.yo
proto:
cat $(srcdir)/*.c $(srcdir)/lib/compat.c | awk -f $(srcdir)/mkproto.awk > $(srcdir)/proto.h
clean:
rm -f *~ $(OBJS) rsync $(TLS_OBJ) tls
rm -rf ./testtmp
rm -f config.cache
clean: cleantests
rm -f *~ $(OBJS) rsync $(TLS_OBJ) $(CHECK_PROGS)
cleantests:
rm -rf ./testtmp*
# We try to delete built files from both the source and build
# directories, just in case somebody previously configured things in
# the source directory.
distclean: clean
rm -f Makefile config.h config.status
rm -f Makefile config.h config.status
rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
rm -f config.cache config.log
rm -f $(srcdir)/config.cache $(srcdir)/config.log
rm -f shconfig $(srcdir)/shconfig
# this target is really just for my use. It only works on a limited
# range of machines and is used to produce a list of potentially
@@ -123,17 +141,23 @@ test: check
# might lose in the future where POSIX diverges from old sh.
check: all $(CHECK_PROGS)
POSIXLY_CORRECT=1 TLS=`pwd`/tls rsync_bin=`pwd`/rsync srcdir="$(srcdir)" $(srcdir)/runtests.sh
POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin=`pwd`/rsync srcdir="$(srcdir)" $(srcdir)/runtests.sh
# This does *not* depend on building or installing: you can use it to
# check a version installed from a binary or some other source tree,
# if you want.
installcheck: $(CHECK_PROGS)
POSIXLY_CORRECT=1 TLS=`pwd`/tls rsync_bin="$(bindir)/rsync" srcdir="$(srcdir)" $(srcdir)/runtests.sh
POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync" srcdir="$(srcdir)" $(srcdir)/runtests.sh
# TODO: Add 'dist' target; need to know which files will be included
# Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
.PHONY: splint
splint:
splint +unixlib +gnuextensions -weak rsync.c
rsync.dvi: doc/rsync.texinfo
texi2dvi -o $@ $<

41
NEWS
View File

@@ -1,16 +1,37 @@
rsync 2.5.4 (13 March 2002)
rsync 2.5.5 "Snowy River" (2 April 2002)
ENHANCEMENTS:
* With --progress, when a transfer is complete show the time taken;
otherwise show expected time to complete. (Cameron Simpson)
* Make "make install-strip" works properly, and "make install"
accepts a DESTDIR variable for help in building binary packages.
(Peter Breitenlohner, Greg Louis)
* If configured with --enable-maintainer-mode, then on receipt of
a fatal signal rsync will try to open an xterm running gdb,
similarly to Samba's "panic action" or GNOME's bug-buddy.
(Martin Pool)
"Imitation lizard skin"
BUG FIXES:
* Additional fix for zlib double-free bug. (Martin Pool, Andrew
Tridgell) (CVE CAN-2002-0059)
ENHANCEMENTS:
* Fix situation where failure to fork (e.g. because out of process
slots) would cause rsync to kill all processes owned by the
current user. Yes, really! (Paul Haas, Martin Pool)
* Merge in changes from zlib 1.1.3 to zlib 1.1.4. (Jos Backus)
(Note that rsync still uses a custom version of zlib; you can
not just link against a system library. See zlib/README.rsync)
* Fix test suite on Solaris. (Jos Backus, Martin Pool)
* Additional test cases for --compress. (Martin Pool)
* Fix minor memory leak in socket code. (Dave Dykstra, Martin
Pool.)
* Fix --whole-file problem that caused it to be the default even
for remote connections. (Martin Pool, Frank Schulz)
* Work around bug in Mac OS X mkdir(2), which cannot handle
trailing slashes.
<http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2734739.html>
(Martin Pool)
* Improved network error handling. (Greg A. Woods)

19
OLDNEWS
View File

@@ -1,3 +1,21 @@
rsync 2.5.4 (13 March 2002)
"Imitation lizard skin"
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)
(Note that rsync still uses a custom version of zlib; you can
not just link against a system library. See zlib/README.rsync)
* Additional test cases for --compress. (Martin Pool)
rsync 2.5.3 (11 March 2002)
"Happy 26"
@@ -122,6 +140,7 @@ rsync 2.5.1 (2002-01-03)
* Clearer error messages for some conditions.
rsync 2.5.0 (2001-11-30)
ANNOUNCEMENTS

173
TODO
View File

@@ -1,20 +1,80 @@
-*- indented-text -*-
URGENT ---------------------------------------------------------------
BUGS ---------------------------------------------------------------
There seems to be a bug with hardlinks
mbp/2 build$ ls -l /tmp/a /tmp/b -i
/tmp/a:
total 32
2568307 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a1
2568307 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a2
2568307 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a3
2568310 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a4
2568310 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a5
2568310 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b1
2568310 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b2
2568310 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b3
/tmp/b:
total 32
2568309 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a1
2568309 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a2
2568309 -rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a3
2568311 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a4
2568311 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a5
2568311 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b1
2568311 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b2
2568311 -rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b3
mbp/2 build$ rm -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
building file list ... done
created directory /tmp/b
./
a1
a4
a2 => a1
a3 => a2
wrote 350 bytes read 52 bytes 804.00 bytes/sec
total size is 232 speedup is 0.58
mbp/2 build$ rm -r /tmp/b
mbp/2 build$ ls -l /tmp/b
ls: /tmp/b: No such file or directory
mbp/2 build$ rm -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
rm: cannot remove `/tmp/b': No such file or directory
mbp/2 build$ rm -f -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
building file list ... done
created directory /tmp/b
./
a1
a4
a2 => a1
a3 => a2
wrote 350 bytes read 52 bytes 804.00 bytes/sec
total size is 232 speedup is 0.58
mbp/2 build$ ls -l /tmp/b
total 32
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a1
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a2
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a3
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a4
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a5
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b1
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b2
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b3
mbp/2 build$ ls -l /tmp/a
total 32
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a1
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a2
-rw-rw-r-- 3 mbp mbp 29 Mar 25 17:30 a3
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a4
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 a5
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b1
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b2
-rw-rw-r-- 5 mbp mbp 29 Mar 25 17:30 b3
IMPORTANT ------------------------------------------------------------
Cross-test versions
Part of the regression suite should be making sure that we don't
break backwards compatibility: old clients vs new servers and so
on. Ideally we would test the cross product of versions.
It might be sufficient to test downloads from well-known public
rsync servers running different versions of rsync. This will give
some testing and also be the most common case for having different
versions and not being able to upgrade.
use chroot
@@ -194,6 +254,7 @@ IPv6
which should just take a small change to the parser code.
Errors
If we hang or get SIGINT, then explain where we were up to. Perhaps
@@ -210,6 +271,11 @@ Errors
explaining why the socket is closed. I'm not sure if this would
work, but it would certainly make our messages more helpful.
What happens if a directory is missing -x attributes. Do we lose
our load? (Debian #28416) Probably fixed now, but a test case
would be good.
File attributes
Device major/minor numbers should be at least 32 bits each. See
@@ -259,6 +325,16 @@ logging
At the connections that just get a list of modules are not logged,
but they should be.
If a child of the rsync daemon dies with a signal, we should notice
that when we reap it and log a message.
Keep stderr and stdout properly separated (Debian #23626)
Use a separate function for reporting errors; prefix it with
"rsync:" or "rsync(remote)", or perhaps even "rsync(local
generator): ".
rsyncd over ssh
There are already some patches to do this.
@@ -321,6 +397,42 @@ chmod:
the program. For bonus points there would be a test case for the
parser.
(Debian #23628)
--diff
Allow people to specify the diff command. (Might want to use wdiff,
gnudiff, etc.)
Just diff the temporary file with the destination file, and delete
the tmp file rather than moving it into place.
Interaction with --partial.
Security interactions with daemon mode?
(Suggestion from david.e.sewell)
Incorrect timestamps (Debian #100295)
A bit hard to believe, but apparently it happens.
Check "refuse options works"
We need a test case for this...
Was this broken when we changed to popt?
String area code
Test whether this is actually faster than just using malloc(). If
it's not (anymore), throw it out.
PLATFORMS ------------------------------------------------------------
@@ -362,10 +474,49 @@ Memory debugger
http://devel-home.kde.org/~sewardj/
TESTING --------------------------------------------------------------
Cross-test versions
Part of the regression suite should be making sure that we don't
break backwards compatibility: old clients vs new servers and so
on. Ideally we would test the cross product of versions.
It might be sufficient to test downloads from well-known public
rsync servers running different versions of rsync. This will give
some testing and also be the most common case for having different
versions and not being able to upgrade.
Test large files
Sparse and non-sparse
Mutator program
Insert bytes, delete bytes, swap blocks, ...
configure option to enable dangerous tests
If tests are skipped, say why.
Test daemon feature to disallow particular options.
Pipe program that makes slow/jerky connections.
Versions of read() and write() that corrupt the stream, or abruptly fail
Separate makefile target to run rough tests -- or perhaps just run
them every time?
DOCUMENTATION --------------------------------------------------------
Update README
Keep list of open issues and todos on the web site
Update web site from CVS
BUILD FARM -----------------------------------------------------------
Add machines

View File

@@ -396,7 +396,7 @@ void write_batch_csum_info(int *flist_entry, int flist_count,
struct sum_struct *s)
{
size_t i;
unsigned int int_zero = 0;
size_t int_zero = 0;
extern int csum_length;
fdb_open = 1;

View File

@@ -40,12 +40,17 @@ pid_t cleanup_child_pid = -1;
*/
void _exit_cleanup(int code, const char *file, int line)
{
int ocode = code;
extern int keep_partial;
extern int log_got_error;
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
if (verbose > 3)
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
code, file, line);
if (cleanup_child_pid != -1) {
int status;
if (waitpid(cleanup_child_pid, &status, WNOHANG) == cleanup_child_pid) {
@@ -81,6 +86,10 @@ void _exit_cleanup(int code, const char *file, int line)
if (code) log_exit(code, file, line);
if (verbose > 2)
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): about to call exit(%d)\n",
ocode, file, line, code);
exit(code);
}

View File

@@ -1,7 +1,7 @@
/* -*- c-file-style: "linux"; -*-
Copyright (C) 1998-2001 by Andrew Tridgell <tridge@samba.org>
Copyright (C) 2001 by Martin Pool <mbp@samba.org>
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
@@ -29,10 +29,14 @@ extern int rsync_port;
char *auth_user;
int sanitize_paths = 0;
/*
/**
* Run a client connected to an rsyncd. The alternative to this
* function for remote-shell connections is do_cmd.
*/
* function for remote-shell connections is do_cmd().
*
* After initial server startup, hands over to client_run().
*
* @return -1 for error in startup, or the result of client_run().
**/
int start_socket_client(char *host, char *path, int argc, char *argv[])
{
int fd, i;
@@ -43,6 +47,7 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
extern int remote_version;
extern int am_sender;
extern char *shell_cmd;
extern int list_only;
extern int kludge_around_eof;
extern char *bind_address;
extern int default_af_hint;
@@ -80,6 +85,9 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
if (!user) user = getenv("LOGNAME");
if (verbose >= 2) {
/* FIXME: If we're going to use a socket program for
* testing, then this message is wrong. We need to
* say something like "(except really using %s)" */
rprintf(FINFO, "opening tcp connection to %s port %d\n",
host, rsync_port);
}
@@ -101,10 +109,14 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
io_printf(fd,"@RSYNCD: %d\n", PROTOCOL_VERSION);
if (!read_line(fd, line, sizeof(line)-1)) {
rprintf(FERROR, "rsync: did not see server greeting\n");
return -1;
}
if (sscanf(line,"@RSYNCD: %d", &remote_version) != 1) {
/* note that read_line strips of \n or \r */
rprintf(FERROR, "rsync: server sent \"%s\" rather than greeting\n",
line);
return -1;
}
@@ -115,10 +127,11 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
/* Old servers may just drop the connection here,
rather than sending a proper EXIT command. Yuck. */
kludge_around_eof = remote_version < 25;
kludge_around_eof = list_only && (remote_version < 25);
while (1) {
if (!read_line(fd, line, sizeof(line)-1)) {
rprintf(FERROR, "rsync: didn't get server startup line\n");
return -1;
}

View File

@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h])
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.52)
RSYNC_VERSION=2.5.4
RSYNC_VERSION=2.5.5
AC_SUBST(RSYNC_VERSION)
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
@@ -65,6 +65,17 @@ then
fi
# Specifically, this turns on panic_action handling.
AC_ARG_ENABLE(maintainer-mode,
AC_HELP_STRING([--enable-maintainer-mode],
[turn on extra debug features],
[], []))
if test x"$enable_maintainer_mode" = xyes
then
CFLAGS="$CFLAGS -DMAINTAINER_MODE"
fi
# This is needed for our included version of popt. Kind of silly, but
# I don't want our version too far out of sync.
CFLAGS="$CFLAGS -DHAVE_CONFIG_H"

2
doc/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
rsync.pdf
rsync.ps

View File

@@ -253,10 +253,27 @@ running rsync giving the network directory.
</qandaentry>
<qandaentry>
<question>
<para>
Why is rsync so much bigger when I build it with
<command>gcc</command>?
</para>
</question>
<answer>
<para>
On gcc, rsync builds by default with debug symbols
included. If you strip both executables, they should end
up about the same size. (Use <command>make
install-strip</command>.)
</para>
</answer>
</qandaentry>
<qandaentry>
<question>
Is rsync useful for a single large file like an ISO image?
<para>Is rsync useful for a single large file like an ISO image?</para>
</question>
<answer>
<para>
@@ -319,12 +336,16 @@ running rsync giving the network directory.
This answer, formatted with "real" bullets, can be found at:
-[4]http://twiki.org/cgi-bin/view/Wikilearn/RsyncingALargeFileFAQ*
Note: I modified this on Oct. 9. 2001 -- I marked the changes with asterisks. The only deletion
without a corresponding correction was the deletion of an "(IIRC)".
2001-Oct-09 7:47am rhkramerATfastDOTnet
</para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<appendix>
<title>Other Resources</title>
<para><ulink url="http://www.ccp14.ac.uk/ccp14admin/rsync/"></ulink></para>
</appendix>
</book>

10
flist.c
View File

@@ -101,12 +101,13 @@ static void finish_filelist_progress(const struct file_list *flist)
{
if (do_progress) {
/* This overwrites the progress line */
rprintf(FINFO, "%d files to consider\n", flist->count);
} else
rprintf(FINFO, "%d file%sto consider\n",
flist->count, flist->count == 1 ? " " : "s ");
} else {
rprintf(FINFO, "done\n");
}
}
void show_flist_stats(void)
{
/* Nothing yet */
@@ -987,8 +988,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
send_file_entry(NULL, f, 0);
}
if (show_filelist_p())
if (show_filelist_p() && f != -1) {
finish_filelist_progress(flist);
}
clean_flist(flist, 0);

View File

@@ -32,7 +32,6 @@ extern int preserve_devices;
extern int preserve_hard_links;
extern int update_only;
extern int opt_ignore_existing;
extern int whole_file;
extern int block_size;
extern int csum_length;
extern int ignore_times;
@@ -127,6 +126,37 @@ static void send_sums(struct sum_struct *s, int f_out)
}
}
/**
* Perhaps we want to just send an empty checksum set for this file,
* which will force the whole thing to be literally transferred.
*
* When do we do this? If the user's explicitly said they
* want the whole thing, or if { they haven't explicitly
* requested a delta, and it's local but not batch mode.}
*
* Whew. */
static BOOL disable_deltas_p(void)
{
extern int whole_file, no_whole_file;
extern int local_server;
extern int write_batch;
assert(whole_file == 0 || whole_file == 1);
/* whole_file and no_whole_file are never both on at the same time */
if (whole_file)
return True;
else if (no_whole_file)
return False;
else if (write_batch)
return False;
else
return local_server;
}
/*
generate a stream of signatures/checksums that describe a buffer
@@ -332,7 +362,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
if (preserve_hard_links && check_hard_link(file)) {
if (verbose > 1)
rprintf(FINFO, "\"%s\" is a hard link\n",f_name(file));
rprintf(FINFO, "recv_generator: \"%s\" is a hard link\n",f_name(file));
return;
}
@@ -403,7 +433,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
return;
}
if (whole_file) {
if (disable_deltas_p()) {
write_int(f_out,i);
send_sums(NULL,f_out);
return;

49
getgroups.c Normal file
View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2002 by Martin Pool
*
* 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.
*/
/**
* @file getgroups.c
*
* Print out the gids of all groups for the current user. This is
* like `id -G` on Linux, but it's too hard to find a portable
* equivalent.
**/
#include "rsync.h"
#ifndef NGROUPS
/* It ought to be defined, but just in case. */
# define NGROUPS 32
#endif
int main(int argc, char *argv[])
{
int n, i;
gid_t list[NGROUPS];
if ((n = getgroups(NGROUPS, list)) == -1) {
perror("getgroups");
return 1;
}
for (i = 0; i < n; i++)
printf("%u ", list[i]);
printf("\n");
return 0;
}

View File

@@ -97,14 +97,21 @@ int check_hard_link(struct file_struct *file)
low = mid + 1;
}
/* XXX: To me this looks kind of dodgy -- why do we use [low]
* here and [low-1] below? -- mbp */
if (hlink_compare(&hlink_list[low], file) != 0)
return 0;
if (low > 0 &&
S_ISREG(hlink_list[low - 1].mode) &&
file->dev == hlink_list[low - 1].dev &&
file->inode == hlink_list[low - 1].inode)
file->inode == hlink_list[low - 1].inode) {
if (verbose >= 2) {
rprintf(FINFO, "check_hard_link: \"%s\" is a hard link to file %d, \"%s\"\n",
f_name(file), low-1, f_name(&hlink_list[low-1]));
}
return 1;
}
#endif
return 0;

12
io.c
View File

@@ -2,7 +2,7 @@
Copyright (C) 1996-2001 by Andrew Tridgell
Copyright (C) Paul Mackerras 1996
Copyright (C) 2001 by Martin Pool <mbp@samba.org>
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
@@ -20,7 +20,6 @@
*/
/**
*
* @file io.c
*
* Socket and pipe IO utilities used in rsync.
@@ -624,12 +623,19 @@ void write_byte(int f,unsigned char c)
/**
* Read a line of up to @p maxlen characters into @p buf. Does not
* contain a trailing newline or carriage return.
*
* @return 1 for success; 0 for io error or truncation.
**/
int read_line(int f, char *buf, size_t maxlen)
{
while (maxlen) {
buf[0] = 0;
read_buf(f, buf, 1);
if (buf[0] == 0) return 0;
if (buf[0] == 0)
return 0;
if (buf[0] == '\n') {
buf[0] = 0;
break;

View File

@@ -3,7 +3,7 @@
/* some fixes
*
* Copyright (C) 2001 by Martin Pool <mbp@samba.org>
* Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
*/
/*
@@ -48,6 +48,8 @@
*
*/
/* TODO: Parameter to set debug level on server. */
#include "rsync.h"
#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2)))
#define strequal(a,b) (strcasecmp(a,b)==0)
@@ -154,7 +156,16 @@ static service sDefault =
False, /* transfer logging */
False, /* ignore errors */
"nobody",/* uid */
/* TODO: This causes problems on Debian, where it is called
* "nogroup". Debian patch this in their version of the
* package, but it would be nice to be consistent. Possibly
* other systems are different again.
*
* What is the best behaviour? Perhaps always using (gid_t)
* -2? */
"nobody",/* gid */
NULL, /* hosts allow */
NULL, /* hosts deny */
NULL, /* auth users */

59
main.c
View File

@@ -640,14 +640,14 @@ static int copy_argv (char *argv[])
}
/*
/**
* Start a client for either type of remote connection. Work out
* whether the arguments request a remote shell or rsyncd connection,
* and call the appropriate connection function, then run_client.
*
* Calls either start_socket_client (for sockets) or do_cmd and
* client_run (for ssh).
*/
**/
static int start_client(int argc, char *argv[])
{
char *p;
@@ -694,7 +694,7 @@ static int start_client(int argc, char *argv[])
p = find_colon(argv[0]);
if (p) {
if (p[1] == ':') {
if (p[1] == ':') { /* double colon */
*p = 0;
return start_socket_client(argv[0], p+2, argc-1, argv+1);
}
@@ -716,12 +716,6 @@ static int start_client(int argc, char *argv[])
p = find_colon(argv[argc-1]);
if (!p) {
local_server = 1;
/*
* disable "rsync algorithm" when both sides local,
* except when creating a batch update
*/
if (!write_batch && whole_file == -1)
whole_file = 1;
} else if (p[1] == ':') {
*p = 0;
return start_socket_client(argv[argc-1], p+2, argc-1, argv);
@@ -802,6 +796,39 @@ static RETSIGTYPE sigchld_handler(int UNUSED(val)) {
#endif
}
/**
* This routine catches signals and tries to send them to gdb.
*
* Because it's called from inside a signal handler it ought not to
* use too many library routines.
*
* @todo Perhaps use "screen -X" instead/as well, to help people
* debugging without easy access to X. Perhaps use an environment
* variable, or just call a script?
*
* @todo The /proc/ magic probably only works on Linux (and
* Solaris?) Can we be more portable?
**/
#ifdef MAINTAINER_MODE
static RETSIGTYPE rsync_panic_handler(int UNUSED(whatsig))
{
char cmd_buf[300];
int ret;
sprintf(cmd_buf,
"xterm -display :0 -T Panic -n Panic "
"-e gdb /proc/%d/exe %d",
getpid(), getpid());
/* Unless we failed to execute gdb, we allow the process to
* continue. I'm not sure if that's right. */
ret = system(cmd_buf);
if (ret)
_exit(ret);
}
#endif
int main(int argc,char *argv[])
{
extern int am_root;
@@ -820,6 +847,12 @@ int main(int argc,char *argv[])
signal(SIGUSR1, sigusr1_handler);
signal(SIGUSR2, sigusr2_handler);
signal(SIGCHLD, sigchld_handler);
#ifdef MAINTAINER_MODE
signal(SIGSEGV, rsync_panic_handler);
signal(SIGFPE, rsync_panic_handler);
signal(SIGABRT, rsync_panic_handler);
signal(SIGBUS, rsync_panic_handler);
#endif /* def MAINTAINER_MODE */
starttime = time(NULL);
am_root = (getuid() == 0);
@@ -887,8 +920,10 @@ int main(int argc,char *argv[])
ret = start_client(argc, argv);
if (ret == -1)
exit_cleanup(RERR_STARTCLIENT);
exit_cleanup(RERR_STARTCLIENT);
else
exit_cleanup(ret);
return ret;
exit_cleanup(ret);
exit(ret);
/* NOTREACHED */
}

192
options.c
View File

@@ -22,7 +22,20 @@
#include "popt.h"
int make_backups = 0;
int whole_file = -1;
/**
* Should we send the whole file as literal data rather than trying to
* create an incremental diff? This is on by default when both source
* and destination are local and we're not doing a batch delta,
* because there it's no cheaper to read the whole basis file than to
* just rewrite it.
*
* If both are 0, then look at whether we're local or remote and go by
* that.
**/
int whole_file = 0;
int no_whole_file = 0;
int copy_links = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
@@ -146,20 +159,28 @@ static void print_rsync_version(enum logcode f)
"Copyright (C) 1996-2002 by Andrew Tridgell and others\n");
rprintf(f, "<http://rsync.samba.org/>\n");
rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, "
"%shard links, %ssymlinks, batchfiles, %sIPv6,\n",
"%shard links, %ssymlinks, batchfiles, \n",
(int) (sizeof(OFF_T) * 8),
got_socketpair, hardlinks, links, ipv6);
got_socketpair, hardlinks, links);
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
* macros. */
rprintf(f, " %d-bit system inums, %d-bit internal inums\n",
rprintf(f, " %sIPv6, %d-bit system inums, %d-bit internal inums\n",
ipv6,
(int) (sizeof(dumstat->st_ino) * 8),
(int) (sizeof(INO64_T) * 8));
#ifdef NO_INT64
rprintf(f, "WARNING: no 64-bit integers on this platform!\n");
#endif
rprintf(f,
"\n"
"rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n"
"are welcome to redistribute it under certain conditions. See the GNU\n"
"General Public Licence for details.\n"
);
}
@@ -167,7 +188,7 @@ void usage(enum logcode F)
{
print_rsync_version(F);
rprintf(F,"rsync is a file transfer program capable of efficient remote update\nvia a fast differencing algorithm.\n\n");
rprintf(F,"\nrsync is a file transfer program capable of efficient remote update\nvia a fast differencing algorithm.\n\n");
rprintf(F,"Usage: rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST\n");
rprintf(F," or rsync [OPTION]... [USER@]HOST:SRC DEST\n");
@@ -265,86 +286,86 @@ enum {OPT_VERSION = 1000, OPT_SUFFIX, OPT_SENDER, OPT_SERVER, OPT_EXCLUDE,
OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY, OPT_ADDRESS,
OPT_DELETE_AFTER, OPT_EXISTING, OPT_MAX_DELETE, OPT_BACKUP_DIR,
OPT_IGNORE_ERRORS, OPT_BWLIMIT, OPT_BLOCKING_IO,
OPT_NO_BLOCKING_IO, OPT_NO_WHOLE_FILE,
OPT_NO_BLOCKING_IO, OPT_WHOLE_FILE, OPT_NO_WHOLE_FILE,
OPT_MODIFY_WINDOW, OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_IGNORE_EXISTING};
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
{"version", 0, POPT_ARG_NONE, 0, OPT_VERSION},
{"suffix", 0, POPT_ARG_STRING, &backup_suffix},
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path},
{"password-file", 0, POPT_ARG_STRING, &password_file},
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times},
{"size-only", 0, POPT_ARG_NONE, &size_only},
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW},
{"one-file-system", 'x', POPT_ARG_NONE, &one_file_system},
{"delete", 0, POPT_ARG_NONE, &delete_mode},
{"existing", 0, POPT_ARG_NONE, &only_existing},
{"ignore-existing", 0, POPT_ARG_NONE, &opt_ignore_existing},
{"delete-after", 0, POPT_ARG_NONE, &delete_after},
{"delete-excluded", 0, POPT_ARG_NONE, 0, OPT_DELETE_EXCLUDED},
{"force", 0, POPT_ARG_NONE, &force_delete},
{"numeric-ids", 0, POPT_ARG_NONE, &numeric_ids},
{"exclude", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE},
{"include", 0, POPT_ARG_STRING, 0, OPT_INCLUDE},
{"exclude-from", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM},
{"include-from", 0, POPT_ARG_STRING, 0, OPT_INCLUDE_FROM},
{"safe-links", 0, POPT_ARG_NONE, &safe_symlinks},
{"help", 'h', POPT_ARG_NONE, 0, 'h'},
{"backup", 'b', POPT_ARG_NONE, &make_backups},
{"dry-run", 'n', POPT_ARG_NONE, &dry_run},
{"sparse", 'S', POPT_ARG_NONE, &sparse_files},
{"cvs-exclude", 'C', POPT_ARG_NONE, &cvs_exclude},
{"update", 'u', POPT_ARG_NONE, &update_only},
{"links", 'l', POPT_ARG_NONE, &preserve_links},
{"copy-links", 'L', POPT_ARG_NONE, &copy_links},
{"whole-file", 'W', POPT_ARG_NONE, &whole_file},
{"no-whole-file", 0, POPT_ARG_NONE, 0, OPT_NO_WHOLE_FILE},
{"copy-unsafe-links", 0, POPT_ARG_NONE, &copy_unsafe_links},
{"perms", 'p', POPT_ARG_NONE, &preserve_perms},
{"owner", 'o', POPT_ARG_NONE, &preserve_uid},
{"group", 'g', POPT_ARG_NONE, &preserve_gid},
{"devices", 'D', POPT_ARG_NONE, &preserve_devices},
{"times", 't', POPT_ARG_NONE, &preserve_times},
{"checksum", 'c', POPT_ARG_NONE, &always_checksum},
{"verbose", 'v', POPT_ARG_NONE, 0, 'v'},
{"quiet", 'q', POPT_ARG_NONE, 0, 'q'},
{"archive", 'a', POPT_ARG_NONE, 0, 'a'},
{"server", 0, POPT_ARG_NONE, &am_server},
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER},
{"recursive", 'r', POPT_ARG_NONE, &recurse},
{"relative", 'R', POPT_ARG_NONE, &relative_paths},
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd},
{"block-size", 'B', POPT_ARG_INT, &block_size},
{"max-delete", 0, POPT_ARG_INT, &max_delete},
{"timeout", 0, POPT_ARG_INT, &io_timeout},
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir},
{"compare-dest", 0, POPT_ARG_STRING, &compare_dest},
{"version", 0, POPT_ARG_NONE, 0, OPT_VERSION, 0, 0},
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"password-file", 0, POPT_ARG_STRING, &password_file, 0, 0, 0 },
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times , 0, 0, 0 },
{"size-only", 0, POPT_ARG_NONE, &size_only , 0, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"one-file-system", 'x', POPT_ARG_NONE, &one_file_system , 0, 0, 0 },
{"delete", 0, POPT_ARG_NONE, &delete_mode , 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &only_existing , 0, 0, 0 },
{"ignore-existing", 0, POPT_ARG_NONE, &opt_ignore_existing , 0, 0, 0 },
{"delete-after", 0, POPT_ARG_NONE, &delete_after , 0, 0, 0 },
{"delete-excluded", 0, POPT_ARG_NONE, 0, OPT_DELETE_EXCLUDED, 0, 0 },
{"force", 0, POPT_ARG_NONE, &force_delete , 0, 0, 0 },
{"numeric-ids", 0, POPT_ARG_NONE, &numeric_ids , 0, 0, 0 },
{"exclude", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE, 0, 0 },
{"include", 0, POPT_ARG_STRING, 0, OPT_INCLUDE, 0, 0 },
{"exclude-from", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM, 0, 0 },
{"include-from", 0, POPT_ARG_STRING, 0, OPT_INCLUDE_FROM, 0, 0 },
{"safe-links", 0, POPT_ARG_NONE, &safe_symlinks , 0, 0, 0 },
{"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 },
{"backup", 'b', POPT_ARG_NONE, &make_backups , 0, 0, 0 },
{"dry-run", 'n', POPT_ARG_NONE, &dry_run , 0, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files , 0, 0, 0 },
{"cvs-exclude", 'C', POPT_ARG_NONE, &cvs_exclude , 0, 0, 0 },
{"update", 'u', POPT_ARG_NONE, &update_only , 0, 0, 0 },
{"links", 'l', POPT_ARG_NONE, &preserve_links , 0, 0, 0 },
{"copy-links", 'L', POPT_ARG_NONE, &copy_links , 0, 0, 0 },
{"whole-file", 'W', POPT_ARG_NONE, 0, OPT_WHOLE_FILE, 0, 0 },
{"no-whole-file", 0, POPT_ARG_NONE, 0, OPT_NO_WHOLE_FILE, 0, 0 },
{"copy-unsafe-links", 0, POPT_ARG_NONE, &copy_unsafe_links , 0, 0, 0 },
{"perms", 'p', POPT_ARG_NONE, &preserve_perms , 0, 0, 0 },
{"owner", 'o', POPT_ARG_NONE, &preserve_uid , 0, 0, 0 },
{"group", 'g', POPT_ARG_NONE, &preserve_gid , 0, 0, 0 },
{"devices", 'D', POPT_ARG_NONE, &preserve_devices , 0, 0, 0 },
{"times", 't', POPT_ARG_NONE, &preserve_times , 0, 0, 0 },
{"checksum", 'c', POPT_ARG_NONE, &always_checksum , 0, 0, 0 },
{"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
{"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 },
{"archive", 'a', POPT_ARG_NONE, 0, 'a', 0, 0 },
{"server", 0, POPT_ARG_NONE, &am_server , 0, 0, 0 },
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER, 0, 0 },
{"recursive", 'r', POPT_ARG_NONE, &recurse , 0, 0, 0 },
{"relative", 'R', POPT_ARG_NONE, &relative_paths , 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd , 0, 0, 0 },
{"block-size", 'B', POPT_ARG_INT, &block_size , 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete , 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout , 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir , 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, &compare_dest , 0, 0, 0 },
/* TODO: Should this take an optional int giving the compression level? */
{"compress", 'z', POPT_ARG_NONE, &do_compression},
{"daemon", 0, POPT_ARG_NONE, &am_daemon},
{"no-detach", 0, POPT_ARG_NONE, &no_detach},
{"stats", 0, POPT_ARG_NONE, &do_stats},
{"progress", 0, POPT_ARG_NONE, &do_progress},
{"partial", 0, POPT_ARG_NONE, &keep_partial},
{"ignore-errors", 0, POPT_ARG_NONE, &ignore_errors},
{"blocking-io", 0, POPT_ARG_NONE, &blocking_io},
{"no-blocking-io", 0, POPT_ARG_NONE, 0, OPT_NO_BLOCKING_IO},
{0, 'P', POPT_ARG_NONE, 0, 'P'},
{"config", 0, POPT_ARG_STRING, &config_file},
{"port", 0, POPT_ARG_INT, &rsync_port},
{"log-format", 0, POPT_ARG_STRING, &log_format},
{"bwlimit", 0, POPT_ARG_INT, &bwlimit},
{"address", 0, POPT_ARG_STRING, &bind_address, 0},
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir},
{"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links},
{"read-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_READ_BATCH},
{"write-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_WRITE_BATCH},
{"compress", 'z', POPT_ARG_NONE, &do_compression , 0, 0, 0 },
{"daemon", 0, POPT_ARG_NONE, &am_daemon , 0, 0, 0 },
{"no-detach", 0, POPT_ARG_NONE, &no_detach , 0, 0, 0 },
{"stats", 0, POPT_ARG_NONE, &do_stats , 0, 0, 0 },
{"progress", 0, POPT_ARG_NONE, &do_progress , 0, 0, 0 },
{"partial", 0, POPT_ARG_NONE, &keep_partial , 0, 0, 0 },
{"ignore-errors", 0, POPT_ARG_NONE, &ignore_errors , 0, 0, 0 },
{"blocking-io", 0, POPT_ARG_NONE, &blocking_io , 0, 0, 0 },
{"no-blocking-io", 0, POPT_ARG_NONE, 0, OPT_NO_BLOCKING_IO, 0, 0 },
{0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 },
{"config", 0, POPT_ARG_STRING, &config_file , 0, 0, 0 },
{"port", 0, POPT_ARG_INT, &rsync_port , 0, 0, 0 },
{"log-format", 0, POPT_ARG_STRING, &log_format , 0, 0, 0 },
{"bwlimit", 0, POPT_ARG_INT, &bwlimit , 0, 0, 0 },
{"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir , 0, 0, 0 },
{"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links , 0, 0, 0 },
{"read-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_READ_BATCH, 0, 0 },
{"write-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_WRITE_BATCH, 0, 0 },
#ifdef INET6
{0, '4', POPT_ARG_VAL, &default_af_hint, AF_INET },
{0, '6', POPT_ARG_VAL, &default_af_hint, AF_INET6 },
{0, '4', POPT_ARG_VAL, &default_af_hint, AF_INET , 0, 0 },
{0, '6', POPT_ARG_VAL, &default_af_hint, AF_INET6 , 0, 0 },
#endif
{0,0,0,0}
{0,0,0,0, 0, 0, 0}
};
@@ -463,7 +484,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
add_exclude_file(poptGetOptArg(pc), 1, 1);
break;
case OPT_WHOLE_FILE:
whole_file = 1;
no_whole_file = 0;
break;
case OPT_NO_WHOLE_FILE:
no_whole_file = 1;
whole_file = 0;
break;
@@ -590,8 +617,6 @@ void server_options(char **args,int *argc)
int i, x;
if (whole_file == -1)
whole_file = 0;
if (blocking_io == -1)
blocking_io = 0;
@@ -616,8 +641,14 @@ void server_options(char **args,int *argc)
argstr[x++] = 'l';
if (copy_links)
argstr[x++] = 'L';
assert(whole_file == 0 || whole_file == 1);
if (whole_file)
argstr[x++] = 'W';
/* We don't need to send --no-whole-file, because it's the
* default for remote transfers, and in any case old versions
* of rsync will not understand it. */
if (preserve_hard_links)
argstr[x++] = 'H';
if (preserve_uid)
@@ -758,7 +789,6 @@ void server_options(char **args,int *argc)
args[ac++] = compare_dest;
}
*argc = ac;
}

View File

@@ -1,10 +1,10 @@
Summary: Program for efficient remote updates of files.
Name: rsync
Version: 2.5.1
Version: 2.5.4
Release: 1
Copyright: GPL
Group: Applications/Networking
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.5.1.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
@@ -21,6 +21,9 @@ A technical report describing the rsync algorithm is included with
this package.
%changelog
* 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>
@@ -59,23 +62,23 @@ previous package(s).)
%setup
%build
./configure --prefix=/usr
./configure --prefix=/usr --mandir=/usr/share/man
make CFLAGS="$RPM_OPT_FLAGS"
strip rsync
%install
mkdir -p $RPM_BUILD_ROOT/usr/{bin,man/{man1,man5}}
mkdir -p $RPM_BUILD_ROOT/usr/{bin,share/man/{man1,man5}}
install -m755 rsync $RPM_BUILD_ROOT/usr/bin
install -m644 rsync.1* $RPM_BUILD_ROOT/usr/man/man1
install -m644 rsyncd.conf.5* $RPM_BUILD_ROOT/usr/man/man5
install -m644 rsync.1 $RPM_BUILD_ROOT/usr/share/man/man1
install -m644 rsyncd.conf.5 $RPM_BUILD_ROOT/usr/share/man/man5
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr(-,root,root) /usr/bin/rsync
%attr(-,root,root) /usr/man/man1/rsync.1*
%attr(-,root,root) /usr/man/man5/rsyncd.conf.5*
%attr(-,root,root) /usr/share/man/man1/rsync.1*
%attr(-,root,root) /usr/share/man/man5/rsyncd.conf.5*
%attr(-,root,root) %doc tech_report.tex
%attr(-,root,root) %doc README
%attr(-,root,root) %doc COPYING

5
popt/README.rsync Normal file
View File

@@ -0,0 +1,5 @@
Unlike zlib, this is a perfectly ordinary copy of libpopt. It's only
used on platforms that don't have a sufficiently up-to-date copy of
their own. If you build rsync on a platform which has popt, this
directory should not be used. (You can control that using
--with-included-popt.)

25
rsync.h
View File

@@ -217,6 +217,8 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2, FLOG=3 };
#include <compat.h>
#endif
#include <assert.h>
#define BOOL int
@@ -564,19 +566,24 @@ extern int errno;
/* handler for null strings in printf format */
#define NS(s) ((s)?(s):"<NULL>")
#if !defined(__GNUC__) || defined(APPLE)
/* Apparently the OS X port of gcc gags on __attribute__.
*
* <http://www.opensource.apple.com/bugs/X/gcc/2512150.html> */
#define __attribute__(x)
#endif
/* use magic gcc attributes to catch format errors */
void rprintf(enum logcode , const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
__attribute__((format (printf, 2, 3)))
;
/* This is just like rprintf, but it also tries to print some
* representation of the error code. Normally errcode = errno. */
void rsyserr(enum logcode, int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 4)))
#endif
__attribute__((format (printf, 3, 4)))
;
#ifdef REPLACE_INET_NTOA
@@ -610,8 +617,4 @@ inet_ntop(int af, const void *src, char *dst, size_t size);
int isc_net_pton(int af, const char *src, void *dst);
#endif
#ifdef __GNUC__
# define UNUSED(x) x __attribute__((__unused__))
#else
# define UNUSED(x) x
#endif /* ndef __GNUC__ */
#define UNUSED(x) x __attribute__((__unused__))

View File

@@ -125,6 +125,9 @@ set -e
RUNSHFLAGS='-e'
# for Solaris
PATH="/usr/xpg4/bin/:$PATH"
if [ -n "$loglevel" ] && [ "$loglevel" -gt 8 ]
then
if set -x
@@ -139,6 +142,20 @@ echo "$0 running in `pwd`"
echo " rsync_bin=$rsync_bin"
echo " srcdir=$srcdir"
testuser=`whoami || echo UNKNOWN`
echo " testuser=$testuser"
echo " os=`uname -a`"
# It must be "yes", not just nonnull
if test "x$preserve_scratch" = xyes
then
echo " preserve_scratch=yes"
else
echo " preserve_scratch=no"
fi
if test ! -f $rsync_bin
then
echo "rsync_bin $rsync_bin is not a file" >&2
@@ -212,7 +229,8 @@ do
maybe_discard_scratch
;;
77)
echo "SKIP $testbase"
# backticks will fill the whole file onto one line, which is a feature
echo "SKIP $testbase (`cat \"$scratchdir/whyskipped\"`)"
skipped=`expr $skipped + 1`
maybe_discard_scratch
;;

View File

@@ -122,12 +122,14 @@ int try_bind_local(int s,
for (r = bres_all; r; r = r->ai_next) {
if (bind(s, r->ai_addr, r->ai_addrlen) == -1)
continue;
freeaddrinfo(bres_all);
return s;
}
/* no error message; there might be some problem that allows
* creation of the socket but not binding, perhaps if the
* machine has no ipv6 address of this name. */
freeaddrinfo(bres_all);
return -1;
}
@@ -329,7 +331,8 @@ static int open_socket_in(int type, int port, const char *bind_address,
close(s);
continue;
}
freeaddrinfo(all_ai);
return s;
}

View File

@@ -111,19 +111,31 @@ int do_rename(char *fname1, char *fname2)
}
int do_mkdir(char *fname, mode_t mode)
void trim_trailing_slashes(char *name)
{
int l;
if (dry_run)
return 0;
CHECK_RO;
/* Some BSD systems cannot make a directory if the name
* contains a trailing slash.
* <http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2734739.html> */
if ((l = strlen(fname)) && (fname[l-1] == '/'))
fname[l-1] = '/';
/* Don't change empty string; and also we can't improve on
* "/" */
l = strlen(name);
while (l > 1) {
if (name[--l] != '/')
break;
name[l] = '\0';
}
}
int do_mkdir(char *fname, mode_t mode)
{
if (dry_run)
return 0;
CHECK_RO;
trim_trailing_slashes(fname);
return mkdir(fname, mode);
}

View File

@@ -18,7 +18,9 @@ set -x
fromdir="$scratchdir/from"
todir="$scratchdir/to"
mygrps="`groups`" || fail "Can't get groups"
# TODO: I guess some systems will not have 'id', and therefore we have
# to ship or emulate it.
mygrps="`rsync_getgroups`" || fail "Can't get groups"
mkdir "$fromdir"
for g in $mygrps

View File

@@ -26,10 +26,10 @@ name2="$fromdir/name2"
echo "This is the file" > "$name1"
echo "This is the other file" > "$name2"
chown 5000 "$name1" || test_skipped "Can't chown"
chown 5001 "$name2" || test_skipped "Can't chown"
chgrp 5002 "$name1" || test_skipped "Can't chgrp"
chgrp 5003 "$name2" || test_skipped "Can't chgrp"
chown 5000 "$name1" || test_skipped "Can't chown (probably need root)"
chown 5001 "$name2" || test_skipped "Can't chown (probably need root)"
chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
checkit "rsync -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"

View File

@@ -19,8 +19,8 @@ todir="$scratchdir/to"
# TODO: Need to test whether hardlinks are possible on this OS/filesystem
mkdir "$fromdir"
mknod "$fromdir/char" c 42 69 || test_skipped "Can't create char device node?"
mknod "$fromdir/block" b 42 69 || test_skipped "Can't create block device node?"
mknod "$fromdir/char" c 42 69 || test_skipped "Can't create char device node unless root"
mknod "$fromdir/block" b 42 69 || test_skipped "Can't create block device node unless root"
checkit "rsync -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"

View File

@@ -21,8 +21,7 @@
. $srcdir/testsuite/rsync.fns
echo "SKIP THIS FOR NOW; It's a known bug"
exit 77
test_skipped "Known minor bug in this code"
set -x

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (C) 1998,1999 Philip Hands <phil@hands.com>
# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
# Copyright (C) 1998, 1999 by Philip Hands <phil@hands.com>
# Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
#
# This program is distributable under the terms of the GNU GPL (see COPYING)
@@ -25,6 +25,4 @@ runtest "extra data" 'checkit "$RSYNC -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
cp ${FROM}/text ${TO}/ThisShouldGo
runtest " --delete" 'checkit "$RSYNC --delete -avH ${FROM}/ ${TO}" ${FROM}/ ${TO}'
checkforlogs ${LOG}.?
hands_cleanup
exit 0

View File

@@ -24,6 +24,9 @@ TO=${TMP}/to
LOG=${TMP}/log
RSYNC="$rsync_bin"
# Berkley's nice.
PATH="$PATH:/usr/ucb"
runtest() {
echo $ECHO_N "Test $1: $ECHO_C"
if eval "$2"
@@ -42,7 +45,11 @@ printmsg() {
rsync_ls_lR() {
find "$@" -print | sort | xargs $TLS
find "$@" -print | sort | xargs "$TOOLDIR/tls"
}
rsync_getgroups() {
"$TOOLDIR/getgroups"
}
@@ -95,13 +102,6 @@ hands_setup() {
}
hands_cleanup() {
rm -r "$TMP"
}
####################
# Many machines do not have "mkdir -p", so we have to build up long paths.
# How boring.
@@ -134,6 +134,11 @@ makepath () {
# Run a test (in '$1') then compare directories $2 and $3 to see if
# there are any difference. If there are, explain them.
# So normally basically $1 should be an rsync command, and $2 and $3
# the source and destination directories. This is only good when you
# expect to transfer the whole directory exactly as is. If some files
# should be excluded, you might need to use something else.
checkit() {
failed=
@@ -169,21 +174,6 @@ checkit() {
}
# In fact, we need a more general feature of capturing all stderr/log files,
# and dumping them if something goes wrong.
checkforlogs() {
# skip it if we're under debian-test
if test -n "${Debian}" ; then return 0 ; fi
if [ -f $1 -a -s $1 ] ; then
echo "Failures have occurred. $1 follows:" >&2
cat $1 >&2
exit 1
fi
}
build_rsyncd_conf() {
# Build an appropriate configuration file
conf="$scratchdir/test-rsyncd.conf"
@@ -201,6 +191,12 @@ use chroot = no
hosts allow = localhost, 127.0.0.1
log file = $logfile
# We don't know if this machine has "nobody" or "nogroup", so use the quasi-canonical
# values of (uint16_t) -2.
uid = 65534
gid = 65534
[test-from]
path = $FROM
read only = yes
@@ -230,6 +226,7 @@ test_fail() {
test_skipped() {
echo "$@" >&2
echo "$@" > "$TMP/whyskipped"
exit 77
}
@@ -241,5 +238,42 @@ test_xfail() {
exit 78
}
# be reproducible
umask 077
# Determine what shell command will appropriately test for links.
ln -s foo "$scratchdir/testlink"
for cmd in test /bin/test /usr/bin/test /usr/ucb/bin/test /usr/ucb/test
do
for switch in -h -L
do
if $cmd $switch "$scratchdir/testlink" 2>/dev/null
then
# how nice
TEST_SYMLINK_CMD="$cmd $switch"
# i wonder if break 2 is portable?
break 2
fi
done
done
if [ "x$TEST_SYMLINK_CMD" = 'x' ]
then
test_fail "Couldn't determine how to test for symlinks"
else
echo "Testing for symlinks using '$TEST_SYMLINK_CMD'"
fi
# Test whether something is a link, allowing for shell peculiarities
is_a_link() {
# note the variable contains the first option and therefore is not quoted
$TEST_SYMLINK_CMD "$1"
}
# We need to set the umask to be reproducible. Note also that when we
# do some daemon tests as root, we will setuid() and therefore the
# directory has to be writable by the nobody user in some cases. The
# best thing is probably to explicitly chmod those directories after
# creation.
umask 022

View File

@@ -12,18 +12,15 @@
if [ "x$rsync_enable_ssh_tests" != xyes ]
then
echo "Skipping SSH tests because \$rsync_enable_ssh_tests is not set"
exit 77
test_skipped "Skipping SSH tests because \$rsync_enable_ssh_tests is not set"
fi
if ! type ssh >/dev/null ; then
echo "Skipping SSH tests because ssh is not in the path"
exit 77
test_skipped "Skipping SSH tests because ssh is not in the path"
fi
if ! [ "`ssh -o'BatchMode yes' localhost echo yes`" = "yes" ]; then
echo "Skipping SSH tests because ssh conection to localhost not authorised"
exit 77
test_skipped "Skipping SSH tests because ssh conection to localhost not authorised"
fi
runtest "ssh: basic test" 'checkit "$RSYNC -avH -e ssh --rsync-path=$RSYNC ${FROM}/ localhost:${TO}" ${FROM}/ ${TO}'

View File

@@ -20,17 +20,17 @@ build_symlinks || test_fail "failed to build symlinks"
[ -f "${todir}/referent" ] || test_fail "referent was not copied"
[ -d "${todir}/from" ] && test_fail "extra level of directories"
if [ -L "${todir}/dangling" ]
if is_a_link "${todir}/dangling"
then
test_fail "dangling symlink was copied"
fi
if [ -L "${todir}/relative" ]
if is_a_link "${todir}/relative"
then
test_fail "relative symlink was copied"
fi
if [ -L "${todir}/absolute" ]
if is_a_link "${todir}/absolute"
then
test_fail "absolute symlink was copied"
fi

29
testsuite/trimslash.test Normal file
View File

@@ -0,0 +1,29 @@
#! /bin/sh
# Copyright (C) 2002 by Martin Pool <mbp@samba.org>
# This program is distributable under the terms of the GNU GPL (see
# COPYING).
# Test tiny function to trim trailing slashes.
. $srcdir/testsuite/rsync.fns
set -x
"$TOOLDIR/trimslash" "/usr/local/bin" "/usr/local/bin/" "/usr/local/bin///" \
"//a//" "////" \
"/Users/Wierd Macintosh Name/// Ooh, translucent plastic/" \
> "$scratchdir/slash.out"
diff -c "$scratchdir/slash.out" - <<EOF
/usr/local/bin
/usr/local/bin
/usr/local/bin
//a
/
/Users/Wierd Macintosh Name/// Ooh, translucent plastic
EOF
exit 0
# last [] may have failed but if we get here then we've won

45
trimslash.c Normal file
View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2002 by Martin Pool
*
* 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.
*/
#include "rsync.h"
/* These are to make syscall.o shut up. */
int dry_run = 0;
int read_only = 1;
int list_only = 0;
/**
* @file trimslash.c
*
* Test harness; not linked into release.
**/
int main(int argc, char **argv)
{
int i;
if (argc <= 1) {
fprintf(stderr, "trimslash: needs at least one argument\n");
return 1;
}
for (i = 1; i < argc; i++) {
trim_trailing_slashes(argv[i]); /* modify in place */
printf("%s\n", argv[i]);
}
return 0;
}

41
util.c
View File

@@ -478,27 +478,47 @@ int robust_rename(char *from, char *to)
static pid_t all_pids[10];
static int num_pids;
/* fork and record the pid of the child */
/** Fork and record the pid of the child. **/
pid_t do_fork(void)
{
pid_t newpid = fork();
if (newpid) {
if (newpid != 0 && newpid != -1) {
all_pids[num_pids++] = newpid;
}
return newpid;
}
/* kill all children */
/**
* Kill all children.
*
* @todo It would be kind of nice to make sure that they are actually
* all our children before we kill them, because their pids may have
* been recycled by some other process. Perhaps when we wait for a
* child, we should remove it from this array. Alternatively we could
* perhaps use process groups, but I think that would not work on
* ancient Unix versions that don't support them.
**/
void kill_all(int sig)
{
int i;
for (i=0;i<num_pids;i++) {
if (all_pids[i] != getpid())
kill(all_pids[i], sig);
for (i = 0; i < num_pids; i++) {
/* Let's just be a little careful where we
* point that gun, hey? See kill(2) for the
* magic caused by negative values. */
pid_t p = all_pids[i];
if (p == getpid())
continue;
if (p <= 0)
continue;
kill(p, sig);
}
}
/* turn a user name into a uid */
int name_to_uid(char *name, uid_t *uid)
{
@@ -866,7 +886,14 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now,
unsigned long diff = msdiff(&start_time, now);
double rate = diff ? (double) (ofs-start_ofs) * 1000.0 / diff / 1024.0 : 0;
const char *units;
double remain = rate ? (double) (size-ofs) / rate / 1000.0: 0.0;
/* 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) {

View File

@@ -1,3 +1,5 @@
READ THIS BEFORE TRYING TO DYNAMICALLY LINK RSYNC AND ZLIB!
zlib has been adapted slightly for use in rsync. Please don't bother
the zlib authors with problems related to the use of zlib in rsync as
any bugs are likely to be our fault and not theirs.
@@ -15,5 +17,15 @@ Specific changes that have been made to zlib for rsync include:
- include rsync.h to ensure that we get a consistent set of includes
for all C code in rsync and to take advantage of autoconf
--
Paul Mackerras and Andrew Tridgell
As a result of the first item, the streams from rsync's version of
zlib are *not compatible* with those produced by the upstream version
of rsync. In other words, if you link rsync against your system's
copy, it will not be able to interoperate with any other version if
the -z option is used. (Sorry. Sometimes standard is better than
better.)
The rsync maintainers hope to fix this problem in the future by either
merging our changes into the upstream version, or backing them out of
rsync in a way that preserves wire compatibility. But in the meantime
this version must be maintained in parallel.