From 7708d8e3ca24d7d5b31e160d62887e781bbac605 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Tue, 22 Mar 2016 00:13:14 -0500 Subject: [PATCH] sync-trees: drop -X and retry if -X fails It appears that rsync may fail if -X is specified and the filesystem doesn't support xattrs. Thanks to Greg Troxel for reporting the problem and helping test the solution. Signed-off-by: Rob Browning Tested-by: Rob Browning --- t/sync-tree | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/t/sync-tree b/t/sync-tree index e2b330e..11d4abe 100755 --- a/t/sync-tree +++ b/t/sync-tree @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -u + usage() { cat <&2 else - rsync_opts="$rsync_opts -X" + xattrs_available=yes fi -exec rsync $rsync_opts "$src" "$dest" + +# 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" + if test $? -ne 0; then + # Try again without -X + exec rsync $rsync_opts "$src" "$dest" + fi +else + exec rsync $rsync_opts "$src" "$dest" +fi -- 2.39.2