2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
7 # SGID bit inheritance over whiteout.
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
24 # get standard environment, filters and checks
28 # remove previous $seqres.full before test
31 # real QA test starts here
37 # Remove all files from previous tests
40 # set umask to make output deterministic
43 # Create test dir in lower dir and set sgid bit
44 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
45 mkdir -p $lowerdir/dir
46 chown $qa_user:$qa_group $lowerdir/dir
47 chmod 2775 $lowerdir/dir
48 touch $lowerdir/dir/testdir
49 touch $lowerdir/dir/testfile
50 touch $lowerdir/dir/hardlink
52 # mount overlayfs, create new file and dir in parent dir with sgid bit set, new
53 # files and dirs all should inherit the sgid bit and the group
57 mkdir $SCRATCH_MNT/dir/newdir
58 stat -c "%A %G" $SCRATCH_MNT/dir/newdir
61 touch $SCRATCH_MNT/dir/newfile
62 stat -c "%A %G" $SCRATCH_MNT/dir/newfile
64 # new dir over whiteout
65 rm -f $SCRATCH_MNT/dir/testdir
66 mkdir $SCRATCH_MNT/dir/testdir
67 stat -c "%A %G" $SCRATCH_MNT/dir/testdir
69 # new file over whiteout
70 rm -f $SCRATCH_MNT/dir/testfile
71 touch $SCRATCH_MNT/dir/testfile
72 stat -c "%A %G" $SCRATCH_MNT/dir/testfile
74 # new hardlink over whiteout
75 rm -f $SCRATCH_MNT/dir/hardlink
76 ln $SCRATCH_MNT/dir/testfile $SCRATCH_MNT/dir/hardlink
77 stat -c "%A %G" $SCRATCH_MNT/dir/hardlink