Files
apfstests/tests/generic/087
T
Pavel Reichl ace9db40f9 common/rc: Add _require_{chown,chmod}()
Add helper functions that ensure that test is only executed on file
systems that implement chown, chmod and symbolic links.

Fixed test are: generic/{87,88,125,126,128,193,314,317,355,597,598}

[Eryu: remove _require_test and declare variable as local]

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-04-25 12:53:55 +08:00

61 lines
1.4 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2015 Red Hat, Inc.
#
# FSQA Test No. 087
#
# Check if setting the file access and modification times to the current time
# (t) and to a specific timestamp (T) is allowed when expected.
#
# From utime(2): Changing timestamps is permitted when: either the process has
# appropriate privileges, or the effective user ID equals the user ID of the
# file, or [the process is trying to set the timestamps to the current time]
# and the process has write permission for the file.
#
# Note that the last of these tests will always wrongly succeed over NFSv2.
# For NFSv3+, that test will wrongly succeed until kernel commit
# "Disable NFSv2 timestamp workaround for NFSv3+".
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# real QA test starts here
_supported_fs generic
_require_test
_require_chown
QA_FS_PERMS=$here/src/fs_perms
cd $TEST_DIR
cp $here/src/testx ./testx.file
# The owner:
$QA_FS_PERMS 600 99 99 99 99 t 1
$QA_FS_PERMS 600 99 99 99 99 T 1
# Other processes with and without write permission:
$QA_FS_PERMS 600 99 99 100 99 t 0
$QA_FS_PERMS 600 99 99 100 99 T 0
$QA_FS_PERMS 660 99 99 100 99 t 1
$QA_FS_PERMS 660 99 99 100 99 T 0
rm -f ./testx.file
status=0
exit