diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-03-16 06:21:17 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-03-16 06:21:17 +0000 |
commit | 2cb44f5717d21032d1982c708588b291fa821124 (patch) | |
tree | 26ad5ac5b15563c0862c56145698611391696c6f /net-misc | |
parent | set license to gpl-3 #212173 (diff) | |
download | gentoo-2-2cb44f5717d21032d1982c708588b291fa821124.tar.gz gentoo-2-2cb44f5717d21032d1982c708588b291fa821124.tar.bz2 gentoo-2-2cb44f5717d21032d1982c708588b291fa821124.zip |
Add some fixes from upstream.
(Portage version: 2.2_pre2)
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/rsync/ChangeLog | 9 | ||||
-rw-r--r-- | net-misc/rsync/files/rsync-3.0.0-NULL-config.patch | 62 | ||||
-rw-r--r-- | net-misc/rsync/files/rsync-3.0.0-acl-crash.patch | 110 | ||||
-rw-r--r-- | net-misc/rsync/files/rsync-3.0.0-fake-super-attrs.patch | 243 | ||||
-rw-r--r-- | net-misc/rsync/rsync-3.0.0-r1.ebuild | 70 |
5 files changed, 493 insertions, 1 deletions
diff --git a/net-misc/rsync/ChangeLog b/net-misc/rsync/ChangeLog index 16f778e46709..25d01ef741f3 100644 --- a/net-misc/rsync/ChangeLog +++ b/net-misc/rsync/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-misc/rsync # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/ChangeLog,v 1.148 2008/03/01 22:13:43 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/ChangeLog,v 1.149 2008/03/16 06:21:17 vapier Exp $ + +*rsync-3.0.0-r1 (16 Mar 2008) + + 16 Mar 2008; Mike Frysinger <vapier@gentoo.org> + +files/rsync-3.0.0-NULL-config.patch, +files/rsync-3.0.0-acl-crash.patch, + +files/rsync-3.0.0-fake-super-attrs.patch, +rsync-3.0.0-r1.ebuild: + Add some fixes from upstream. *rsync-3.0.0 (01 Mar 2008) diff --git a/net-misc/rsync/files/rsync-3.0.0-NULL-config.patch b/net-misc/rsync/files/rsync-3.0.0-NULL-config.patch new file mode 100644 index 000000000000..35ec07f6b1af --- /dev/null +++ b/net-misc/rsync/files/rsync-3.0.0-NULL-config.patch @@ -0,0 +1,62 @@ +commit d1c06c2180f337deaa059fc408fcca4f4770a585 +Author: Wayne Davison <wayned@samba.org> +Date: Mon Mar 3 18:33:11 2008 -0800 + + Fixing a problem with a NULL config_file pointer when accessing + a single-use daemon without no --config option specified. Added + a test to ensure that this doesn't break in the future. + +diff --git a/clientserver.c b/clientserver.c +index a330111..7c15e3b 100644 +--- a/clientserver.c ++++ b/clientserver.c +@@ -864,6 +864,17 @@ static void send_listing(int fd) + io_printf(fd,"@RSYNCD: EXIT\n"); + } + ++static int load_config(int globals_only) ++{ ++ if (!config_file) { ++ if (am_server && am_root <= 0) ++ config_file = RSYNCD_USERCONF; ++ else ++ config_file = RSYNCD_SYSCONF; ++ } ++ return lp_load(config_file, globals_only); ++} ++ + /* this is called when a connection is established to a client + and we want to start talking. The setup of the system is done from + here */ +@@ -879,7 +890,7 @@ int start_daemon(int f_in, int f_out) + * might cause log-file output to occur. This ensures that the + * "log file" param gets honored for the 2 non-forked use-cases + * (when rsync is run by init and run by a remote shell). */ +- if (!lp_load(config_file, 0)) ++ if (!load_config(0)) + exit_cleanup(RERR_SYNTAX); + + addr = client_addr(f_in); +@@ -988,13 +999,6 @@ static void become_daemon(void) + + int daemon_main(void) + { +- if (!config_file) { +- if (am_server && am_root <= 0) +- config_file = RSYNCD_USERCONF; +- else +- config_file = RSYNCD_SYSCONF; +- } +- + if (is_a_socket(STDIN_FILENO)) { + int i; + +@@ -1009,7 +1013,7 @@ int daemon_main(void) + return start_daemon(STDIN_FILENO, STDIN_FILENO); + } + +- if (!lp_load(config_file, 1)) { ++ if (!load_config(1)) { + fprintf(stderr, "Failed to parse config file: %s\n", config_file); + exit_cleanup(RERR_SYNTAX); + } diff --git a/net-misc/rsync/files/rsync-3.0.0-acl-crash.patch b/net-misc/rsync/files/rsync-3.0.0-acl-crash.patch new file mode 100644 index 000000000000..cb3ad74ccc22 --- /dev/null +++ b/net-misc/rsync/files/rsync-3.0.0-acl-crash.patch @@ -0,0 +1,110 @@ +commit d6c9c3319b191d196c323174c0dc11c834ae9e75 +Author: Wayne Davison <wayned@samba.org> +Date: Sat Mar 15 00:43:31 2008 -0700 + + - Fixed a crash bug when backing up files with ACLs enabled and we + create a directory in the backup-path area. + - Fixed a bug where make_file() was setting F_PATHNAME() on the + receiving side. + - A non-pool (temp-memory) file structure now stores the size of + its extra_cnt value in the F_DEPTH() int so that unmake_file() + can always be sure of how to free() the memory. + - The ACL-preserving code no longer allocates 4 more bytes per + file entry than it needs. + - Got rid of a useless adding of the symlink length to "bp". + +diff --git a/flist.c b/flist.c +index 665fa19..489d92c 100644 +--- a/flist.c ++++ b/flist.c +@@ -819,9 +819,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist, + #endif + + #ifdef SUPPORT_ACLS +- /* We need one or two index int32s when we're preserving ACLs. */ +- if (preserve_acls) +- extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN; ++ /* Directories need an extra int32 for the default ACL. */ ++ if (preserve_acls && S_ISDIR(mode)) ++ extra_len += EXTRA_LEN; + #endif + + if (always_checksum && S_ISREG(mode)) +@@ -854,7 +854,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist, + bp += FILE_STRUCT_LEN; + + memcpy(bp, basename, basename_len); +- bp += basename_len + linkname_len; /* skip space for symlink too */ ++ bp += basename_len; + + #ifdef SUPPORT_HARD_LINKS + if (xflags & XMIT_HLINKED) +@@ -919,7 +919,6 @@ static struct file_struct *recv_file_entry(struct file_list *flist, + + #ifdef SUPPORT_LINKS + if (linkname_len) { +- bp = (char*)file->basename + basename_len; + 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); +@@ -1123,8 +1122,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, + pool = dir_flist->file_pool; + } else + pool = flist->file_pool; +- } else ++ } else { ++#ifdef SUPPORT_ACLS ++ /* Directories need an extra int32 for the default ACL. */ ++ if (preserve_acls && S_ISDIR(st.st_mode)) ++ extra_len += EXTRA_LEN; ++#endif + pool = NULL; ++ } + + if (verbose > 2) { + rprintf(FINFO, "[%s] make_file(%s,*,%d)\n", +@@ -1172,7 +1177,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, + bp += FILE_STRUCT_LEN; + + memcpy(bp, basename, basename_len); +- bp += basename_len + linkname_len; /* skip space for symlink too */ ++ bp += basename_len; + + #ifdef SUPPORT_HARD_LINKS + if (preserve_hard_links && flist && flist->prev) { +@@ -1210,16 +1215,17 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, + file->dirname = lastdir; + + #ifdef SUPPORT_LINKS +- if (linkname_len) { +- bp = (char*)file->basename + basename_len; ++ if (linkname_len) + memcpy(bp, linkname, linkname_len); +- } + #endif + + if (always_checksum && am_sender && S_ISREG(st.st_mode)) + file_checksum(thisname, tmp_sum, st.st_size); + +- F_PATHNAME(file) = pathname; ++ if (am_sender) ++ F_PATHNAME(file) = pathname; ++ else if (!pool) ++ F_DEPTH(file) = extra_len / EXTRA_LEN; + + /* This code is only used by the receiver when it is building + * a list of files for a delete pass. */ +@@ -1255,12 +1261,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, + /* Only called for temporary file_struct entries created by make_file(). */ + void unmake_file(struct file_struct *file) + { +- int extra_cnt = file_extra_cnt + LEN64_BUMP(file); +-#if EXTRA_ROUNDING > 0 +- if (extra_cnt & EXTRA_ROUNDING) +- extra_cnt = (extra_cnt | EXTRA_ROUNDING) + 1; +-#endif +- free(REQ_EXTRA(file, extra_cnt)); ++ free(REQ_EXTRA(file, F_DEPTH(file))); + } + + static struct file_struct *send_file_name(int f, struct file_list *flist, diff --git a/net-misc/rsync/files/rsync-3.0.0-fake-super-attrs.patch b/net-misc/rsync/files/rsync-3.0.0-fake-super-attrs.patch new file mode 100644 index 000000000000..e11960a97ee4 --- /dev/null +++ b/net-misc/rsync/files/rsync-3.0.0-fake-super-attrs.patch @@ -0,0 +1,243 @@ +commit cbbd8e2e8bf72aa46c84c7de43e19da40f040fa7 +Author: Wayne Davison <wayned@samba.org> +Date: Fri Mar 7 15:23:39 2008 -0800 + + The --fake-super option conflicts with -XX (which copies internal + rsync xattrs literally). + +diff --git a/clientserver.c b/clientserver.c +index 7c15e3b..6bcbc81 100644 +--- a/clientserver.c ++++ b/clientserver.c +@@ -32,6 +32,7 @@ extern int am_daemon; + extern int am_root; + extern int rsync_port; + extern int ignore_errors; ++extern int preserve_xattrs; + extern int kluge_around_eof; + extern int daemon_over_rsh; + extern int sanitize_paths; +@@ -745,9 +746,11 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host) + if (write_batch < 0) + dry_run = 1; + +- if (lp_fake_super(i)) ++ if (lp_fake_super(i)) { ++ if (preserve_xattrs > 1) ++ preserve_xattrs = 1; + am_root = -1; +- else if (am_root < 0) /* Treat --fake-super from client as --super. */ ++ } else if (am_root < 0) /* Treat --fake-super from client as --super. */ + am_root = 2; + + if (filesfrom_fd == 0) +diff --git a/options.c b/options.c +index 7972121..4ac8846 100644 +--- a/options.c ++++ b/options.c +@@ -1314,7 +1314,13 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain) + } + #endif + +-#ifndef SUPPORT_XATTRS ++#ifdef SUPPORT_XATTRS ++ if (am_root < 0 && preserve_xattrs > 1) { ++ snprintf(err_buf, sizeof err_buf, ++ "--fake-super conflicts with -XX\n"); ++ return 0; ++ } ++#else + if (am_root < 0) { + snprintf(err_buf, sizeof err_buf, + "--fake-super requires an rsync with extended attributes enabled\n"); +commit d724dd186ed6a2d66fa13a9357ce91e459d39e8c +Author: Wayne Davison <wayned@samba.org> +Date: Fri Mar 7 16:16:29 2008 -0800 + + Fixed the interaction of --fake-super with --link-dest & --xattrs. + Fixed the munging of non-user namespace xattrs w/--fake-super. + Fixed the sorting of received xattrs when name-munging occurs. + Added xattr tests to verify that these things stay fixed. + +diff --git a/testsuite/xattrs.test b/testsuite/xattrs.test +index 97c5f8d..66c3e75 100644 +--- a/testsuite/xattrs.test ++++ b/testsuite/xattrs.test +@@ -20,6 +20,7 @@ case "`xattr 2>&1`" in + xls() { + xattr -l "${@}" + } ++ RUSR='rsync' + ;; + *) + xset() { +@@ -31,6 +32,7 @@ case "`xattr 2>&1`" in + xls() { + getfattr -d "${@}" + } ++ RUSR='user.rsync' + ;; + esac + +@@ -65,13 +67,15 @@ xset user.long 'a long attribute for our new file that tests to ensure that this + xset user.foo 'new foo' foo/file3 foo/bar/file5 + xset user.bar 'new bar' foo/file3 foo/bar/file5 + xset user.long 'this is also a long attribute that will be truncated in the initial data send' foo/file3 foo/bar/file5 +-xset user.equal 'this long attribute should remain the same and not need to be transferred' foo/file3 foo/bar/file5 ++xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' foo/file3 foo/bar/file5 ++xset $RUSR.equal 'this short' foo/file3 foo/bar/file5 + + xset user.short 'old short' "$chkdir/file1" + xset user.extra 'remove me' "$chkdir/file1" + + xset user.foo 'old foo' "$chkdir/foo/file3" +-xset user.equal 'this long attribute should remain the same and not need to be transferred' "$chkdir/foo/file3" ++xset $RUSR.equal 'this long attribute should remain the same and not need to be transferred' "$chkdir/foo/file3" ++xset $RUSR.equal 'this short' "$chkdir/foo/file3" + + xls $files >"$scratchdir/xattrs.txt" + +@@ -95,10 +99,17 @@ xls $files >"$scratchdir/xattrs.txt" + + rm -rf "$todir" + +-checkit "$RSYNC -aiX --link-dest=../chk . ../to" "$chkdir" "$todir" ++checkit "$RSYNC -aiX --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir" + + cd "$todir" + xls $files | diff $diffopt "$scratchdir/xattrs.txt" - + ++sed -n -e '/\.\/file1$/d' -e '/^[^ ]* *[^ ]* *[^ ]* *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff" ++if [ -s "$scratchdir/ls-diff" ]; then ++ echo "Missing hard links on:" ++ cat "$scratchdir/ls-diff" ++ exit 1 ++fi ++ + # The script would have aborted on error, so getting here means we've won. + exit 0 +diff --git a/xattrs.c b/xattrs.c +index a436572..53363bd 100644 +--- a/xattrs.c ++++ b/xattrs.c +@@ -62,9 +62,12 @@ extern int checksum_seed; + #endif + #define RPRE_LEN ((int)sizeof RSYNC_PREFIX - 1) + +-#define XSTAT_ATTR RSYNC_PREFIX "%stat" +-#define XACC_ACL_ATTR RSYNC_PREFIX "%aacl" +-#define XDEF_ACL_ATTR RSYNC_PREFIX "%dacl" ++#define XSTAT_SUFFIX "stat" ++#define XSTAT_ATTR RSYNC_PREFIX "%" XSTAT_SUFFIX ++#define XACC_ACL_SUFFIX "aacl" ++#define XACC_ACL_ATTR RSYNC_PREFIX "%" XACC_ACL_SUFFIX ++#define XDEF_ACL_SUFFIX "dacl" ++#define XDEF_ACL_ATTR RSYNC_PREFIX "%" XDEF_ACL_SUFFIX + + typedef struct { + char *datum, *name; +@@ -231,7 +234,10 @@ static int rsync_xal_get(const char *fname, item_list *xalp) + if (name_len > RPRE_LEN && name[RPRE_LEN] == '%' + && HAS_PREFIX(name, RSYNC_PREFIX)) { + if ((am_sender && preserve_xattrs < 2) +- || (am_root < 0 && strcmp(name, XSTAT_ATTR) == 0)) ++ || (am_root < 0 ++ && (strcmp(name+RPRE_LEN+1, XSTAT_SUFFIX) == 0 ++ || strcmp(name+RPRE_LEN+1, XACC_ACL_SUFFIX) == 0 ++ || strcmp(name+RPRE_LEN+1, XDEF_ACL_SUFFIX) == 0))) + continue; + } + +@@ -253,14 +259,6 @@ static int rsync_xal_get(const char *fname, item_list *xalp) + } else + name_offset = datum_len; + +-#ifdef HAVE_LINUX_XATTRS +- if (am_root < 0 && name_len > RPRE_LEN && name[RPRE_LEN] != '%' +- && HAS_PREFIX(name, RSYNC_PREFIX)) { +- name += RPRE_LEN; +- name_len -= RPRE_LEN; +- } +-#endif +- + rxa = EXPAND_ITEM_LIST(xalp, rsync_xa, RSYNC_XAL_INITIAL); + rxa->name = ptr + name_offset; + memcpy(rxa->name, name, name_len); +@@ -352,25 +350,33 @@ int send_xattr(stat_x *sxp, int f) + int count = sxp->xattr->count; + write_varint(f, count); + for (rxa = sxp->xattr->items; count--; rxa++) { ++ int name_len = rxa->name_len; ++ const char *name = rxa->name; ++ /* Strip the rsync prefix from disguised namespaces. */ ++ if ( + #ifdef HAVE_LINUX_XATTRS +- write_varint(f, rxa->name_len); ++ am_root < 0 ++#endif ++ && name_len > RPRE_LEN && name[RPRE_LEN] != '%' ++ && HAS_PREFIX(name, RSYNC_PREFIX)) { ++ name += RPRE_LEN; ++ name_len -= RPRE_LEN; ++ } ++#ifndef HAVE_LINUX_XATTRS ++ else { ++ /* Put everything else in the user namespace. */ ++ name_len += UPRE_LEN; ++ } ++#endif ++ write_varint(f, name_len); + write_varint(f, rxa->datum_len); +- write_buf(f, rxa->name, rxa->name_len); +-#else +- /* We strip the rsync prefix from disguised namespaces +- * and put everything else in the user namespace. */ +- if (HAS_PREFIX(rxa->name, RSYNC_PREFIX) +- && rxa->name[RPRE_LEN] != '%') { +- write_varint(f, rxa->name_len - RPRE_LEN); +- write_varint(f, rxa->datum_len); +- write_buf(f, rxa->name + RPRE_LEN, rxa->name_len - RPRE_LEN); +- } else { +- write_varint(f, rxa->name_len + UPRE_LEN); +- write_varint(f, rxa->datum_len); ++#ifndef HAVE_LINUX_XATTRS ++ if (name_len > rxa->name_len) { + write_buf(f, USER_PREFIX, UPRE_LEN); +- write_buf(f, rxa->name, rxa->name_len); ++ name_len -= UPRE_LEN; + } + #endif ++ write_buf(f, name, name_len); + if (rxa->datum_len > MAX_FULL_DATUM) + write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN); + else +@@ -574,6 +580,11 @@ void receive_xattr(struct file_struct *file, int f) + { + static item_list temp_xattr = EMPTY_ITEM_LIST; + int count, num; ++#ifdef HAVE_LINUX_XATTRS ++ int need_sort = 0; ++#else ++ int need_sort = 1; ++#endif + int ndx = read_varint(f); + + if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) { +@@ -624,6 +635,7 @@ void receive_xattr(struct file_struct *file, int f) + name -= RPRE_LEN; + name_len += RPRE_LEN; + memcpy(name, RSYNC_PREFIX, RPRE_LEN); ++ need_sort = 1; + } + #else + /* This OS only has a user namespace, so we either +@@ -655,6 +667,9 @@ void receive_xattr(struct file_struct *file, int f) + rxa->num = num; + } + ++ if (need_sort && count > 1) ++ qsort(temp_xattr.items, count, sizeof (rsync_xa), rsync_xal_compare_names); ++ + ndx = rsync_xal_l.count; /* pre-incremented count */ + rsync_xal_store(&temp_xattr); /* adds item to rsync_xal_l */ + diff --git a/net-misc/rsync/rsync-3.0.0-r1.ebuild b/net-misc/rsync/rsync-3.0.0-r1.ebuild new file mode 100644 index 000000000000..b17483c8ed94 --- /dev/null +++ b/net-misc/rsync/rsync-3.0.0-r1.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/rsync-3.0.0-r1.ebuild,v 1.1 2008/03/16 06:21:17 vapier Exp $ + +inherit eutils flag-o-matic toolchain-funcs autotools + +DESCRIPTION="File transfer program to keep remote files into sync" +HOMEPAGE="http://rsync.samba.org/" +SRC_URI="http://rsync.samba.org/ftp/rsync/${P/_/}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="acl ipv6 static xattr xinetd" + +DEPEND=">=dev-libs/popt-1.5 + acl? ( kernel_linux? ( sys-apps/acl ) ) + xattr? ( kernel_linux? ( sys-apps/attr ) ) + xinetd? ( sys-apps/xinetd )" + +S=${WORKDIR}/${P/_/} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-acl-crash.patch + epatch "${FILESDIR}"/${P}-NULL-config.patch + epatch "${FILESDIR}"/${P}-fake-super-attrs.patch +} + +src_compile() { + use static && append-ldflags -static + econf \ + --without-included-popt \ + $(use_enable acl acl-support) \ + $(use_enable xattr xattr-support) \ + $(use_enable ipv6) \ + --with-rsyncd-conf=/etc/rsyncd.conf \ + || die + emake || die "emake failed" +} + +pkg_preinst() { + if [[ -e ${ROOT}/etc/rsync/rsyncd.conf ]] && [[ ! -e ${ROOT}/etc/rsyncd.conf ]] ; then + mv "${ROOT}"/etc/rsync/rsyncd.conf "${ROOT}"/etc/rsyncd.conf + rm -f "${ROOT}"/etc/rsync/.keep + rmdir "${ROOT}"/etc/rsync >& /dev/null + fi +} + +src_install() { + emake DESTDIR="${D}" install || die "make install failed" + newconfd "${FILESDIR}"/rsyncd.conf.d rsyncd + newinitd "${FILESDIR}"/rsyncd.init.d rsyncd + dodoc NEWS OLDNEWS README TODO tech_report.tex + insinto /etc + doins "${FILESDIR}"/rsyncd.conf + if use xinetd ; then + insinto /etc/xinetd.d + newins "${FILESDIR}"/rsyncd.xinetd rsyncd + fi +} + +pkg_postinst() { + ewarn "The rsyncd.conf file has been moved for you to /etc/rsyncd.conf" + echo + ewarn "Please make sure you do NOT disable the rsync server running" + ewarn "in a chroot. Please check /etc/rsyncd.conf and make sure" + ewarn "it says: use chroot = yes" +} |