summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2009-03-11 16:08:20 +0100
committerJim Meyering <meyering@redhat.com>2009-03-11 17:32:44 +0100
commitc160afe902c07f5052dbd97c726a997db7fa20c0 (patch)
tree3a63eb8e7bf75eb1d61d65a50c4c40f9e3c43847 /tests
parentcf0bb5e05d89d9239a819b696a85532a582c8d38 (diff)
downloadcoreutils-c160afe902c07f5052dbd97c726a997db7fa20c0.tar.xz
cp: make -a option preserve xattrs, but with reduced diagnostics
* copy.c (copy_attr_by_fd): Reduce xattr diagnostics for 'cp -a'. (copy_attr_by_name): Likewise. * cp.c (main): Preserve xattrs with -a option, when possible. * doc/coreutils.texi: Document that xattrs are preserved with cp -a, with no added diagnostics. * NEWS: Mention the change. * tests/misc/xattr: Add tests for 'cp --preserve=all' and 'cp -a'.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/xattr15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/misc/xattr b/tests/misc/xattr
index 4137c53cb..f067ff535 100755
--- a/tests/misc/xattr
+++ b/tests/misc/xattr
@@ -1,6 +1,7 @@
#!/bin/sh
-# Ensure that cp --preserve=xattr and mv preserve extended attributes and
-# install does not preserve extended attributes.
+# Ensure that cp --preserve=xattr, cp --preserve=all and mv preserve extended
+# attributes and install does not preserve extended attributes.
+# cp -a should preserve xattr, error diagnostics should not be displayed
# Copyright (C) 2009 Free Software Foundation, Inc.
@@ -66,6 +67,16 @@ cp --preserve=xattr a b || fail=1
getfattr -d b >out_b || skip_test_ "failed to get xattr of file"
grep -F "$xattr_pair" out_b >/dev/null || fail=1
+#test if --preserve=all option works
+cp --preserve=all a c || fail=1
+getfattr -d c >out_c || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_c >/dev/null || fail=1
+
+#test if -a option works without any diagnostics
+cp -a a d 2>err && test -s err && fail=1
+getfattr -d d >out_d || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_d >/dev/null || fail=1
+
rm b || framework_failure
# install should never preserve xattr