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
38 # Remove all files from previous tests
41 # set umask to make output deterministic
44 # Create test dir in lower dir and set sgid bit
45 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
46 mkdir -p $lowerdir/dir
47 chown $qa_user:$qa_group $lowerdir/dir
48 chmod 2775 $lowerdir/dir
49 touch $lowerdir/dir/testdir
50 touch $lowerdir/dir/testfile
51 touch $lowerdir/dir/hardlink
53 # mount overlayfs, create new file and dir in parent dir with sgid bit set, new
54 # files and dirs all should inherit the sgid bit and the group
58 mkdir $SCRATCH_MNT/dir/newdir
59 stat -c "%A %G" $SCRATCH_MNT/dir/newdir
62 touch $SCRATCH_MNT/dir/newfile
63 stat -c "%A %G" $SCRATCH_MNT/dir/newfile
65 # new dir over whiteout
66 rm -f $SCRATCH_MNT/dir/testdir
67 mkdir $SCRATCH_MNT/dir/testdir
68 stat -c "%A %G" $SCRATCH_MNT/dir/testdir
70 # new file over whiteout
71 rm -f $SCRATCH_MNT/dir/testfile
72 touch $SCRATCH_MNT/dir/testfile
73 stat -c "%A %G" $SCRATCH_MNT/dir/testfile
75 # new hardlink over whiteout
76 rm -f $SCRATCH_MNT/dir/hardlink
77 ln $SCRATCH_MNT/dir/testfile $SCRATCH_MNT/dir/hardlink
78 stat -c "%A %G" $SCRATCH_MNT/dir/hardlink