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: Jim Meyering
Subject: Re: [coreutils] cp/reflink-perm fails on btrfs (and probably on ocfs2, too)
Date: Tue, 26 Oct 2010 15:54:27 +0200

Pádraig Brady wrote:
> 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:

Thanks.  That sounds good.
Do you feel like writing the NEWS entry, too?

> 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)

Hmm... "expr > 1" vs. "1 < expr"
Should I say anything? ;-)
No big deal.

>      {
> -      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" : "");

If you don't factor the diagnostics it's easier to translate:

      error (0, 0, "%s",
             (x.data_copy_required
              ? _("cannot combine linking modes")
              ? _("cannot combine linking modes 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]