E.g. with podman we get default SELinux context mount options
for /dev/shm and /, resulting in all files getting context like
the following when created:
security.selinux="system_u:object_r:container_file_t:s0:c458,c677"
However you can't explicitly set that xattr:
$ touch file
$ setfattr -n "security.selinux" \
-v "system_u:object_r:container_file_t:s0:c458,c677" file
setfattr: file: Operation not supported
* tests/mv/part-symlink.sh: Avoid the issue. Note this is new
since v9.12 as mv now warns about xattr ENOTSUP failures.
* tests/misc/xattr.sh: Avoid the issue (which would have
existed before v9.12).
---
tests/misc/xattr.sh | 5 +++--
tests/mv/part-symlink.sh | 7 +++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/misc/xattr.sh b/tests/misc/xattr.sh
index 018b277cd..6e36c5f57 100755
--- a/tests/misc/xattr.sh
+++ b/tests/misc/xattr.sh
@@ -21,10 +21,11 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ cp mv ginstall
-# Skip this test if cp was built without xattr support:
touch src dest || framework_failure_
cp --preserve=xattr -n src dest \
- || skip_ "coreutils built without xattr support"
+ || skip_ 'coreutils built without xattr support'
+cp --preserve=xattr src dest \
+ || skip_ 'failed to copy default xattrs'
# this code was taken from test mv/backup-is-src
cleanup_() { rm -rf "$other_partition_tmpdir"; }
diff --git a/tests/mv/part-symlink.sh b/tests/mv/part-symlink.sh
index b7711df72..84f632977 100755
--- a/tests/mv/part-symlink.sh
+++ b/tests/mv/part-symlink.sh
@@ -27,6 +27,13 @@ cleanup_() { rm -rf "$other_partition_tmpdir"; }
# mv: preserving permissions for 'rem_sl': Operation not supported
require_local_dir_
+# With podman we get /dev/shm and / created with default SELinux context,
+# but can't explicitly set xattrs with that context, giving:
+# mv: setting attributes for 'loc_reg': Operation not supported
+touch $other_partition_tmpdir/tsup &&
+mv $other_partition_tmpdir/tsup . 2>tsup.err &&
+compare /dev/null tsup.err || skip_ 'unsupported mv warning'
+
pwd_tmp=$(pwd)
# Unset CDPATH. Otherwise, output from the 'cd dir' command
--
2.55.0