version 1.1, 2012/02/17 15:09:30
|
version 1.1.1.3, 2021/03/17 00:32:36
|
Line 5
|
Line 5
|
|
|
# Test that rsync handles basic xattr preservation. |
# Test that rsync handles basic xattr preservation. |
|
|
. $srcdir/testsuite/rsync.fns | . $suitedir/rsync.fns |
lnkdir="$tmpdir/lnk" |
lnkdir="$tmpdir/lnk" |
|
|
$RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync is configured without xattr support" | $RSYNC --version | grep "[, ] xattrs" >/dev/null || test_skipped "Rsync is configured without xattr support" |
|
|
case "`xattr 2>&1`" in | case "$HOST_OS" in |
*--list:*) | darwin*) |
xset() { |
xset() { |
xnam="$1" |
xnam="$1" |
xval="$2" |
xval="$2" |
Line 24 case "`xattr 2>&1`" in
|
Line 24 case "`xattr 2>&1`" in
|
RSYNC_PREFIX='rsync' |
RSYNC_PREFIX='rsync' |
RUSR='rsync.nonuser' |
RUSR='rsync.nonuser' |
;; |
;; |
|
solaris*) |
|
xset() { |
|
xnam="$1" |
|
xval="$2" |
|
shift 2 |
|
for fn in "${@}"; do |
|
runat "$fn" "$SHELL_PATH" <<EOF |
|
echo "${xval}" > "${xnam}" |
|
EOF |
|
done |
|
} |
|
xls() { |
|
for fn in "${@}"; do |
|
runat "$fn" "$SHELL_PATH" <<EOF |
|
for x in *; do echo "\$x=\`cat \$x\`"; done |
|
EOF |
|
done |
|
} |
|
RSYNC_PREFIX='rsync' |
|
RUSR='rsync.nonuser' |
|
;; |
|
freebsd*) |
|
xset() { |
|
xnam="$1" |
|
xval="$2" |
|
shift 2 |
|
setextattr -h user "$xnam" "$xval" "${@}" |
|
} |
|
xls() { |
|
for f in "${@}"; do lsextattr -q -h user "$f" | tr '[[:space:]]' '\n' | sort | xargs -I % getextattr -h user % "$f"; done |
|
} |
|
RSYNC_PREFIX='rsync' |
|
RUSR='rsync' |
|
;; |
*) |
*) |
xset() { |
xset() { |
xnam="$1" |
xnam="$1" |
Line 106 esac
|
Line 140 esac
|
|
|
xls $dirs $files >"$scratchdir/xattrs.txt" |
xls $dirs $files >"$scratchdir/xattrs.txt" |
|
|
|
XFILT='-f-x_system.* -f-x_security.*' |
|
|
# OK, let's try a simple xattr copy. |
# OK, let's try a simple xattr copy. |
checkit "$RSYNC -avX $dashH --super . '$chkdir/'" "$fromdir" "$chkdir" | checkit "$RSYNC -avX $XFILT $dashH --super . '$chkdir/'" "$fromdir" "$chkdir" |
|
|
cd "$chkdir" |
cd "$chkdir" |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
Line 121 if [ "$dashH" ]; then
|
Line 157 if [ "$dashH" ]; then
|
done |
done |
fi |
fi |
|
|
checkit "$RSYNC -aiX $dashH --super $altDest=../chk . ../to" "$fromdir" "$todir" | checkit "$RSYNC -aiX $XFILT $dashH --super $altDest=../chk . ../to" "$fromdir" "$todir" |
|
|
cd "$todir" |
cd "$todir" |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
Line 135 xset user.nice 'this is nice, but different' file1
|
Line 171 xset user.nice 'this is nice, but different' file1
|
|
|
xls $dirs $files >"$scratchdir/xattrs.txt" |
xls $dirs $files >"$scratchdir/xattrs.txt" |
|
|
checkit "$RSYNC -aiX $dashH --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir" | checkit "$RSYNC -aiX $XFILT $dashH --fake-super --link-dest=../chk . ../to" "$chkdir" "$todir" |
|
|
cd "$todir" |
cd "$todir" |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
|
|
sed -n -e '/^[^ ][^ ]* *[^ ][^ ]* *[^ ][^ ]* *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff-all" | sed -n -e '/^[^d ][^ ]* *[^ ][^ ]* *[^ ][^ ]* *1 /p' "$scratchdir/ls-to" >"$scratchdir/ls-diff-all" |
fgrep -v './file1' "$scratchdir/ls-diff-all" >"$scratchdir/ls-diff" || : |
fgrep -v './file1' "$scratchdir/ls-diff-all" >"$scratchdir/ls-diff" || : |
if [ -s "$scratchdir/ls-diff" ]; then |
if [ -s "$scratchdir/ls-diff" ]; then |
echo "Missing hard links on:" |
echo "Missing hard links on:" |
Line 165 cd "$fromdir"
|
Line 201 cd "$fromdir"
|
rm -rf "$todir" |
rm -rf "$todir" |
|
|
# When run by a non-root tester, this checks if no-user-perm files/dirs can be copied. |
# When run by a non-root tester, this checks if no-user-perm files/dirs can be copied. |
checkit "$RSYNC -aiX $dashH --fake-super --chmod=a= . ../to" "$chkdir" "$todir" # 2>"$scratchdir/errors.txt" | checkit "$RSYNC -aiX $XFILT $dashH --fake-super --chmod=a= . ../to" "$chkdir" "$todir" # 2>"$scratchdir/errors.txt" |
|
|
cd "$todir" |
cd "$todir" |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - |
Line 181 $RSYNC -aX file1 ../lnk/
|
Line 217 $RSYNC -aX file1 ../lnk/
|
|
|
xls file1 file2 >"$scratchdir/xattrs.txt" |
xls file1 file2 >"$scratchdir/xattrs.txt" |
|
|
checkit "$RSYNC -aiiX $dashH $altDest=../lnk . ../to" "$chkdir" "$todir" | checkit "$RSYNC -aiiX $XFILT $dashH $altDest=../lnk . ../to" "$chkdir" "$todir" |
|
|
[ "$dashH" ] && rm ../lnk/extra-link |
[ "$dashH" ] && rm ../lnk/extra-link |
|
|
Line 194 rm "$todir/file2"
|
Line 230 rm "$todir/file2"
|
echo extra >file1 |
echo extra >file1 |
$RSYNC -aX . ../chk/ |
$RSYNC -aX . ../chk/ |
|
|
checkit "$RSYNC -aiiX . ../to" "$chkdir" "$todir" | checkit "$RSYNC -aiiX $XFILT . ../to" "$chkdir" "$todir" |
|
|
cd "$todir" |
cd "$todir" |
xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" - |
xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" - |