Permalink
Browse files

Don't pass -AX to rsync in t/compare-trees if xattrs aren't supported.

The -AX options won't be available if rsync doesn't report the xattr
capability, so test for that before trying to use them.

Thanks to Yung-Chin Oei <yungchin@yungchin.nl> for the suggested
approach and initial report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
  • Loading branch information...
1 parent 637bf18 commit 7a1c342400d1eabe00bc1ba00eafd64080d21d72 @rlbdv rlbdv committed Sep 11, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 t/compare-trees
View
11 t/compare-trees
@@ -45,7 +45,16 @@ dest="$2"
tmpfile="$(mktemp)"
trap "rm -rf '${tmpfile}'" EXIT
-rsync -niaHAX$verify_content --delete "$src" "$dest" > "${tmpfile}"
+rsync_opts="-niaH$verify_content --delete"
+
+if rsync --version | grep -q xattrs; then
+ rsync_opts="$rsync_opts -AX"
+else
+ echo "Not comparing xattrs/acls (unsupported by available rsync)." 1>&2
+fi
+
+rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
+
if test $(wc -l < "${tmpfile}") != 0; then
echo "Differences between $src and $dest"
cat "${tmpfile}"

0 comments on commit 7a1c342

Please sign in to comment.