coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] cp/reflink-perm fails on btrfs (and probably on ocfs2, t


From: Pádraig Brady
Subject: Re: [coreutils] cp/reflink-perm fails on btrfs (and probably on ocfs2, too)
Date: Tue, 26 Oct 2010 13:46:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

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

[Prev in Thread] Current Thread [Next in Thread]