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 _begin_fstest perms auto quick
22 # Override the default cleanup function.
28 # Import common functions.
31 # real QA test starts here
36 QA_FS_PERMS=$here/src/fs_perms
39 cp $here/src/testx ./testx.file
42 $QA_FS_PERMS 600 99 99 99 99 t 1
43 $QA_FS_PERMS 600 99 99 99 99 T 1
45 # Other processes with and without write permission:
46 $QA_FS_PERMS 600 99 99 100 99 t 0
47 $QA_FS_PERMS 600 99 99 100 99 T 0
48 $QA_FS_PERMS 660 99 99 100 99 t 1
49 $QA_FS_PERMS 660 99 99 100 99 T 0