On 26/10/10 12:48, Pádraig Brady wrote:
> So in summary error if any of --link, --symbolic-link,
> --reflink or --attributes-only are combined.

I.E. leave the docs alone and do:

diff --git a/src/cp.c b/src/cp.c
index 5b14f3a..131a763 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -1097,9 +1097,11 @@ main (int argc, char **argv)
         }
     }

-  if (x.hard_link && x.symbolic_link)
+  if (((x.reflink_mode != REFLINK_NEVER) + x.hard_link + x.symbolic_link
+      + !x.data_copy_required) > 1)
     {
-      error (0, 0, _("cannot make both hard and symbolic links"));
+      error (0, 0, _("cannot combine linking modes%s"),
+             !x.data_copy_required ? " with --attributes-only" : "");
       usage (EXIT_FAILURE);
     }

diff --git a/tests/cp/reflink-perm b/tests/cp/reflink-perm
index 77f119f..7f48a24 100755
--- a/tests/cp/reflink-perm
+++ b/tests/cp/reflink-perm
@@ -39,8 +39,9 @@ test "$mode" = "-rwxrwxrwx" || fail=1

 test copy -nt file && fail=1

+# reflink is incompatible with other linking modes and --attributes-only
 echo > file2 # file with data
-cp --reflink=auto --preserve --attributes-only file2 empty_copy || fail=1
-test -s empty_copy && fail=1
+cp --reflink=auto --attributes-only file2 empty_copy && fail=1
+cp --reflink=auto --symbolic-link file2 empty_copy && fail=1

 Exit $fail

Reply via email to