--- embedaddon/rsync/testsuite/xattrs.test 2012/02/17 15:09:30 1.1 +++ embedaddon/rsync/testsuite/xattrs.test 2021/03/17 00:32:36 1.1.1.3 @@ -5,13 +5,13 @@ # Test that rsync handles basic xattr preservation. -. $srcdir/testsuite/rsync.fns +. $suitedir/rsync.fns 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 -*--list:*) +case "$HOST_OS" in +darwin*) xset() { xnam="$1" xval="$2" @@ -24,6 +24,40 @@ case "`xattr 2>&1`" in RSYNC_PREFIX='rsync' RUSR='rsync.nonuser' ;; +solaris*) + xset() { + xnam="$1" + xval="$2" + shift 2 + for fn in "${@}"; do + runat "$fn" "$SHELL_PATH" < "${xnam}" +EOF + done + } + xls() { + for fn in "${@}"; do + runat "$fn" "$SHELL_PATH" <"$scratchdir/xattrs.txt" +XFILT='-f-x_system.* -f-x_security.*' + # 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" xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - @@ -121,7 +157,7 @@ if [ "$dashH" ]; then done fi -checkit "$RSYNC -aiX $dashH --super $altDest=../chk . ../to" "$fromdir" "$todir" +checkit "$RSYNC -aiX $XFILT $dashH --super $altDest=../chk . ../to" "$fromdir" "$todir" cd "$todir" xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - @@ -135,12 +171,12 @@ xset user.nice 'this is nice, but different' file1 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" 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" || : if [ -s "$scratchdir/ls-diff" ]; then echo "Missing hard links on:" @@ -165,7 +201,7 @@ cd "$fromdir" rm -rf "$todir" # 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" xls $dirs $files | diff $diffopt "$scratchdir/xattrs.txt" - @@ -181,7 +217,7 @@ $RSYNC -aX file1 ../lnk/ 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 @@ -194,7 +230,7 @@ rm "$todir/file2" echo extra >file1 $RSYNC -aX . ../chk/ -checkit "$RSYNC -aiiX . ../to" "$chkdir" "$todir" +checkit "$RSYNC -aiiX $XFILT . ../to" "$chkdir" "$todir" cd "$todir" xls file1 file2 | diff $diffopt "$scratchdir/xattrs.txt" -