Fixed failing hunks.
[rsync/rsync-patches.git] / xattrs.diff
index ac26057..4214ca9 100644 (file)
@@ -16,7 +16,7 @@ To use this patch, run these commands for a successful build:
                            protocol_version);
                        exit_cleanup(RERR_PROTOCOL);
                }
--              if (preserve_xattrs) {
+-              if (preserve_xattrs && !local_server) {
 -                      rprintf(FERROR,
 -                          "--xattrs requires protocol 30 or higher"
 -                          " (negotiated %d).\n",
@@ -26,19 +26,6 @@ To use this patch, run these commands for a successful build:
        }
  
        if (delete_mode && !(delete_before+delete_during+delete_after)) {
---- old/testsuite/xattrs.test
-+++ new/testsuite/xattrs.test
-@@ -9,10 +9,6 @@
- $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync is configured without xattr support"
--case "$RSYNC" in
--*protocol=29*) test_skipped "xattr support requires protocol 30" ;;
--esac
--
- case "`xattr 2>&1`" in
- *--list:*)
-     xset() {
 --- old/xattrs.c
 +++ new/xattrs.c
 @@ -20,6 +20,7 @@
@@ -80,7 +67,7 @@ To use this patch, run these commands for a successful build:
        int ndx = find_matching_xattr(sxp->xattr);
  
 -      /* Send 0 (-1 + 1) to indicate that literal xattr data follows. */
--      write_abbrevint(f, ndx + 1);
+-      write_varint(f, ndx + 1);
 +      if (protocol_version < 30) {
 +              if (ndx < 0)
 +                      write_byte(f, 'X');
@@ -90,36 +77,36 @@ To use this patch, run these commands for a successful build:
 +              }
 +      } else {
 +              /* Send 0 (-1 + 1) to indicate that literal xattr data follows. */
-+              write_abbrevint(f, ndx + 1);
++              write_varint(f, ndx + 1);
 +      }
  
        if (ndx < 0) {
                rsync_xa *rxa;
                int count = sxp->xattr->count;
--              write_abbrevint(f, count);
-+              write_abbrevint30(f, count);
+-              write_varint(f, count);
++              write_varint30(f, count);
                for (rxa = sxp->xattr->items; count--; rxa++) {
  #ifdef HAVE_LINUX_XATTRS
--                      write_abbrevint(f, rxa->name_len);
--                      write_abbrevint(f, rxa->datum_len);
-+                      write_abbrevint30(f, rxa->name_len);
-+                      write_abbrevint30(f, rxa->datum_len);
+-                      write_varint(f, rxa->name_len);
+-                      write_varint(f, rxa->datum_len);
++                      write_varint30(f, rxa->name_len);
++                      write_varint30(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_abbrevint(f, rxa->name_len - RPRE_LEN);
--                              write_abbrevint(f, rxa->datum_len);
-+                              write_abbrevint30(f, rxa->name_len - RPRE_LEN);
-+                              write_abbrevint30(f, rxa->datum_len);
+-                              write_varint(f, rxa->name_len - RPRE_LEN);
+-                              write_varint(f, rxa->datum_len);
++                              write_varint30(f, rxa->name_len - RPRE_LEN);
++                              write_varint30(f, rxa->datum_len);
                                write_buf(f, rxa->name + RPRE_LEN, rxa->name_len - RPRE_LEN);
                        } else {
--                              write_abbrevint(f, rxa->name_len + UPRE_LEN);
--                              write_abbrevint(f, rxa->datum_len);
-+                              write_abbrevint30(f, rxa->name_len + UPRE_LEN);
-+                              write_abbrevint30(f, rxa->datum_len);
+-                              write_varint(f, rxa->name_len + UPRE_LEN);
+-                              write_varint(f, rxa->datum_len);
++                              write_varint30(f, rxa->name_len + UPRE_LEN);
++                              write_varint30(f, rxa->datum_len);
                                write_buf(f, USER_PREFIX, UPRE_LEN);
                                write_buf(f, rxa->name, rxa->name_len);
                        }
@@ -162,11 +149,11 @@ To use this patch, run these commands for a successful build:
  {
        static item_list temp_xattr = EMPTY_ITEM_LIST;
        int count;
--      int ndx = read_abbrevint(f);
+-      int ndx = read_varint(f);
 +      int ndx;
 +
 +      if (protocol_version >= 30)
-+              ndx = read_abbrevint(f);
++              ndx = read_varint(f);
 +      else {
 +              int tag = read_byte(f);
 +              if (tag == 'x')
@@ -186,8 +173,8 @@ To use this patch, run these commands for a successful build:
                return;
        }
        
--      if ((count = read_abbrevint(f)) != 0) {
-+      if ((count = read_abbrevint30(f)) != 0) {
+-      if ((count = read_varint(f)) != 0) {
++      if ((count = read_varint30(f)) != 0) {
                (void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
                temp_xattr.count = 0;
        }
@@ -195,11 +182,11 @@ To use this patch, run these commands for a successful build:
        while (count--) {
                char *ptr, *name;
                rsync_xa *rxa;
--              size_t name_len = read_abbrevint(f);
--              size_t datum_len = read_abbrevint(f);
+-              size_t name_len = read_varint(f);
+-              size_t datum_len = read_varint(f);
 -              size_t dget_len = datum_len > MAX_FULL_DATUM ? 1 + MAX_DIGEST_LEN : datum_len;
-+              size_t name_len = read_abbrevint30(f);
-+              size_t datum_len = read_abbrevint30(f);
++              size_t name_len = read_varint30(f);
++              size_t datum_len = read_varint30(f);
 +              size_t dget_len = datum_len > MAX_FULL_DATUM && protocol_version >= 30
 +                              ? 1 + MAX_DIGEST_LEN : datum_len;
  #ifdef HAVE_LINUX_XATTRS