summaryrefslogtreecommitdiff
path: root/tests/cp/cp-a-selinux
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2009-04-27 17:29:53 +0200
committerJim Meyering <meyering@redhat.com>2009-04-28 11:16:33 +0200
commitcb9fd937437cf4f9347925f6b9c82f4e92bae6e5 (patch)
treeada30d09379416a4e0e5009fc8b7fffb6c371cf5 /tests/cp/cp-a-selinux
parent8259a73a85c5ef46c26da27f9424aeed360fa2cd (diff)
downloadcoreutils-cb9fd937437cf4f9347925f6b9c82f4e92bae6e5.tar.xz
tests: ensure that cp's -a doesn't silence --preserve=context
* tests/cp/cp-a-selinux: Ensure that the -a option does not silence error diagnostics from --preserve=context, when preserving context is required.
Diffstat (limited to 'tests/cp/cp-a-selinux')
-rwxr-xr-xtests/cp/cp-a-selinux11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index 8b7cc4d30..b1359c098 100755
--- a/tests/cp/cp-a-selinux
+++ b/tests/cp/cp-a-selinux
@@ -78,6 +78,14 @@ cp --preserve=context f g 2> out && fail=1
# Here, we *do* expect the destination to be empty.
test -s g && fail=1
+rm -f g
+echo > g
+# Check if -a option doesn't silence --preserve=context option diagnostics
+cp -a --preserve=context f g 2> out2 && fail=1
+
+# Here, we *do* expect the destination to be empty.
+test -s g && fail=1
+
# An alternative to the current approach would be to run in a confined
# domain (maybe creating/loading it) that lacks the required permissions
# to the file type.
@@ -87,11 +95,14 @@ test -s g && fail=1
# Operation not supported
sed "s/ .g' to .*//" out > k
mv k out
+sed "s/ .g' to .*//" out2 > k
+mv k out2
cat <<\EOF > exp || fail=1
cp: failed to set the security context of
EOF
compare out exp || fail=1
+compare out2 exp || fail=1
Exit $fail