]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ensure that cp's -a doesn't silence --preserve=context
authorOndřej Vašík <ovasik@redhat.com>
Mon, 27 Apr 2009 15:29:53 +0000 (17:29 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 28 Apr 2009 09:16:33 +0000 (11:16 +0200)
* tests/cp/cp-a-selinux: Ensure that the -a option does not silence
error diagnostics from --preserve=context, when preserving context
is required.

tests/cp/cp-a-selinux

index 8b7cc4d30550f73d9c1576158fd9b13c39abde62..b1359c098d5caf43d82a1300d3f999eb32424e54 100755 (executable)
@@ -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