mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/attr: make _require_attrs more fine-grained
Filesystems may not support all xattr types. But, _require_attr assumes
that being able to use "user" namespace xattrs means that all namespaces
("trusted", "system", etc) are supported. This breaks on NFS, that only
supports the "user" namespace, and a few cases in the "system" namespace.
Change _require_attrs to optionally take namespace arguments that specify
the namespaces to check for. The default behavior (no arguments) is still
to check for the "user" namespace only.
Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
committed by
Eryu Guan
parent
c235b26103
commit
94dcbd03b4
+36
-24
@@ -175,30 +175,42 @@ _list_acl()
|
|||||||
|
|
||||||
_require_attrs()
|
_require_attrs()
|
||||||
{
|
{
|
||||||
[ -n "$ATTR_PROG" ] || _notrun "attr command not found"
|
local args
|
||||||
[ -n "$GETFATTR_PROG" ] || _notrun "getfattr command not found"
|
local nsp
|
||||||
[ -n "$SETFATTR_PROG" ] || _notrun "setfattr command not found"
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
#
|
args="user"
|
||||||
# Test if chacl is able to write an attribute on the target filesystems.
|
else
|
||||||
# On really old kernels the system calls might not be implemented at all,
|
args="$*"
|
||||||
# but the more common case is that the tested filesystem simply doesn't
|
fi
|
||||||
# support attributes. Note that we can't simply list attributes as
|
|
||||||
# various security modules generate synthetic attributes not actually
|
[ -n "$ATTR_PROG" ] || _notrun "attr command not found"
|
||||||
# stored on disk.
|
[ -n "$GETFATTR_PROG" ] || _notrun "getfattr command not found"
|
||||||
#
|
[ -n "$SETFATTR_PROG" ] || _notrun "setfattr command not found"
|
||||||
touch $TEST_DIR/syscalltest
|
|
||||||
attr -s "user.xfstests" -V "attr" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
|
for nsp in $args; do
|
||||||
cat $TEST_DIR/syscalltest.out >> $seqres.full
|
#
|
||||||
|
# Test if chacl is able to write an attribute on the target
|
||||||
if grep -q 'Function not implemented' $TEST_DIR/syscalltest.out; then
|
# filesystems. On really old kernels the system calls might
|
||||||
_notrun "kernel does not support attrs"
|
# not be implemented at all, but the more common case is that
|
||||||
fi
|
# the tested filesystem simply doesn't support attributes.
|
||||||
if grep -q 'Operation not supported' $TEST_DIR/syscalltest.out; then
|
# Note that we can't simply list attributes as various security
|
||||||
_notrun "attrs not supported by this filesystem type: $FSTYP"
|
# modules generate synthetic attributes not actually stored on
|
||||||
fi
|
# disk.
|
||||||
|
#
|
||||||
rm -f $TEST_DIR/syscalltest.out
|
touch $TEST_DIR/syscalltest
|
||||||
|
$SETFATTR_PROG -n "$nsp.xfstests" -v "attr" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
|
||||||
|
cat $TEST_DIR/syscalltest.out >> $seqres.full
|
||||||
|
|
||||||
|
if grep -q 'Function not implemented' $TEST_DIR/syscalltest.out; then
|
||||||
|
_notrun "kernel does not support attrs"
|
||||||
|
fi
|
||||||
|
if grep -q 'Operation not supported' $TEST_DIR/syscalltest.out; then
|
||||||
|
_notrun "attr namespace $nsp not supported by this filesystem type: $FSTYP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $TEST_DIR/syscalltest.out
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_require_attr_v1()
|
_require_attr_v1()
|
||||||
|
|||||||
Reference in New Issue
Block a user