2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
7 # Test that xfsdump/restore preserves file capabilities
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
30 # real QA test starts here
32 # Modify as appropriate.
35 _require_command "$SETCAP_PROG" setcap
36 _require_command "$GETCAP_PROG" getcap
43 echo test > $dump_dir/testfile
45 setfattr -n user.name -v value $dump_dir/testfile
46 # Now set the cap (which is also an xattr)
47 $SETCAP_PROG cap_setgid,cap_setuid+ep $dump_dir/testfile
48 # And make sure they are there on the source
49 echo "Checking for xattr on source file"
50 getfattr --absolute-names -m user.name $dump_dir/testfile | _dir_filter
51 echo "Checking for capability on source file"
52 _getcap $dump_dir/testfile | _dir_filter
53 getfattr --absolute-names -m security.capability $dump_dir/testfile | _dir_filter
55 _do_dump_file -f $tmp.df.0
58 # Basic dump/restore checks first - the file is there, right?
62 echo "Checking for xattr on restored file"
63 getfattr --absolute-names -m user.name $restore_dir/$dump_sdir/testfile | _dir_filter
64 echo "Checking for capability on restored file"
65 _getcap $restore_dir/$dump_sdir/testfile | _dir_filter
66 getfattr --absolute-names -m security.capability $restore_dir/$dump_sdir/testfile | _dir_filter