4 # Check if setting the file access and modification times to the current time
5 # (t) and to a specific timestamp (T) is allowed when expected.
7 # From utime(2): Changing timestamps is permitted when: either the process has
8 # appropriate privileges, or the effective user ID equals the user ID of the
9 # file, or [the process is trying to set the timestamps to the current time]
10 # and the process has write permission for the file.
12 # Note that the last of these tests will always wrongly succeed over NFSv2.
13 # For NFSv3+, that test will wrongly succeed until kernel commit
14 # "Disable NFSv2 timestamp workaround for NFSv3+".
16 #-----------------------------------------------------------------------
17 # Copyright (c) 2015 Red Hat, Inc.
18 # Author: Andreas Gruenbacher <agruenba@redhat.com>
20 # This program is free software; you can redistribute it and/or
21 # modify it under the terms of the GNU General Public License as
22 # published by the Free Software Foundation.
24 # This program is distributed in the hope that it would be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write the Free Software Foundation,
31 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #-----------------------------------------------------------------------
37 seqres=$RESULT_DIR/$seq
38 echo "QA output created by $seq"
42 status=1 # failure is the default!
43 trap "_cleanup; exit \$status" 0 1 2 3 15
50 # get standard environment, filters and checks
54 # real QA test starts here
59 QA_FS_PERMS=$here/src/fs_perms
62 cp $here/src/testx ./testx.file
65 $QA_FS_PERMS 600 99 99 99 99 t 1
66 $QA_FS_PERMS 600 99 99 99 99 T 1
68 # Other processes with and without write permission:
69 $QA_FS_PERMS 600 99 99 100 99 t 0
70 $QA_FS_PERMS 600 99 99 100 99 T 0
71 $QA_FS_PERMS 660 99 99 100 99 t 1
72 $QA_FS_PERMS 660 99 99 100 99 T 0