_scratch_mount || _fail "mount failed"
_create_test_bed
+# In kernels before 3.0, getxattr() fails with EPERM for an attribute which
+# cannot exist. Later kernels fail with ENODATA. Accept both results.
+invalid_attribute_filter() {
+ sed -e "s:\(No such attribute\|Operation not permitted\):No such attribute or operation not permitted:"
+}
+
if [ "$USE_ATTR_SECURE" = yes ]; then
ATTR_MODES="user security trusted"
else
echo "*** set an empty value for second attribute"
setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
- getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode
+ getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
echo "*** overwrite empty value"
setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
echo "*** remove attribute"
setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
- getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode
+ getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | invalid_attribute_filter
echo "*** final list (strings, type=$inode, nsp=$nsp)"
getfattr -m '.' -e hex $SCRATCH_MNT/$inode
user.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/reg: user.name2: No such attribute
+SCRATCH_MNT/reg: user.name2: No such attribute or operation not permitted
*** final list (strings, type=reg, nsp=user)
# file: SCRATCH_MNT/reg
user.name=0xbabe
user.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/dir: user.name2: No such attribute
+SCRATCH_MNT/dir: user.name2: No such attribute or operation not permitted
*** final list (strings, type=dir, nsp=user)
# file: SCRATCH_MNT/dir
user.name=0xbabe
setfattr: SCRATCH_MNT/lnk: Operation not permitted
*** set an empty value for second attribute
setfattr: SCRATCH_MNT/lnk: Operation not permitted
-SCRATCH_MNT/lnk: user.name2: Operation not permitted
+SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
*** overwrite empty value
setfattr: SCRATCH_MNT/lnk: Operation not permitted
-SCRATCH_MNT/lnk: user.name2: Operation not permitted
+SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
*** remove attribute
setfattr: SCRATCH_MNT/lnk: Operation not permitted
-SCRATCH_MNT/lnk: user.name2: Operation not permitted
+SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
*** final list (strings, type=lnk, nsp=user)
=== TYPE dev/b; NAMESPACE user
setfattr: SCRATCH_MNT/dev/b: Operation not permitted
*** set an empty value for second attribute
setfattr: SCRATCH_MNT/dev/b: Operation not permitted
-SCRATCH_MNT/dev/b: user.name2: Operation not permitted
+SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
*** overwrite empty value
setfattr: SCRATCH_MNT/dev/b: Operation not permitted
-SCRATCH_MNT/dev/b: user.name2: Operation not permitted
+SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
*** remove attribute
setfattr: SCRATCH_MNT/dev/b: Operation not permitted
-SCRATCH_MNT/dev/b: user.name2: Operation not permitted
+SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/b, nsp=user)
=== TYPE dev/c; NAMESPACE user
setfattr: SCRATCH_MNT/dev/c: Operation not permitted
*** set an empty value for second attribute
setfattr: SCRATCH_MNT/dev/c: Operation not permitted
-SCRATCH_MNT/dev/c: user.name2: Operation not permitted
+SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
*** overwrite empty value
setfattr: SCRATCH_MNT/dev/c: Operation not permitted
-SCRATCH_MNT/dev/c: user.name2: Operation not permitted
+SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
*** remove attribute
setfattr: SCRATCH_MNT/dev/c: Operation not permitted
-SCRATCH_MNT/dev/c: user.name2: Operation not permitted
+SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/c, nsp=user)
=== TYPE dev/p; NAMESPACE user
setfattr: SCRATCH_MNT/dev/p: Operation not permitted
*** set an empty value for second attribute
setfattr: SCRATCH_MNT/dev/p: Operation not permitted
-SCRATCH_MNT/dev/p: user.name2: Operation not permitted
+SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
*** overwrite empty value
setfattr: SCRATCH_MNT/dev/p: Operation not permitted
-SCRATCH_MNT/dev/p: user.name2: Operation not permitted
+SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
*** remove attribute
setfattr: SCRATCH_MNT/dev/p: Operation not permitted
-SCRATCH_MNT/dev/p: user.name2: Operation not permitted
+SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/p, nsp=user)
=== TYPE reg; NAMESPACE trusted
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/reg: trusted.name2: No such attribute
+SCRATCH_MNT/reg: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=reg, nsp=trusted)
# file: SCRATCH_MNT/reg
trusted.name=0xbabe
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/dir: trusted.name2: No such attribute
+SCRATCH_MNT/dir: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=dir, nsp=trusted)
# file: SCRATCH_MNT/dir
trusted.name=0xbabe
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/lnk: trusted.name2: No such attribute
+SCRATCH_MNT/lnk: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=lnk, nsp=trusted)
# file: SCRATCH_MNT/lnk
trusted.name=0xbabe
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/dev/b: trusted.name2: No such attribute
+SCRATCH_MNT/dev/b: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/b, nsp=trusted)
# file: SCRATCH_MNT/dev/b
trusted.name=0xbabe
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/dev/c: trusted.name2: No such attribute
+SCRATCH_MNT/dev/c: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/c, nsp=trusted)
# file: SCRATCH_MNT/dev/c
trusted.name=0xbabe
trusted.name2=0xcafe
*** remove attribute
-SCRATCH_MNT/dev/p: trusted.name2: No such attribute
+SCRATCH_MNT/dev/p: trusted.name2: No such attribute or operation not permitted
*** final list (strings, type=dev/p, nsp=trusted)
# file: SCRATCH_MNT/dev/p
trusted.name=0xbabe