From: Rob Browning Date: Tue, 11 Sep 2012 00:36:18 +0000 (-0500) Subject: Don't pass -AX to rsync in t/compare-trees if xattrs aren't supported. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=7a1c342400d1eabe00bc1ba00eafd64080d21d72;p=packages%2Fb%2Fbup.git 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 for the suggested approach and initial report. Signed-off-by: Rob Browning Reviewed-by: Zoran Zaric --- diff --git a/t/compare-trees b/t/compare-trees index b7fd28e..30b6dae 100755 --- a/t/compare-trees +++ b/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}"