4 # SGID bit inheritance over whiteout.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2016 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 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
43 # remove previous $seqres.full before test
46 # real QA test starts here
53 # Remove all files from previous tests
56 # set umask to make output deterministic
59 # Create test dir in lower dir and set sgid bit
60 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
61 mkdir -p $lowerdir/dir
62 chown $qa_user:$qa_group $lowerdir/dir
63 chmod 2775 $lowerdir/dir
64 touch $lowerdir/dir/testdir
65 touch $lowerdir/dir/testfile
66 touch $lowerdir/dir/hardlink
68 # mount overlayfs, create new file and dir in parent dir with sgid bit set, new
69 # files and dirs all should inherit the sgid bit and the group
73 mkdir $SCRATCH_MNT/dir/newdir
74 stat -c "%A %G" $SCRATCH_MNT/dir/newdir
77 touch $SCRATCH_MNT/dir/newfile
78 stat -c "%A %G" $SCRATCH_MNT/dir/newfile
80 # new dir over whiteout
81 rm -f $SCRATCH_MNT/dir/testdir
82 mkdir $SCRATCH_MNT/dir/testdir
83 stat -c "%A %G" $SCRATCH_MNT/dir/testdir
85 # new file over whiteout
86 rm -f $SCRATCH_MNT/dir/testfile
87 touch $SCRATCH_MNT/dir/testfile
88 stat -c "%A %G" $SCRATCH_MNT/dir/testfile
90 # new hardlink over whiteout
91 rm -f $SCRATCH_MNT/dir/hardlink
92 ln $SCRATCH_MNT/dir/testfile $SCRATCH_MNT/dir/hardlink
93 stat -c "%A %G" $SCRATCH_MNT/dir/hardlink