+xattrs_available=''
+if [[ ! "$rsync_version" =~ "xattrs" ]] || [[ "$rsync_version" =~ "no xattrs" ]]; then
+ echo "Not comparing xattrs (not supported by available rsync)" 1>&2
+else
+ xattrs_available=yes
+fi
+
+# 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