2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc.
7 # Check if setting the file access and modification times to the current time
8 # (t) and to a specific timestamp (T) is allowed when expected.
10 # From utime(2): Changing timestamps is permitted when: either the process has
11 # appropriate privileges, or the effective user ID equals the user ID of the
12 # file, or [the process is trying to set the timestamps to the current time]
13 # and the process has write permission for the file.
15 # Note that the last of these tests will always wrongly succeed over NFSv2.
16 # For NFSv3+, that test will wrongly succeed until kernel commit
17 # "Disable NFSv2 timestamp workaround for NFSv3+".
20 seqres=$RESULT_DIR/$seq
21 echo "QA output created by $seq"
25 status=1 # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15
33 # get standard environment, filters and checks
37 # real QA test starts here
42 QA_FS_PERMS=$here/src/fs_perms
45 cp $here/src/testx ./testx.file
48 $QA_FS_PERMS 600 99 99 99 99 t 1
49 $QA_FS_PERMS 600 99 99 99 99 T 1
51 # Other processes with and without write permission:
52 $QA_FS_PERMS 600 99 99 100 99 t 0
53 $QA_FS_PERMS 600 99 99 100 99 T 0
54 $QA_FS_PERMS 660 99 99 100 99 t 1
55 $QA_FS_PERMS 660 99 99 100 99 T 0