Compare commits

...

27 Commits

Author SHA1 Message Date
Wayne Davison
719a29e1cf Preparing for release of 3.0.4pre2 2008-08-02 14:06:31 -07:00
Wayne Davison
4a95d61251 Tweaked the symlink iconv buffer size and fixed a comment. 2008-08-02 13:45:15 -07:00
Wayne Davison
fc088e30c8 When using --iconv, if a server-side receiver can't convert a filename,
it now outputs the name back to the client without mangling the charset.
2008-08-02 10:25:17 -07:00
Wayne Davison
aef51b4c68 Refer to the symlink's contents as "symlink data", not "symlink name". 2008-08-02 10:18:10 -07:00
Wayne Davison
7790ee3684 Added logic to the receiving side to ensure that the --delete-during
code will not delete in a directory prior to receiving an I/O error
for that directory (or not receiving it, as the case may be).
2008-08-02 09:03:49 -07:00
Wayne Davison
ed12c8eb21 Skip new symlink conversion step if the remote rsync is not
new enough to do symlink content conversions.
2008-08-02 07:04:54 -07:00
Wayne Davison
91dd3d0d48 The --iconv option now converts the content of a symlink too. 2008-08-01 19:20:41 -07:00
Wayne Davison
95d1d2a9a4 Fixed a problem with checking for the '.' dir in the first file
list that is transferred.  This fixes a glitch where a failed
--iconv conversion on the receiving side could prevent deletions
from happening in the root-dir of the transfer.
2008-08-01 19:00:21 -07:00
Wayne Davison
a808346dbe Fixed a couple minor problems in util.c:
- Make sure that handle_partial_dir() never returns a truncated fname.
- Make robust_rename() return that it failed to do a cross-device
  copy if the partial-dir could not be created.
2008-08-01 18:00:18 -07:00
Wayne Davison
fa181223d8 Properly handle a failure to create a partial directory, which is
especially important for --delay-updates, particularly when
--remove-source-files was also specified.
2008-08-01 18:00:09 -07:00
Wayne Davison
9ed569486f Output an FERROR* for a general io_error, and an FWARNING for other
io_error flags.
2008-07-31 07:57:55 -07:00
Wayne Davison
2fa069d85f Mention a missing sender-side hash improvment that went out in 3.0.0. 2008-07-30 08:33:35 -07:00
Wayne Davison
a25aed50e6 Make hard-linking work when a device has an st_dev of 0. 2008-07-29 18:08:51 -07:00
Wayne Davison
302e4346c2 Mention some mount options that can interfere with --link-dest. 2008-07-28 18:24:25 -07:00
Wayne Davison
8e5eafccdf Back-porting some manpage improvements. 2008-07-28 17:07:38 -07:00
Wayne Davison
e88b92bade Preparing for release of 3.0.4pre1 2008-07-24 17:03:26 -07:00
Wayne Davison
f8722dba56 Fixed the --fake-super test in the xattrs testsuite when there are
root-level xattrs on the files (e.g. selinux values).
2008-07-24 07:57:57 -07:00
Wayne Davison
ee03cb99d9 Fixed the timeout/flush loop-check logic to work properly with
incremental recursion.
2008-07-23 23:37:11 -07:00
Wayne Davison
92d706a274 Don't interrupt the make if a generated build file didn't really change. 2008-07-23 23:28:57 -07:00
Wayne Davison
581c830c56 A couple xattr fixes for --fake-super. 2008-07-23 23:12:39 -07:00
Wayne Davison
9e58ef45f3 If the user specifies --protocol=29, rsync will avoid sending an -e
option to the server (which is only useful for protocols 30 and above
anyway).  This gives the user an easy way to talk to a restricted
server that has overly restrictive option-checking.
2008-07-23 23:09:15 -07:00
Wayne Davison
05bd05a7a1 Pass --branch option to patch-update script. 2008-07-23 17:13:29 -07:00
Wayne Davison
89b6b4ce4b We only need to deal with local patch branches now. 2008-07-23 14:32:58 -07:00
Wayne Davison
68cdc3b791 Fixed a potential alignment issue in the IRIX ACL code when allocating
the initial struct acl object.  Also, cast mallocs to avoid warnings.
2008-07-22 21:35:21 -07:00
Wayne Davison
209371b891 Fixed a bug in match_hard_links() where an empty directory would try
to allocate 0 bytes of memory (which can fail on some OSes).
2008-07-22 21:34:20 -07:00
Wayne Davison
6fd2662982 Allow a release from a non-master branch. 2008-07-22 09:11:34 -07:00
Wayne Davison
1fdf0302c0 Start the 3.0.4 branch. 2008-07-22 09:11:22 -07:00
27 changed files with 509 additions and 220 deletions

3
.gitignore vendored
View File

@@ -3,10 +3,13 @@
dummy
ID
Makefile
Makefile.old
configure.sh
configure.sh.old
config.cache
config.h
config.h.in
config.h.in.old
config.log
config.status
/proto.h

View File

@@ -126,11 +126,23 @@ conf:
conf_stop: configure.sh config.h.in
configure.sh config.h.in: configure.in aclocal.m4
@if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
@if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
autoconf -o configure.sh
autoheader && touch config.h.in
@echo 'Configure files changed -- perhaps run:'
@echo ' make reconfigure'
@exit 1
@if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
echo "configure.sh is unchanged."; \
rm configure.sh.old; \
fi
@if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
echo "config.h.in is unchanged."; \
rm config.h.in.old; \
fi
@if test -f configure.sh.old -o -f config.h.in.old; then \
echo 'Configure files changed -- perhaps run:'; \
echo ' make reconfigure'; \
exit 1; \
fi
reconfigure: configure.sh
./config.status --recheck
@@ -139,9 +151,15 @@ reconfigure: configure.sh
make_stop: Makefile
Makefile: Makefile.in config.status
@if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
@./config.status
@echo "Makefile updated -- rerun your make command."
@exit 1
@if diff Makefile Makefile.old >/dev/null 2>&1; then \
echo "Makefile is unchanged."; \
rm Makefile.old; \
else \
echo "Makefile updated -- rerun your make command."; \
exit 1; \
fi
proto: proto.h-tstamp
@@ -165,7 +183,7 @@ rsyncd.conf.5: rsyncd.conf.yo
clean: cleantests
rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
rounding rounding.h
rounding rounding.h *.old
cleantests:
rm -rf ./testtmp*

101
NEWS
View File

@@ -1,89 +1,54 @@
NEWS for rsync 3.0.3 (29 Jun 2008)
NEWS for rsync 3.0.4 (UNRELEASED)
Protocol: 30 (unchanged)
Changes since 3.0.2:
Changes since 3.0.3:
BUG FIXES:
- Fixed a wildcard matching problem in the daemon when a module has
"use chroot" enabled.
- Fixed a bug in the hard-linking code where it would sometimes try to
allocate 0 bytes of memory (which fails on some OSes, such as AIX).
- Fixed a crash bug in the hard-link code.
- Fixed the hard-linking of files from a device that has a device number
of 0 (which seems to be a common device number on NetBSD).
- Fixed the sending of xattr directory information when the code finds a
--link-dest or --copy-dest directory with unchanged xattrs -- the
destination directory now gets these unchanged xattrs properly applied.
- Fixed the handling of a --partial-dir that cannot be created. This
particularly impacts the --delay-updates option (since the files cannot
be delayed without a partial-dir), and was potentially destructive if
the --remove-source-files was also specified.
- Fixed an xattr-sending glitch that could cause an "Internal abbrev"
error.
- Fixed a couple issues in the --fake-super handling of xattrs when the
destination files have root-level attributes (e.g. selinux values) that
a non-root copy can't affect.
- Fixed the combination of --xattrs and --backup.
- Improved the keep-alive check in the generator to fire consistently in
incremental-recursion mode when --timeout is enabled.
- The generator no longer allows a '.' dir to be excluded by a daemon-
exclude rule.
- The --iconv option now converts the content of a symlink too, instead
of leaving it in the wrong character-set.
- Fixed deletion handling when copying a single, empty directory (with no
files) to a differently named, non-existent directory.
- When using --iconv, if a filename fails to convert on the receiving side,
this no longer interferes with deletions in the root-dir of the transfer.
- Fixed the conversion of spaces into dashes in the %M log escape.
- When using --iconv, if a server-side receiver can't convert a filename,
it now outputs the name back to the client without mangling the charset.
- Fixed several places in the code that were not returning the right
errno when a function failed.
- Fixed a bug where --delete-during could delete in a directory before it
noticed that the sending side sent an I/O error for that directory.
- Fixed the backing up of a device or special file into a backup dir.
- Fixed a potential alignment issue in the IRIX ACL code when allocating
the initial "struct acl" object. Also, cast mallocs to avoid warnings.
- Moved the setting of the socket options prior to the connect().
- If rsync exits in the middle of a --progress output, it now outputs a
newline to help prevent the progress line from being overwritten.
- Fixed a problem with how a destination path with a trailing slash or
a trailing dot-dir was compared against the daemon excludes.
- Fixed the sending of large (size > 16GB) files when talking to an older
rsync (protocols < 30): we now use a compatible block size limit.
- If a file's length is so huge that we overflow a checksum buffer count
(i.e. several hundred TB), warn the user and avoid sending an invalid
checksum struct over the wire.
- If a source arg is excluded, --relative no longer adds the excluded
arg's implied dirs to the transfer. This fix also made the exclude
check happen in the better place in the sending code.
- Use the overflow_exit() function for overflows, not out_of_memory().
- Improved the code to better handle a system that has only 32-bit file
offsets.
- Changed some errors that were going to stdout to go to stderr.
ENHANCEMENTS:
- The rsyncd.conf manpage now consistently refers to the parameters in
the daemon config file as "parameters".
- The description of the --inplace option was improved.
EXTRAS:
- Added a new script in the support directory, deny-rsync, which allows
an admin to (temporarily) replace the rsync command with a script that
sends an error message to the remote client via the rsync protocol.
- Rsync will avoid sending an -e option to the server if an older protocol
is requested (and thus the option would not be useful). This lets the
user specify the --protocol=29 option to access an overly-restrictive
server that is rejecting the protocol-30 use of -e to the server.
DEVELOPER RELATED:
- Fixed a testcase failure if the tests are run as root and made some
compatibility improvements.
- The Makefile will not halt for just a timestamp change on the Makefile
or the configure files, only for actual changes in content.
- Improved the daemon tests, including checking module comments, the
listing of files, and the ensuring that daemon excludes can't affect
a dot-dir arg.
- Improved some build rules for those that build in a separate directory
from the source, including better install rules for the man pages, and
the fixing of a proto.h-tstamp rule that could make the binaries get
rebuild without cause.
- Improved the testsuite to work around a problem with some utilities
(e.g. cp -p & touch -r) rounding sub-second timestamps.
- Ensure that the early patches don't cause any generated-file hunks to
bleed-over into patches that follow.
- Enhanced the release scripts to be able to handle a branch release.

97
OLDNEWS
View File

@@ -1,3 +1,94 @@
NEWS for rsync 3.0.3 (29 Jun 2008)
Protocol: 30 (unchanged)
Changes since 3.0.2:
BUG FIXES:
- Fixed a wildcard matching problem in the daemon when a module has
"use chroot" enabled.
- Fixed a crash bug in the hard-link code.
- Fixed the sending of xattr directory information when the code finds a
--link-dest or --copy-dest directory with unchanged xattrs -- the
destination directory now gets these unchanged xattrs properly applied.
- Fixed an xattr-sending glitch that could cause an "Internal abbrev"
error.
- Fixed the combination of --xattrs and --backup.
- The generator no longer allows a '.' dir to be excluded by a daemon-
exclude rule.
- Fixed deletion handling when copying a single, empty directory (with no
files) to a differently named, non-existent directory.
- Fixed the conversion of spaces into dashes in the %M log escape.
- Fixed several places in the code that were not returning the right
errno when a function failed.
- Fixed the backing up of a device or special file into a backup dir.
- Moved the setting of the socket options prior to the connect().
- If rsync exits in the middle of a --progress output, it now outputs a
newline to help prevent the progress line from being overwritten.
- Fixed a problem with how a destination path with a trailing slash or
a trailing dot-dir was compared against the daemon excludes.
- Fixed the sending of large (size > 16GB) files when talking to an older
rsync (protocols < 30): we now use a compatible block size limit.
- If a file's length is so huge that we overflow a checksum buffer count
(i.e. several hundred TB), warn the user and avoid sending an invalid
checksum struct over the wire.
- If a source arg is excluded, --relative no longer adds the excluded
arg's implied dirs to the transfer. This fix also made the exclude
check happen in the better place in the sending code.
- Use the overflow_exit() function for overflows, not out_of_memory().
- Improved the code to better handle a system that has only 32-bit file
offsets.
ENHANCEMENTS:
- The rsyncd.conf manpage now consistently refers to the parameters in
the daemon config file as "parameters".
- The description of the --inplace option was improved.
EXTRAS:
- Added a new script in the support directory, deny-rsync, which allows
an admin to (temporarily) replace the rsync command with a script that
sends an error message to the remote client via the rsync protocol.
DEVELOPER RELATED:
- Fixed a testcase failure if the tests are run as root and made some
compatibility improvements.
- Improved the daemon tests, including checking module comments, the
listing of files, and the ensuring that daemon excludes can't affect
a dot-dir arg.
- Improved some build rules for those that build in a separate directory
from the source, including better install rules for the man pages, and
the fixing of a proto.h-tstamp rule that could make the binaries get
rebuild without cause.
- Improved the testsuite to work around a problem with some utilities
(e.g. cp -p & touch -r) rounding sub-second timestamps.
- Ensure that the early patches don't cause any generated-file hunks to
bleed-over into patches that follow.
NEWS for rsync 3.0.2 (8 Apr 2008)
Protocol: 30 (unchanged)
Changes since 3.0.1:
@@ -290,6 +381,11 @@ Changes since 2.6.9:
- Fixed rsync's ability to remove files that are not writable by the file's
owner when rsync is running as the same user.
- When transferring large files, the sender's hashtable of checksums is
kept at a more reasonable state of fullness (no more than 80% full) so
that the scanning of the hashtable will not bog down as the number of
blocks increases.
ENHANCEMENTS:
- A new incremental-recursion algorithm is now used when rsync is talking
@@ -2745,6 +2841,7 @@ Changes since 2.4.6:
Partial Protocol History
RELEASE DATE VER. DATE OF COMMIT* PROTOCOL
?? Aug 2008 3.0.4 30
29 Jun 2008 3.0.3 30
08 Apr 2008 3.0.2 30
03 Apr 2008 3.0.1 30

View File

@@ -57,12 +57,14 @@ extern struct filter_list_struct filter_list;
extern int need_unsorted_flist;
#ifdef ICONV_OPTION
extern iconv_t ic_send, ic_recv;
extern char *iconv_opt;
#endif
/* These index values are for the file-list's extra-attribute array. */
int uid_ndx, gid_ndx, acls_ndx, xattrs_ndx, unsort_ndx;
int receiver_symlink_times = 0; /* receiver can set the time on a symlink */
int sender_symlink_iconv = 0; /* sender should convert symlink content */
#ifdef ICONV_OPTION
int filesfrom_convert = 0;
@@ -70,6 +72,7 @@ int filesfrom_convert = 0;
#define CF_INC_RECURSE (1<<0)
#define CF_SYMLINK_TIMES (1<<1)
#define CF_SYMLINK_ICONV (1<<2)
static const char *client_info;
@@ -248,6 +251,9 @@ void setup_protocol(int f_out,int f_in)
compat_flags = allow_inc_recurse ? CF_INC_RECURSE : 0;
#if defined HAVE_LUTIMES && defined HAVE_UTIMES
compat_flags |= CF_SYMLINK_TIMES;
#endif
#ifdef ICONV_OPTION
compat_flags |= CF_SYMLINK_ICONV;
#endif
write_byte(f_out, compat_flags);
} else
@@ -262,6 +268,11 @@ void setup_protocol(int f_out,int f_in)
#if defined HAVE_LUTIMES && defined HAVE_UTIMES
else
receiver_symlink_times = 1;
#endif
#ifdef ICONV_OPTION
sender_symlink_iconv = iconv_opt && (am_server
? strchr(client_info, 's') != NULL
: !!(compat_flags & CF_SYMLINK_ICONV));
#endif
if (inc_recurse && !allow_inc_recurse) {
/* This should only be able to happen in a batch. */

View File

@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h])
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.59)
RSYNC_VERSION=3.0.3
RSYNC_VERSION=3.0.4pre2
AC_SUBST(RSYNC_VERSION)
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])

View File

@@ -476,7 +476,7 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
XFLG_ANCHORED2ABS);
} else {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
rprintf(FERROR,
"cannot add local filter rules in long-named directory: %s\n",
full_fname(dirbuf));
}

134
flist.c
View File

@@ -67,6 +67,7 @@ extern int protocol_version;
extern int sanitize_paths;
extern int munge_symlinks;
extern int need_unsorted_flist;
extern int sender_symlink_iconv;
extern int unsort_ndx;
extern struct stats stats;
extern char *filesfrom_host;
@@ -375,7 +376,7 @@ int change_pathname(struct file_struct *file, const char *dir, int dirlen)
if (!change_dir(dir, CD_NORMAL)) {
chdir_error:
io_error |= IOERR_GENERAL;
rsyserr(FERROR, errno, "change_dir %s failed", full_fname(dir));
rsyserr(FERROR_XFER, errno, "change_dir %s failed", full_fname(dir));
if (dir != orig_dir)
change_dir(orig_dir, CD_NORMAL);
pathname = NULL;
@@ -386,7 +387,11 @@ int change_pathname(struct file_struct *file, const char *dir, int dirlen)
return 1;
}
static void send_file_entry(int f, const char *fname, struct file_struct *file, int ndx, int first_ndx)
static void send_file_entry(int f, const char *fname, struct file_struct *file,
#ifdef SUPPORT_LINKS
const char *symlink_name, int symlink_len,
#endif
int ndx, int first_ndx)
{
static time_t modtime;
static mode_t mode;
@@ -575,11 +580,9 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
}
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(mode)) {
const char *sl = F_SYMLINK(file);
int len = strlen(sl);
write_varint30(f, len);
write_buf(f, sl, len);
if (symlink_len) {
write_varint30(f, symlink_len);
write_buf(f, symlink_name, symlink_len);
}
#endif
@@ -675,12 +678,12 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
rprintf(FERROR_UTF8,
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), lastname, strerror(errno));
outbuf.len = 0;
}
outbuf.buf[outbuf.len] = '\0';
thisname[outbuf.len] = '\0';
}
#endif
@@ -811,6 +814,13 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
linkname_len - 1);
overflow_exit("recv_file_entry");
}
#ifdef ICONV_OPTION
/* We don't know how much extra room we need to convert
* the as-yet-unread symlink data, so let's hope that a
* double-size buffer is plenty. */
if (sender_symlink_iconv)
linkname_len *= 2;
#endif
if (munge_symlinks)
linkname_len += SYMLINK_PREFIX_LEN;
}
@@ -945,14 +955,40 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
if (first_hlink_ndx >= flist->ndx_start) {
struct file_struct *first = flist->files[first_hlink_ndx - flist->ndx_start];
memcpy(bp, F_SYMLINK(first), linkname_len);
} else if (munge_symlinks) {
strlcpy(bp, SYMLINK_PREFIX, linkname_len);
bp += SYMLINK_PREFIX_LEN;
linkname_len -= SYMLINK_PREFIX_LEN;
read_sbuf(f, bp, linkname_len - 1);
} else {
read_sbuf(f, bp, linkname_len - 1);
if (sanitize_paths)
if (munge_symlinks) {
strlcpy(bp, SYMLINK_PREFIX, linkname_len);
bp += SYMLINK_PREFIX_LEN;
linkname_len -= SYMLINK_PREFIX_LEN;
}
#ifdef ICONV_OPTION
if (sender_symlink_iconv) {
xbuf outbuf, inbuf;
alloc_len = linkname_len;
linkname_len /= 2;
/* Read the symlink data into the end of our double-sized
* buffer and then convert it into the right spot. */
INIT_XBUF(inbuf, bp + alloc_len - linkname_len,
linkname_len - 1, (size_t)-1);
read_sbuf(f, inbuf.buf, inbuf.len);
INIT_XBUF(outbuf, bp, 0, alloc_len);
if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
io_error |= IOERR_GENERAL;
rprintf(FERROR_XFER,
"[%s] cannot convert symlink data for: %s (%s)\n",
who_am_i(), full_fname(thisname), strerror(errno));
bp = (char*)file->basename;
*bp++ = '\0';
outbuf.len = 0;
}
bp[outbuf.len] = '\0';
} else
#endif
read_sbuf(f, bp, linkname_len - 1);
if (sanitize_paths && !munge_symlinks && *bp)
sanitize_path(bp, bp, "", lastdir_depth, SP_DEFAULT);
}
}
@@ -1045,7 +1081,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) {
io_error |= IOERR_GENERAL;
rprintf(FINFO, "skipping overly long name: %s\n", fname);
rprintf(FERROR_XFER, "skipping overly long name: %s\n", fname);
return NULL;
}
clean_fname(thisname, 0);
@@ -1213,8 +1249,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
if (protocol_version >= 28
? (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
: S_ISREG(st.st_mode)) {
tmp_dev = st.st_dev;
tmp_ino = st.st_ino;
tmp_dev = (int64)st.st_dev + 1;
tmp_ino = (int64)st.st_ino;
} else
tmp_dev = 0;
}
@@ -1310,10 +1346,27 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
if (f >= 0) {
char fbuf[MAXPATHLEN];
#ifdef SUPPORT_LINKS
const char *symlink_name;
int symlink_len;
#ifdef ICONV_OPTION
char symlink_buf[MAXPATHLEN];
#endif
#endif
#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
stat_x sx;
#endif
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
symlink_name = F_SYMLINK(file);
symlink_len = strlen(symlink_name);
} else {
symlink_name = NULL;
symlink_len = 0;
}
#endif
#ifdef ICONV_OPTION
if (ic_send != (iconv_t)-1) {
xbuf outbuf, inbuf;
@@ -1326,19 +1379,38 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
if (iconvbufs(ic_send, &inbuf, &outbuf, 0) < 0)
goto convert_error;
outbuf.size += 2;
outbuf.buf[outbuf.len++] = '/';
fbuf[outbuf.len++] = '/';
}
INIT_XBUF_STRLEN(inbuf, (char*)file->basename);
if (iconvbufs(ic_send, &inbuf, &outbuf, 0) < 0) {
convert_error:
io_error |= IOERR_GENERAL;
rprintf(FINFO,
rprintf(FERROR_XFER,
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), f_name(file, fbuf), strerror(errno));
return NULL;
}
outbuf.buf[outbuf.len] = '\0';
fbuf[outbuf.len] = '\0';
#ifdef SUPPORT_LINKS
if (symlink_len && sender_symlink_iconv) {
INIT_XBUF(inbuf, (char*)symlink_name, symlink_len, (size_t)-1);
INIT_CONST_XBUF(outbuf, symlink_buf);
if (iconvbufs(ic_send, &inbuf, &outbuf, 0) < 0) {
io_error |= IOERR_GENERAL;
f_name(file, fbuf);
rprintf(FERROR_XFER,
"[%s] cannot convert symlink data for: %s (%s)\n",
who_am_i(), full_fname(fbuf), strerror(errno));
return NULL;
}
symlink_buf[outbuf.len] = '\0';
symlink_name = symlink_buf;
symlink_len = outbuf.len;
}
#endif
} else
#endif
f_name(file, fbuf);
@@ -1363,7 +1435,11 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
}
#endif
send_file_entry(f, fbuf, file, flist->used, flist->ndx_start);
send_file_entry(f, fbuf, file,
#ifdef SUPPORT_LINKS
symlink_name, symlink_len,
#endif
flist->used, flist->ndx_start);
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
@@ -1558,14 +1634,14 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
continue;
if (strlcpy(p, dname, remainder) >= remainder) {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
rprintf(FERROR_XFER,
"cannot send long-named file %s\n",
full_fname(fbuf));
continue;
}
if (dname[0] == '\0') {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
rprintf(FERROR_XFER,
"cannot send file with empty name in %s\n",
full_fname(fbuf));
continue;
@@ -2164,7 +2240,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
if (inc_recurse) {
send_dir_depth = 1;
add_dirs_to_tree(-1, flist, dir_count);
if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0)
if (!file_total || strcmp(flist->sorted[flist->low]->basename, ".") != 0)
flist->parent_ndx = -1;
flist_done_allocating(flist);
if (send_dir_ndx < 0) {
@@ -2232,8 +2308,8 @@ struct file_list *recv_file_list(int f)
maybe_emit_filelist_progress(flist->used);
if (verbose > 2) {
rprintf(FINFO, "recv_file_name(%s)\n",
f_name(file, NULL));
char *name = f_name(file, NULL);
rprintf(FINFO, "recv_file_name(%s)\n", NS(name));
}
}
file_total += flist->used;
@@ -2288,7 +2364,7 @@ struct file_list *recv_file_list(int f)
else
io_error |= read_int(f);
} else if (inc_recurse && flist->ndx_start == 1) {
if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0)
if (!file_total || strcmp(flist->sorted[flist->low]->basename, ".") != 0)
flist->parent_ndx = -1;
}

View File

@@ -89,6 +89,7 @@ extern int unsort_ndx;
extern int max_delete;
extern int force_delete;
extern int one_file_system;
extern int check_for_io_err;
extern struct stats stats;
extern dev_t filesystem_dev;
extern mode_t orig_umask;
@@ -108,7 +109,7 @@ static int deletion_count = 0; /* used to implement --max-delete */
static int deldelay_size = 0, deldelay_cnt = 0;
static char *deldelay_buf = NULL;
static int deldelay_fd = -1;
static int lull_mod;
static int loopchk_limit;
static int dir_tweaking;
static int symlink_timeset_failed_flags;
static int need_retouch_dir_times;
@@ -2058,10 +2059,13 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
&& cmp_time(st.st_mtime, file->modtime) != 0)
set_modtime(fname, file->modtime, file->mode);
}
if (allowed_lull && !(counter % lull_mod))
maybe_send_keepalive();
else if (!(counter & 0xFF))
maybe_flush_socket(0);
if (counter >= loopchk_limit) {
if (allowed_lull)
maybe_send_keepalive();
else
maybe_flush_socket(0);
counter = 0;
}
}
}
@@ -2148,7 +2152,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
void generate_files(int f_out, const char *local_name)
{
int i, ndx;
int i, ndx, next_loopchk = 0;
char fbuf[MAXPATHLEN];
int itemizing;
enum logcode code;
@@ -2174,7 +2178,7 @@ void generate_files(int f_out, const char *local_name)
solo_file = local_name;
dir_tweaking = !(list_only || solo_file || dry_run);
need_retouch_dir_times = preserve_times > 1;
lull_mod = allowed_lull * 5;
loopchk_limit = allowed_lull ? allowed_lull * 5 : 200;
symlink_timeset_failed_flags = ITEM_REPORT_TIME
| (protocol_version >= 30 || !am_server ? ITEM_REPORT_TIMEFAIL : 0);
implied_dirs_are_missing = relative_paths && !implied_dirs && protocol_version < 30;
@@ -2234,6 +2238,10 @@ void generate_files(int f_out, const char *local_name)
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
/* We must be sure we've had a chance to receive an I/O
* error for this directory before we delete in it. */
while (check_for_io_err && !cur_flist->next)
wait_for_receiver();
delete_in_dir(fbuf, fp, &dirdev);
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
@@ -2258,10 +2266,13 @@ void generate_files(int f_out, const char *local_name)
check_for_finished_files(itemizing, code, 0);
if (allowed_lull && !(i % lull_mod))
maybe_send_keepalive();
else if (!(i & 0xFF))
maybe_flush_socket(0);
if (i + cur_flist->ndx_start >= next_loopchk) {
if (allowed_lull)
maybe_send_keepalive();
else
maybe_flush_socket(0);
next_loopchk += loopchk_limit;
}
}
if (!inc_recurse) {
@@ -2329,7 +2340,7 @@ void generate_files(int f_out, const char *local_name)
touch_up_dirs(dir_flist, -1);
if (max_delete >= 0 && deletion_count > max_delete) {
rprintf(FINFO,
rprintf(FWARNING,
"Deletions stopped due to --max-delete limit (%d skipped)\n",
deletion_count - max_delete);
io_error |= IOERR_DEL_LIMIT;

View File

@@ -179,7 +179,7 @@ static void match_gnums(int32 *ndx_list, int ndx_count)
* to first when we're done. */
void match_hard_links(struct file_list *flist)
{
if (!list_only) {
if (!list_only && flist->used) {
int i, ndx_count = 0;
int32 *ndx_list;

9
io.c
View File

@@ -64,6 +64,7 @@ const char phase_unknown[] = "unknown";
int ignore_timeout = 0;
int batch_fd = -1;
int msgdone_cnt = 0;
int check_for_io_err = 0;
/* Ignore an EOF error if non-zero. See whine_about_eof(). */
int kluge_around_eof = 0;
@@ -380,6 +381,8 @@ static void read_msg_fd(void)
len = tag & 0xFFFFFF;
tag = (tag >> 24) - MPLEX_BASE;
check_for_io_err = 0;
switch (tag) {
case MSG_DONE:
if (len < 0 || len > 1 || !am_generator) {
@@ -414,6 +417,9 @@ static void read_msg_fd(void)
}
flist = recv_file_list(fd);
flist->parent_ndx = IVAL(buf,0);
/* If the sender is going to send us an MSG_IO_ERROR value, it
* will always be the very next message following MSG_FLIST. */
check_for_io_err = 1;
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links)
match_hard_links(flist);
@@ -449,6 +455,7 @@ static void read_msg_fd(void)
got_flist_entry_status(FES_NO_SEND, buf);
break;
case MSG_ERROR_SOCKET:
case MSG_ERROR_UTF8:
case MSG_CLIENT:
if (!am_generator)
goto invalid_msg;
@@ -1061,6 +1068,8 @@ static int readfd_unbuffered(int fd, char *buf, size_t len)
msg_bytes = tag & 0xFFFFFF;
tag = (tag >> 24) - MPLEX_BASE;
check_for_io_err = 0;
switch (tag) {
case MSG_DATA:
if (msg_bytes > iobuf_in_siz) {

View File

@@ -551,7 +551,7 @@ SMB_ACL_T sys_acl_init(int count)
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof(struct SMB_ACL_T) + count * sizeof(struct acl))) == NULL) {
if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof (struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -1007,7 +1007,7 @@ SMB_ACL_T sys_acl_init(int count)
* acl[] array, this actually allocates an ACL with room
* for (count+1) entries
*/
if ((a = SMB_MALLOC(sizeof(struct SMB_ACL_T) + count * sizeof(struct acl))) == NULL) {
if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof(struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -1638,14 +1638,14 @@ SMB_ACL_T sys_acl_init(int count)
return NULL;
}
if ((a = SMB_MALLOC(sizeof(struct SMB_ACL_T) + sizeof(struct acl))) == NULL) {
if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + sizeof (struct acl))) == NULL) {
errno = ENOMEM;
return NULL;
}
a->next = -1;
a->freeaclp = False;
a->aclp = (struct acl *)(&a->aclp + sizeof(struct acl *));
a->aclp = (struct acl *)((char *)a + sizeof a[0]);
a->aclp->acl_cnt = 0;
return a;

6
log.c
View File

@@ -257,13 +257,17 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
if (am_server && msg_fd_out >= 0) {
assert(!is_utf8);
/* Pass the message to our sibling. */
/* Pass the message to our sibling in native charset. */
send_msg((enum msgcode)code, buf, len, 0);
return;
}
if (code == FERROR_SOCKET) /* This gets simplified for a non-sibling. */
code = FERROR;
else if (code == FERROR_UTF8) {
is_utf8 = 1;
code = FERROR;
}
if (code == FCLIENT)
code = FINFO;

5
main.c
View File

@@ -63,8 +63,11 @@ extern int whole_file;
extern int read_batch;
extern int write_batch;
extern int batch_fd;
extern int flist_eof;
extern int filesfrom_fd;
extern int delete_during;
extern int connect_timeout;
extern int check_for_io_err;
extern pid_t cleanup_child_pid;
extern unsigned int module_dirlen;
extern struct stats stats;
@@ -759,6 +762,8 @@ static int do_recv(int f_in, int f_out, char *local_name)
exit_cleanup(RERR_IPC);
}
check_for_io_err = inc_recurse && delete_during && !flist_eof;
if (pid == 0) {
close(error_pipe[0]);
if (f_in != f_out)

View File

@@ -1808,22 +1808,36 @@ void server_options(char **args, int *argc_p)
if (do_compression)
argstr[x++] = 'z';
/* We make use of the -e option to let the server know about any
* pre-release protocol version && some behavior flags. */
argstr[x++] = 'e';
#if SUBPROTOCOL_VERSION != 0
if (protocol_version == PROTOCOL_VERSION) {
x += snprintf(argstr+x, sizeof argstr - x,
"%d.%d", PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
} else
#endif
argstr[x++] = '.';
set_allow_inc_recurse();
if (allow_inc_recurse)
argstr[x++] = 'i';
#if defined HAVE_LUTIMES && defined HAVE_UTIMES
argstr[x++] = 'L';
/* Checking the pre-negotiated value allows --protocol=29 override. */
if (protocol_version >= 30) {
/* We make use of the -e option to let the server know about
* any pre-release protocol version && some behavior flags. */
argstr[x++] = 'e';
#if SUBPROTOCOL_VERSION != 0
if (protocol_version == PROTOCOL_VERSION) {
x += snprintf(argstr+x, sizeof argstr - x,
"%d.%d",
PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
} else
#endif
argstr[x++] = '.';
if (allow_inc_recurse)
argstr[x++] = 'i';
#if defined HAVE_LUTIMES && defined HAVE_UTIMES
argstr[x++] = 'L';
#endif
#ifdef ICONV_OPTION
argstr[x++] = 's';
#endif
}
if (x >= (int)sizeof argstr) { /* Not possible... */
rprintf(FERROR, "argstr overflow in server_options().\n");
exit_cleanup(RERR_MALLOC);
}
argstr[x] = '\0';
args[ac++] = argstr;
@@ -2008,7 +2022,6 @@ void server_options(char **args, int *argc_p)
* and it may be an older version that doesn't know this
* option, so don't send it if client is the sender.
*/
int i;
for (i = 0; i < basis_dir_cnt; i++) {
args[ac++] = dest_option;
args[ac++] = basis_dir[i];
@@ -2048,6 +2061,11 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
if (ac > MAX_SERVER_ARGS) { /* Not possible... */
rprintf(FERROR, "argc overflow in server_options().\n");
exit_cleanup(RERR_MALLOC);
}
*argc_p = ac;
return;

View File

@@ -1,9 +1,9 @@
Summary: A fast, versatile, remote (and local) file-copying tool
Name: rsync
Version: 3.0.3
%define fullversion %{version}
Release: 1
%define srcdir src
Version: 3.0.4
%define fullversion %{version}pre2
Release: 0.1.pre2
%define srcdir src-previews
Group: Applications/Internet
Source0: http://rsync.samba.org/ftp/rsync/%{srcdir}/rsync-%{fullversion}.tar.gz
#Source1: http://rsync.samba.org/ftp/rsync/%{srcdir}/rsync-patches-%{fullversion}.tar.gz
@@ -66,8 +66,8 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man5/rsyncd.conf.5*
%changelog
* Sun Jun 29 2008 Wayne Davison <wayned@samba.org>
Released 3.0.3.
* Sat Aug 02 2008 Wayne Davison <wayned@samba.org>
Released 3.0.4pre2.
* Fri Mar 21 2008 Wayne Davison <wayned@samba.org>
Added installation of /etc/xinetd.d/rsync file and some commented-out

View File

@@ -13,6 +13,7 @@ my $tmp_dir = "patches.$$";
&Getopt::Long::Configure('bundling');
&usage if !&GetOptions(
'branch|b=s' => \( my $master_branch = 'master' ),
'skip-check' => \( my $skip_branch_check ),
'shell|s' => \( my $launch_shell ),
'gen:s' => \( my $incl_generated_files ),
@@ -53,15 +54,13 @@ if ($incl_generated_files) {
}
our $last_touch = time;
my(%patches, %local_patch);
my %patches;
# Start by finding all patches so that we can load all possible parents.
open(PIPE, '-|', 'git', 'branch', '-a') or die $!;
open(PIPE, '-|', 'git', 'branch', '-l') or die $!;
while (<PIPE>) {
if (m# origin/patch/(.*)#) {
if (m# patch/(.*)#) {
$patches{$1} = 1;
} elsif (m# patch/(.*)#) {
$patches{$1} = $local_patch{$1} = 1;
}
}
close PIPE;
@@ -70,19 +69,23 @@ my @patches = sort keys %patches;
my(%parent, %description);
foreach my $patch (@patches) {
my $branch = ($local_patch{$patch} ? '' : 'origin/') . "patch/$patch";
my $branch = "patch/$patch";
my $desc = '';
open(PIPE, '-|', 'git', 'diff', '-U1000', "master...$branch", '--', "PATCH.$patch") or die $!;
open(PIPE, '-|', 'git', 'diff', '-U1000', "$master_branch...$branch", '--', "PATCH.$patch") or die $!;
while (<PIPE>) {
last if /^@@ /;
}
while (<PIPE>) {
next unless s/^[ +]//;
if (m#patch -p1 <patches/(\S+)\.diff# && $1 ne $patch) {
$parent{$patch} = $1;
my $parent = $parent{$patch} = $1;
if (!$patches{$parent}) {
die "Parent of $patch is not a local branch: $parent\n";
}
}
$desc .= $_;
}
close PIPE;
$description{$patch} = $desc;
}
@@ -90,8 +93,11 @@ if (@ARGV) {
# Limit the list of patches to actually process based on @ARGV.
@patches = ( );
foreach (@ARGV) {
s{^(patches|patch|origin/patch)/} {};
s{^patch(es)?/} {};
s{\.diff$} {};
if (!$patches{$_}) {
die "Local branch not available for patch: $_\n";
}
push(@patches, $_);
}
}
@@ -123,17 +129,13 @@ sub update_patch
}
$parent = "patch/$parent";
} else {
$parent = 'master';
$parent = $master_branch;
}
print "======== $patch ========\n";
sleep 1 while $incl_generated_files && $last_touch >= time;
if ($local_patch{$patch}) {
system "git checkout patch/$patch" and return 0;
} else {
system "git checkout --track -b patch/$patch origin/patch/$patch" and return 0;
}
system "git checkout patch/$patch" and return 0;
my $ok = system("git merge $parent") == 0;
if (!$ok || $launch_shell) {
@@ -174,8 +176,13 @@ sub update_patch
close PIPE;
if ($incl_generated_files) {
$parent =~ s#.*/##;
open(PIPE, '-|', 'diff', '-up', "$tmp_dir/$parent", "$tmp_dir/$patch") or die $!;
my $parent_dir;
if ($parent eq $master_branch) {
$parent_dir = 'master';
} else {
($parent_dir) = $parent =~ m{([^/]+)$};
}
open(PIPE, '-|', 'diff', '-up', "$tmp_dir/$parent_dir", "$tmp_dir/$patch") or die $!;
while (<PIPE>) {
s#^(diff -up) $tmp_dir/[^/]+/(.*?) $tmp_dir/[^/]+/(.*)#$1 a/$2 b/$3#o;
s#^\Q---\E $tmp_dir/[^/]+/([^\t]+)\t.*#--- a/$1#o;

View File

@@ -7,6 +7,7 @@ use strict;
# ~/samba-rsync-ftp dir will be ready to be rsynced to samba.org.
use Cwd;
use Getopt::Long;
use Term::ReadKey;
use Date::Format;
@@ -14,6 +15,13 @@ my $dest = $ENV{HOME} . '/samba-rsync-ftp';
my $passfile = $ENV{HOME} . '/.rsyncpass';
my $path = $ENV{PATH};
&Getopt::Long::Configure('bundling');
&usage if !&GetOptions(
'branch|b=s' => \( my $master_branch = 'master' ),
'help|h' => \( my $help_opt ),
);
&usage if $help_opt;
my $now = time;
my $cl_today = time2str('* %a %b %d %Y', $now);
my $year = time2str('%Y', $now);
@@ -56,7 +64,7 @@ open(IN, '-|', 'git status') or die $!;
my $status = join('', <IN>);
close IN;
die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/;
die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/;
die "The checkout is not on the $master_branch branch.\n" unless $status =~ /^# On branch $master_branch\n/;
my $confversion;
open(IN, '<', 'configure.in') or die $!;
@@ -221,7 +229,7 @@ print $break, <<EOT;
About to:
- commit all version changes
- merge the master branch into the patch/* branches
- merge the $master_branch branch into the patch/* branches
- update the files in the "patches" dir and OPTIONALLY
(if you type 'y') to launch a shell for each patch
@@ -232,11 +240,11 @@ my $ans = <STDIN>;
system "git commit -a -m 'Preparing for release of $version'" and exit 1;
print "Updating files in \"patches\" dir ...\n";
system "packaging/patch-update";
system "packaging/patch-update --branch=$master_branch";
if ($ans =~ /^y/i) {
print "\nVisiting all \"patch/*\" branches ...\n";
system "packaging/patch-update --shell";
system "packaging/patch-update --branch=$master_branch --shell";
}
print $break, <<EOT;
@@ -305,7 +313,7 @@ system "fakeroot tar czf $srctar_file rsync-$version; rm -rf rsync-$version";
print "Updating files in \"rsync-$version/patches\" dir ...\n";
mkdir("rsync-$version", 0755);
mkdir("rsync-$version/patches", 0755);
system "packaging/patch-update --skip-check --gen=rsync-$version/patches";
system "packaging/patch-update --skip-check --branch=$master_branch --gen=rsync-$version/patches";
print "Creating $pattar_file ...\n";
system "fakeroot tar chzf $pattar_file rsync-$version/patches; rm -rf rsync-$version";
@@ -343,3 +351,15 @@ Local changes are done. When you're satisfied, push the git repository
and rsync the release files. Remember to announce the release on *BOTH*
rsync-announce@lists.samba.org and rsync@lists.samba.org (and the web)!
EOT
exit;
sub usage
{
die <<EOT;
Usage: release-rsync [OPTIONS]
-b, --branch=BRANCH The branch to release (default: master)
-h, --help Display this help message
EOT
}

View File

@@ -698,23 +698,30 @@ int recv_files(int f_in, char *local_name)
do_unlink(partialptr);
handle_partial_dir(partialptr, PDIR_DELETE);
}
} else if (keep_partial && partialptr
&& handle_partial_dir(partialptr, PDIR_CREATE)) {
if (!finish_transfer(partialptr, fnametmp, fnamecmp, NULL,
file, recv_ok, !partial_dir))
} else if (keep_partial && partialptr) {
if (!handle_partial_dir(partialptr, PDIR_CREATE)) {
rprintf(FERROR,
"Unable to create partial-dir for %s -- discarding %s.\n",
local_name ? local_name : f_name(file, NULL),
recv_ok ? "completed file" : "partial file");
do_unlink(fnametmp);
recv_ok = -1;
} else if (!finish_transfer(partialptr, fnametmp, fnamecmp, NULL,
file, recv_ok, !partial_dir))
recv_ok = -1;
else if (delay_updates && recv_ok) {
bitbag_set_bit(delayed_bits, ndx);
recv_ok = 2;
}
} else {
partialptr = NULL;
} else
partialptr = NULL;
} else
do_unlink(fnametmp);
}
cleanup_disable();
switch (recv_ok) {
case 2:
break;
case 1:
if (remove_source_files || inc_recurse
|| (preserve_hard_links && F_IS_HLINKED(file)))

15
rsync.c
View File

@@ -48,6 +48,8 @@ extern int inplace;
extern int flist_eof;
extern int keep_dirlinks;
extern int make_backups;
extern int delete_during;
extern int check_for_io_err;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
@@ -253,8 +255,15 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
while (1) {
ndx = read_ndx(f_in);
if (ndx >= 0)
if (ndx >= 0) {
if (check_for_io_err) {
/* Let generator know there was no I/O error. */
send_msg_int(MSG_IO_ERROR, 0);
check_for_io_err = 0;
}
break;
}
check_for_io_err = 0;
if (ndx == NDX_DONE)
return ndx;
if (!inc_recurse || am_sender)
@@ -286,6 +295,10 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
flist->parent_ndx = ndx;
stop_flist_forward();
verbose = save_verbose;
/* If the sender is going to send us an MSG_IO_ERROR value, it
* will always be the very next message following a file list. */
if (delete_during)
check_for_io_err = 1;
}
iflags = protocol_version >= 29 ? read_shortint(f_in)

View File

@@ -211,6 +211,7 @@ enum logcode {
FERROR_XFER=1, FINFO=2, /* sent over socket for any protocol */
FERROR=3, FWARNING=4, /* sent over socket for protocols >= 30 */
FERROR_SOCKET=5, FLOG=6, /* only sent via receiver -> generator pipe */
FERROR_UTF8=8, /* only sent via receiver -> generator pipe */
FCLIENT=7 /* never transmitted (e.g. server converts to FINFO) */
};
@@ -221,6 +222,7 @@ enum msgcode {
MSG_ERROR_XFER=FERROR_XFER, MSG_INFO=FINFO, /* remote logging */
MSG_ERROR=FERROR, MSG_WARNING=FWARNING, /* protocol-30 remote logging */
MSG_ERROR_SOCKET=FERROR_SOCKET, /* sibling logging */
MSG_ERROR_UTF8=FERROR_UTF8, /* sibling logging */
MSG_LOG=FLOG, MSG_CLIENT=FCLIENT, /* sibling logging */
MSG_REDO=9, /* reprocess indicated flist index */
MSG_FLIST=20, /* extra file list over sibling socket */

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsync)(1)(29 Jun 2008)()()
manpage(rsync)(1)(2 Aug 2008)()()
manpagename(rsync)(a fast, versatile, remote (and local) file-copying tool)
manpagesynopsis()
@@ -464,9 +464,9 @@ dit(bf(--version)) print the rsync version number and exit.
dit(bf(-v, --verbose)) This option increases the amount of information you
are given during the transfer. By default, rsync works silently. A
single bf(-v) will give you information about what files are being
transferred and a brief summary at the end. Two bf(-v) flags will give you
transferred and a brief summary at the end. Two bf(-v) options will give you
information on what files are being skipped and slightly more
information at the end. More than two bf(-v) flags should only be used if
information at the end. More than two bf(-v) options should only be used if
you are debugging rsync.
Note that the names of the transferred files that are output are done using
@@ -480,7 +480,7 @@ any way. See the bf(--out-format) option for more details.
dit(bf(-q, --quiet)) This option decreases the amount of information you
are given during the transfer, notably suppressing information messages
from the remote server. This flag is useful when invoking rsync from
from the remote server. This option is useful when invoking rsync from
cron.
dit(bf(--no-motd)) This option affects the information that is output
@@ -1117,7 +1117,7 @@ directories that are being synchronized. You must have asked rsync to
send the whole directory (e.g. "dir" or "dir/") without using a wildcard
for the directory's contents (e.g. "dir/*") since the wildcard is expanded
by the shell and rsync thus gets a request to transfer individual files, not
the files' parent directory. Files that are excluded from transfer are
the files' parent directory. Files that are excluded from the transfer are
also excluded from being deleted unless you use the bf(--delete-excluded)
option or mark the rules as only matching on the sending side (see the
include/exclude modifiers in the FILTER RULES section).
@@ -1139,7 +1139,7 @@ destination. You can override this with the bf(--ignore-errors) option.
The bf(--delete) option may be combined with one of the --delete-WHEN options
without conflict, as well as bf(--delete-excluded). However, if none of the
--delete-WHEN options are specified, rsync will choose the
bf(--delete-during) algorithm when talking to an rsync 3.0.0 or newer, and
bf(--delete-during) algorithm when talking to rsync 3.0.0 or newer, and
the bf(--delete-before) algorithm when talking to an older rsync. See also
bf(--delete-delay) and bf(--delete-after).
@@ -1156,19 +1156,26 @@ algorithm that requires rsync to scan all the files in the transfer into
memory at once (see bf(--recursive)).
dit(bf(--delete-during, --del)) Request that the file-deletions on the
receiving side be done incrementally as the transfer happens. This is
a faster method than choosing the before- or after-transfer algorithm,
but it is only supported beginning with rsync version 2.6.4.
receiving side be done incrementally as the transfer happens. The
per-directory delete scan is done right before each directory is checked
for updates, so it behaves like a more efficient bf(--delete-before),
including doing the deletions prior to any per-directory filter files
being updated. This option was first added in rsync version 2.6.4.
See bf(--delete) (which is implied) for more details on file-deletion.
dit(bf(--delete-delay)) Request that the file-deletions on the receiving
side be computed during the transfer, and then removed after the transfer
completes. If the number of removed files overflows an internal buffer, a
side be computed during the transfer (like bf(--delete-during)), and then
removed after the transfer completes. This is useful when combined with
bf(--delay-updates) and/or bf(--fuzzy), and is more efficient than using
bf(--delete-after) (but can behave differently, since bf(--delete-after)
computes the deletions in a separate pass after all updates are done).
If the number of removed files overflows an internal buffer, a
temporary file will be created on the receiving side to hold the names (it
is removed while open, so you shouldn't see it during the transfer). If
the creation of the temporary file fails, rsync will try to fall back to
using bf(--delete-after) (which it cannot do if bf(--recursive) is doing an
incremental scan).
See bf(--delete) (which is implied) for more details on file-deletion.
dit(bf(--delete-after)) Request that the file-deletions on the receiving
side be done after the transfer has completed. This is useful if you
@@ -1522,6 +1529,11 @@ An example:
quote(tt( rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/))
If file's aren't linking, double-check their attributes. Also check if some
attributes are getting forced outside of rsync's control, such a mount option
that squishes root to a single user, or mounts a removable drive with generic
ownership (such as OS X's "Ignore ownership on this volume" option).
Beginning in version 2.6.4, multiple bf(--link-dest) directories may be
provided, which will cause rsync to search the list in the order specified
for an exact match.
@@ -1718,22 +1730,22 @@ you are talking to a recent enough rsync that it logs deletions instead of
outputting them as a verbose message).
dit(bf(--out-format=FORMAT)) This allows you to specify exactly what the
rsync client outputs to the user on a per-update basis. The format is a text
string containing embedded single-character escape sequences prefixed with
a percent (%) character. For a list of the possible escape characters, see
the "log format" setting in the rsyncd.conf manpage.
rsync client outputs to the user on a per-update basis. The format is a
text string containing embedded single-character escape sequences prefixed
with a percent (%) character. A default format of "%n%L" is assumed if
bf(-v) is specified (which reports the name
of the file and, if the item is a link, where it points). For a full list
of the possible escape characters, see the "log format" setting in the
rsyncd.conf manpage.
Specifying this option will mention each file, dir, etc. that gets updated
in a significant way (a transferred file, a recreated symlink/device, or a
touched directory). In addition, if the itemize-changes escape (%i) is
included in the string, the logging of names increases to mention any
item that is changed in any way (as long as the receiving side is at least
2.6.4). See the bf(--itemize-changes) option for a description of the
output of "%i".
The bf(--verbose) option implies a format of "%n%L", but you can use
bf(--out-format) without bf(--verbose) if you like, or you can override
the format of its per-file output using this option.
Specifying the bf(--out-format) option
will mention each file, dir, etc. that gets updated in a significant
way (a transferred file, a recreated symlink/device, or a touched
directory). In addition, if the itemize-changes escape (%i) is included in
the string (e.g. if the bf(--itemize-changes) option was used), the logging
of names increases to mention any item that is changed in any way (as long
as the receiving side is at least 2.6.4). See the bf(--itemize-changes)
option for a description of the output of "%i".
Rsync will output the out-format string prior to a file's transfer unless
one of the transfer-statistic escapes is requested, in which case the
@@ -2093,7 +2105,7 @@ by the server and defaults to the current code(time()). This option
is used to set a specific checksum seed, which is useful for
applications that want repeatable block and file checksums, or
in the case where the user wants a more random checksum seed.
Note that setting NUM to 0 causes rsync to use the default of code(time())
Setting NUM to 0 causes rsync to use the default of code(time())
for checksum seed.
enddit()
@@ -2882,7 +2894,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
manpagesection(VERSION)
This man page is current for version 3.0.3 of rsync.
This man page is current for version 3.0.4pre2 of rsync.
manpagesection(INTERNAL OPTIONS)

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsyncd.conf)(5)(29 Jun 2008)()()
manpage(rsyncd.conf)(5)(2 Aug 2008)()()
manpagename(rsyncd.conf)(configuration file for rsync in daemon mode)
manpagesynopsis()
@@ -101,12 +101,11 @@ who like to tune their systems to the utmost degree. You can set all
sorts of socket options which may make transfers faster (or
slower!). Read the man page for the code(setsockopt()) system call for
details on some of the options you may be able to set. By default no
special socket options are set. These settings are superseded by the
bf(--sockopts) command-line option.
special socket options are set. These settings can also be specified
via the bf(--sockopts) command-line option.
enddit()
manpagesection(MODULE PARAMETERS)
After the global parameters you should define a number of modules, each
@@ -213,7 +212,8 @@ to the exclude setting for the module so that
a user can't try to create it.
Note: rsync makes no attempt to verify that any pre-existing symlinks in
the hierarchy are as safe as you want them to be. If you setup an rsync
the module's hierarchy are as safe as you want them to be (unless, of
course, it just copied in the whole hierarchy). If you setup an rsync
daemon on a new area or locally add symlinks, you can manually protect your
symlinks from being abused by prefixing "/rsyncd-munged/" to the start of
every symlink's value. There is a perl script in the support directory
@@ -256,7 +256,7 @@ the transfer. If this value is set on a per-module basis instead of
globally, the global log will still contain any authorization failures
or config-file error messages.
If the daemon fails to open to specified file, it will fall back to
If the daemon fails to open the specified file, it will fall back to
using syslog and output an error about the failure. (Note that the
failure to open the specified log file used to be a fatal error.)
@@ -509,7 +509,7 @@ quote(itemization(
it() %a the remote IP address
it() %b the number of bytes actually transferred
it() %B the permission bits of the file (e.g. rwxrwxrwt)
it() %c the checksum bytes received for this file (only when sending)
it() %c the total size of the block checksums received for the basis file (only when sending)
it() %f the filename (long form on sender; no trailing "/")
it() %G the gid of the file (decimal) or "DEFAULT"
it() %h the remote host name
@@ -700,7 +700,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
manpagesection(VERSION)
This man page is current for version 3.0.3 of rsync.
This man page is current for version 3.0.4pre2 of rsync.
manpagesection(CREDITS)

View File

@@ -281,7 +281,7 @@ void send_files(int f_in, int f_out)
if (!(s = receive_sums(f_in))) {
io_error |= IOERR_GENERAL;
rprintf(FERROR, "receive_sums failed\n");
rprintf(FERROR_XFER, "receive_sums failed\n");
exit_cleanup(RERR_PROTOCOL);
}
@@ -309,7 +309,7 @@ void send_files(int f_in, int f_out)
/* map the local file */
if (do_fstat(fd, &st) != 0) {
io_error |= IOERR_GENERAL;
rsyserr(FERROR, errno, "fstat failed");
rsyserr(FERROR_XFER, errno, "fstat failed");
free_sums(s);
close(fd);
exit_cleanup(RERR_PROTOCOL);

View File

@@ -99,8 +99,12 @@ rm -rf "$todir"
xset user.nice 'this is nice, but different' file1
checkit "$RSYNC -aiX --fake-super . ../chk" "$fromdir" "$chkdir"
cd "$chkdir"
xls $files >"$scratchdir/xattrs.txt"
cd "$fromdir"
checkit "$RSYNC -aiX --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir"
cd "$todir"

10
util.c
View File

@@ -437,7 +437,7 @@ int robust_rename(const char *from, const char *to, const char *partialptr,
case EXDEV:
if (partialptr) {
if (!handle_partial_dir(partialptr,PDIR_CREATE))
return -1;
return -2;
to = partialptr;
}
if (copy_file(from, to, -1, mode, 0) != 0)
@@ -1112,12 +1112,16 @@ int handle_partial_dir(const char *fname, int create)
STRUCT_STAT st;
int statret = do_lstat(dir, &st);
if (statret == 0 && !S_ISDIR(st.st_mode)) {
if (do_unlink(dir) < 0)
if (do_unlink(dir) < 0) {
*fn = '/';
return 0;
}
statret = -1;
}
if (statret < 0 && do_mkdir(dir, 0700) < 0)
if (statret < 0 && do_mkdir(dir, 0700) < 0) {
*fn = '/';
return 0;
}
} else
do_rmdir(dir);
*fn = '/';

View File

@@ -210,7 +210,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
size_t datum_len, name_offset;
char *name, *ptr;
#ifdef HAVE_LINUX_XATTRS
int user_only = am_sender ? 0 : !am_root;
int user_only = am_sender ? 0 : am_root <= 0;
#endif
rsync_xa *rxa;
int count;
@@ -294,7 +294,7 @@ int copy_xattrs(const char *source, const char *dest)
size_t datum_len;
char *name, *ptr;
#ifdef HAVE_LINUX_XATTRS
int user_only = am_sender ? 0 : !am_root;
int user_only = am_root <= 0;
#endif
/* This puts the name list into the "namebuf" buffer. */
@@ -745,6 +745,9 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
ssize_t list_len;
size_t i, len;
char *name, *ptr, sum[MAX_DIGEST_LEN];
#ifdef HAVE_LINUX_XATTRS
int user_only = am_root <= 0;
#endif
size_t name_len;
int ret = 0;
@@ -820,8 +823,8 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
#ifdef HAVE_LINUX_XATTRS
/* We always ignore the system namespace, and non-root
* ignores everything but the user namespace. */
if (am_root ? HAS_PREFIX(name, SYSTEM_PREFIX)
: !HAS_PREFIX(name, USER_PREFIX))
if (user_only ? !HAS_PREFIX(name, USER_PREFIX)
: HAS_PREFIX(name, SYSTEM_PREFIX))
continue;
#endif
if (am_root < 0 && name_len > RPRE_LEN