common: kill _supported_os
[xfstests-dev.git] / tests / generic / 378
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 378
6 #
7 # Simple permission check on hard links.
8 #
9 # Overlayfs had a bug that hardlinks don't share inode, if chmod/chown/etc.
10 # is performed on one of the links then the inode belonging to the other
11 # one won't be updated. The following patch fixed this issue
12 #
13 # 51f7e52 ovl: share inode for hard link
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 here=`pwd`
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26         cd /
27         rm -f $tmp.*
28 }
29
30 # get standard environment, filters and checks
31 . ./common/rc
32 . ./common/filter
33
34 # remove previous $seqres.full before test
35 rm -f $seqres.full
36
37 # real QA test starts here
38 _supported_fs generic
39 _require_test
40 _require_user
41 _require_hardlinks
42
43 # Setup testfile and its hardlink
44 testfile=$TEST_DIR/testfile.$seq
45 testlink=$testfile.hardlink
46 rm -f $testfile $testlink
47 echo "You should not see this" >$testfile
48 ln $testfile $testlink
49
50 # remove read permission from testfile and unprivileged user should have no
51 # permission to read testfile and hardlink
52 chmod -r $testfile
53 _user_do "cat $testfile"
54 _user_do "cat $testlink"
55
56 # success, all done
57 status=0
58 exit