- We need to affect the --link-dest option to avoid hard-linking two files
that differ in their xattrs (when --xattrs was specified).
- - Mac OS X support should probably escape names that don't begin with "user."
- or "system." so that the xattr names can be stored on non-macs.
-
--- old/Makefile.in
+++ new/Makefile.in
@@ -28,13 +28,13 @@ VERSION=@VERSION@
transfer. The resulting value is treated as though it was the permissions
--- old/xattr.c
+++ new/xattr.c
-@@ -0,0 +1,346 @@
+@@ -0,0 +1,367 @@
+/*
+ * Extended Attribute support for rsync.
+ * Written by Jay Fenlason, vaguely based on the ACLs patch.
+static item_list empty_xattr = EMPTY_ITEM_LIST;
+static item_list rsync_xal_l = EMPTY_ITEM_LIST;
+
++#ifdef HAVE_OSX_XATTRS
++static char unique_prefix[] = "user.0S%."; /* OSX */
++static int upre_len = sizeof unique_prefix - 1;
++#endif
++
+/* ------------------------------------------------------------------------- */
+
+static void rsync_xal_free(item_list *xalp)
+ write_byte(f, 'X');
+ write_int(f, count);
+ for (rxa = sxp->xattr->items; count--; rxa++) {
-+ write_int(f, rxa->name_len);
-+ write_int(f, rxa->datum_len);
++#ifdef HAVE_OSX_XATTRS
++ if (strncmp(rxa->name, "user.", 5) != 0
++ && strncmp(rxa->name, "system.", 7) != 0) {
++ write_int(f, rxa->name_len + upre_len);
++ write_int(f, rxa->datum_len);
++ write_buf(f, unique_prefix, upre_len);
++ } else
++#endif
++ {
++ write_int(f, rxa->name_len);
++ write_int(f, rxa->datum_len);
++ }
+ write_buf(f, rxa->name, rxa->name_len);
+ write_buf(f, rxa->datum, rxa->datum_len);
+ }
+ rxa->datum_len = datum_len;
+ rxa->name = ptr;
+ rxa->datum = ptr + name_len;
++#ifdef HAVE_OSX_XATTRS
++ if (strncmp(rxa->name, unique_prefix, upre_len) == 0) {
++ rxa->name_len -= upre_len;
++ memmove(rxa->name, rxa->name + upre_len, rxa->name_len);
++ }
++#endif
+ }
+ ndx = rsync_xal_l.count; /* pre-incremented count */
+ rsync_xal_store(&temp_xattr); /* adds item to rsync_xal_l */