4 # Test that xfsdump/restore preserves file capabilities
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
24 owner=sandeen@sandeen.net
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
45 # real QA test starts here
47 # Modify as appropriate.
57 echo test > $dump_dir/testfile
59 setfattr -n user.name -v value $dump_dir/testfile
60 # Now set the cap (which is also an xattr)
61 setcap cap_setgid,cap_setuid+ep $dump_dir/testfile
62 # And make sure they are there on the source
63 echo "Checking for xattr on source file"
64 getfattr --absolute-names -m user.name $dump_dir/testfile | _dir_filter
65 echo "Checking for capability on source file"
66 getcap $dump_dir/testfile | _dir_filter
67 getfattr --absolute-names -m security.capability $dump_dir/testfile | _dir_filter
69 _do_dump_file -f $tmp.df.0
72 # Basic dump/restore checks first - the file is there, right?
76 echo "Checking for xattr on restored file"
77 getfattr --absolute-names -m user.name $restore_dir/$dump_sdir/testfile | _dir_filter
78 echo "Checking for capability on restored file"
79 getcap $restore_dir/$dump_sdir/testfile | _dir_filter
80 getfattr --absolute-names -m security.capability $restore_dir/$dump_sdir/testfile | _dir_filter