X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Fcompare-trees;h=aeaa086a86d1fb92b92bdb902cb34166e42abc44;hb=51476a384daabaa6e2700859d2e4863ec7ca0284;hp=5ef44a29edc396358afb71d73f50639c665a0e26;hpb=0e18f9a22a52fd3a73a83c9a8122fadb790510f9;p=bup.git diff --git a/t/compare-trees b/t/compare-trees index 5ef44a2..aeaa086 100755 --- a/t/compare-trees +++ b/t/compare-trees @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -u + # Test that src and dest trees are as identical as bup is capable of # making them. For now, use rsync -niaHAX ... @@ -49,7 +51,7 @@ if [[ ! "$rsync_version" =~ "ACLs" ]] || [[ "$rsync_version" =~ "no ACLs" ]]; th echo "Not comparing ACLs (not supported by available rsync)" 1>&2 else case $OSTYPE in - cygwin|darwin) + cygwin|darwin|netbsd) echo "Not comparing ACLs (not yet supported on $OSTYPE)" 1>&2 ;; *) @@ -58,16 +60,28 @@ else esac fi +xattrs_available='' if [[ ! "$rsync_version" =~ "xattrs" ]] || [[ "$rsync_version" =~ "no xattrs" ]]; then echo "Not comparing xattrs (not supported by available rsync)" 1>&2 else - rsync_opts="$rsync_opts -X" + xattrs_available=yes fi -rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $? +# Even in dry-run mode, rsync may fail if -X is specified and the +# filesystems don't support xattrs. + +if test "$xattrs_available"; then + rsync $rsync_opts -X "$src" "$dest" > "$tmpfile" + if test $? -ne 0; then + # Try again without -X + rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $? + fi +else + rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $? +fi if test $(wc -l < "$tmpfile") != 0; then - echo "Differences between $src and $dest" + echo "Differences between $src and $dest" 1>&2 cat "$tmpfile" exit 1 fi