)
id 1Nv8JT-0003wm-3a
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 08:06:55 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1Nv8Bo-0003tO-CN
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 07:59:00 -0400
Received: from lists.gnu.org ([199.232.76.165]:38422)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from
) id 1Nv8Bj-0005mg-2c
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 07:58:55 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1Nv8Bi-0006Oa-AN
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 07:58:54 -0400
Received: from [140.186.70.92] (port=37007 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1Nv8Bg-0006Ne-Mw
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 07:58:53 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from
) id 1Nv8Be-0008Pj-FO
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 07:58:52 -0400
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:1758)
by eggs.gnu.org with smtp (Exim 4.69)
(envelope-from
) id 1Nv8Be-0008PA-2b
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 07:58:50 -0400
Received: (qmail 85146 invoked from network); 26 Mar 2010 11:58:47 -0000
Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218)
by mail1.slb.deg.dub.stisp.net with SMTP; 26 Mar 2010 11:58:47 -0000
Message-ID: <4BACA045.3070906@draigBrady.com>
Date: Fri, 26 Mar 2010 11:53:41 +0000
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -4.0 (----)
X-Mailman-Approved-At: Fri, 26 Mar 2010 08:06:53 -0400
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.3 (-----)
I was surprised that `cp --preserve=all file.xattr /dev/shm` produced no warnings
In any case, this makes the docs match the behaviour.
cheers,
Pádraig.
>From 67d915612c56f8a33f24305ed84eda2a8918080a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?=
Date: Fri, 26 Mar 2010 11:19:16 +0000
Subject: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
The info docs have been inaccurate since 2009-04-17, commit 941bd482,
"mv: ignore xattr-preservation failure when not supported by filesystem"
* doc/coreutils.texi (cp invocation): Say that cp --preserve=all
does _not_ output errors when failing to copy xattrs.
---
doc/coreutils.texi | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e7c09c5..2a5f4d4 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7344,7 +7344,7 @@ directory structure; i.e., @samp{ls -U} may list the entries in a copied
directory in a different order).
Try to preserve SELinux security context and extended attributes (xattr),
but ignore any failure to do that and print no corresponding diagnostic.
-Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
+Equivalent to @option{-dR --preserve=all}.
@item -b
@itemx @w{@kbd{--backup}[=@var{method}]}
@@ -7518,8 +7518,7 @@ they are preserved by this option as well.
Preserve all file attributes.
Equivalent to specifying all of the above, but with the difference
that failure to preserve SELinux security context or extended attributes
-does not change @command{cp}'s exit status.
-@command{cp} does diagnose such failures.
+does not change @command{cp}'s exit status, or produce error messages.
@end table
Using @option{--preserve} with no @var{attribute_list} is equivalent
--
1.6.2.5
From unknown Mon Jun 23 07:53:01 2025
X-Loop: bug-gnu-emacs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Fri, 26 Mar 2010 13:02:01 +0000
Resent-Message-ID:
Resent-Sender: bug-gnu-emacs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: Report bugs to
Received: via spool by submit@debbugs.gnu.org id=B.126960848216677
(code B ref -1); Fri, 26 Mar 2010 13:02:01 +0000
Received: (at submit) by debbugs.gnu.org; 26 Mar 2010 13:01:22 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1Nv9A9-0004Kw-9e
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 09:01:22 -0400
Received: from mx10.gnu.org ([199.232.76.166])
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1Nv98K-0004Iy-0l
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 08:59:29 -0400
Received: from lists.gnu.org ([199.232.76.165]:45048)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from ) id 1Nv98E-00008z-Rz
for submit@debbugs.gnu.org; Fri, 26 Mar 2010 08:59:23 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1Nv98E-00074C-23
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 08:59:22 -0400
Received: from [140.186.70.92] (port=56330 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1Nv988-0006pW-0X
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 08:59:17 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from ) id 1Nv8tl-0005U7-Qs
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 08:44:27 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3]:36850)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1Nv8tl-0005Tm-5T
for bug-coreutils@gnu.org; Fri, 26 Mar 2010 08:44:25 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id 3CBE6818162
for ; Fri, 26 Mar 2010 13:44:20 +0100 (CET)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id 6055B81815B
for ; Fri, 26 Mar 2010 13:44:18 +0100 (CET)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id 45FD9703; Fri, 26 Mar 2010 13:44:18 +0100 (CET)
From: Jim Meyering
In-Reply-To: <4BACA045.3070906@draigBrady.com> =?UTF-8?Q?("P=C3=A1draig?=
Brady"'s message of "Fri, 26 Mar 2010 11:53:41 +0000")
References: <4BACA045.3070906@draigBrady.com>
Date: Fri, 26 Mar 2010 13:44:18 +0100
Message-ID: <878w9f1cd9.fsf@meyering.net>
Lines: 13
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -5.3 (-----)
X-Mailman-Approved-At: Fri, 26 Mar 2010 09:01:20 -0400
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.5 (-----)
P=C3=A1draig Brady wrote:
> I was surprised that `cp --preserve=3Dall file.xattr /dev/shm` produced n=
o warnings
> In any case, this makes the docs match the behaviour.
>From the log of the change you quote, it's obvious this is the right change.
Thanks!
> Subject: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr fai=
lures
>
> The info docs have been inaccurate since 2009-04-17, commit 941bd482,
> "mv: ignore xattr-preservation failure when not supported by filesystem"
> * doc/coreutils.texi (cp invocation): Say that cp --preserve=3Dall
> does _not_ output errors when failing to copy xattrs.
From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 29 04:02:49 2010
Received: (at control) by debbugs.gnu.org; 29 Mar 2010 08:02:49 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1Nw9vt-0004RQ-6C
for submit@debbugs.gnu.org; Mon, 29 Mar 2010 04:02:49 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3])
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1Nw9vq-0004RJ-NA
for control@debbugs.gnu.org; Mon, 29 Mar 2010 04:02:48 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id 1684E8181A8
for ; Mon, 29 Mar 2010 10:02:40 +0200 (CEST)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id 36137818196
for ; Mon, 29 Mar 2010 10:02:38 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id 15DF7E4A; Mon, 29 Mar 2010 10:02:38 +0200 (CEST)
From: Jim Meyering
To: control@debbugs.gnu.org
Subject: control
Date: Mon, 29 Mar 2010 10:02:38 +0200
Message-ID: <87zl1r4ktd.fsf@meyering.net>
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -2.5 (--)
close 5775 5782
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Fri, 09 Apr 2010 23:54:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: Report bugs to , =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127085719612631
(code B ref -1); Fri, 09 Apr 2010 23:54:01 +0000
Received: (at submit) by debbugs.gnu.org; 9 Apr 2010 23:53:16 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O0O0h-0003Hg-1O
for submit@debbugs.gnu.org; Fri, 09 Apr 2010 19:53:15 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0O0e-0003Hb-K8
for submit@debbugs.gnu.org; Fri, 09 Apr 2010 19:53:13 -0400
Received: from lists.gnu.org ([199.232.76.165]:42609)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from
) id 1O0O0a-00035D-Lr
for submit@debbugs.gnu.org; Fri, 09 Apr 2010 19:53:08 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O0O0a-00017q-1p
for bug-coreutils@gnu.org; Fri, 09 Apr 2010 19:53:08 -0400
Received: from [140.186.70.92] (port=51071 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O0O0W-00017U-Sl
for bug-coreutils@gnu.org; Fri, 09 Apr 2010 19:53:07 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from
) id 1O0O0U-0006hU-Id
for bug-coreutils@gnu.org; Fri, 09 Apr 2010 19:53:04 -0400
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:3571)
by eggs.gnu.org with smtp (Exim 4.69)
(envelope-from
) id 1O0O0U-0006hJ-30
for bug-coreutils@gnu.org; Fri, 09 Apr 2010 19:53:02 -0400
Received: (qmail 92880 invoked from network); 9 Apr 2010 23:52:59 -0000
Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218)
by mail1.slb.deg.dub.stisp.net with SMTP; 9 Apr 2010 23:52:59 -0000
Message-ID: <4BBFBDD0.3030309@draigBrady.com>
Date: Sat, 10 Apr 2010 00:52:48 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
References: <4BACA045.3070906@draigBrady.com>
In-Reply-To: <4BACA045.3070906@draigBrady.com>
X-Enigmail-Version: 1.0.1
Content-Type: multipart/mixed; boundary="------------030005090304020609030608"
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -4.9 (----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.3 (-----)
This is a multi-part message in MIME format.
--------------030005090304020609030608
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On 26/03/10 11:53, Pádraig Brady wrote:
> I was surprised that `cp --preserve=all file.xattr /dev/shm` produced no warnings
> In any case, this makes the docs match the behaviour.
Actually some warnings could be output in this case so my patch is incorrect.
The xattr/selinux diagnostics from cp/mv/install are done like:
1. cp -a outputs no warnings
2. cp --preserve=all outputs all but ENOTSUP
3. cp --preserve=xattr,context outputs all errors
4. mv outputs all but ENOTSUP
5. install --preserve-context outputs all but ENOTSUP
I'm not sure about treating xattr errors differently
to other attribute preservation errors, and in
addition ENOTSUP differently from other errors.
It just seems a bit inconsistent to me.
So how about simplifying the code to match the doc change.
I.E. don't output any warnings for 2,4 & 5 above.
A diff to do that is attached:
copy.c | 63 ++++++++++++++++----------------------------------------------
copy.h | 32 +++++++++++--------------------
cp.c | 2 -
install.c | 1
mv.c | 1
5 files changed, 29 insertions(+), 70 deletions(-)
Alternatively we could make 1 behave like 2,4,5?
cheers,
Pádraig.
--------------030005090304020609030608
Content-Type: text/x-patch;
name="standard-diagnostics.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="standard-diagnostics.diff"
diff --git a/src/copy.c b/src/copy.c
index d7c0d7b..f77b5d1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -168,31 +168,10 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
return false;
}
-static bool
-errno_unsupported (int err)
-{
- return err == ENOTSUP || err == ENODATA;
-}
-
#if USE_XATTR
-static void
-copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
- char const *fmt, ...)
-{
- if (!errno_unsupported (errno))
- {
- int err = errno;
- va_list ap;
-
- /* use verror module to print error message */
- va_start (ap, fmt);
- verror (0, err, fmt, ap);
- va_end (ap);
- }
-}
static void
-copy_attr_allerror (struct error_context *ctx ATTRIBUTE_UNUSED,
+copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
char const *fmt, ...)
{
int err = errno;
@@ -220,32 +199,30 @@ static bool
copy_attr_by_fd (char const *src_path, int src_fd,
char const *dst_path, int dst_fd, const struct cp_options *x)
{
+ bool show_errors = x->require_preserve_xattr;
struct error_context ctx =
{
- .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
+ .error = copy_attr_error,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0,
- (x->reduce_diagnostics
- && !x->require_preserve_xattr
- && x->data_copy_required)? NULL : &ctx);
+ show_errors ? &ctx: NULL);
}
static bool
copy_attr_by_name (char const *src_path, char const *dst_path,
const struct cp_options *x)
{
+ bool show_errors = x->require_preserve_xattr;
struct error_context ctx =
{
- .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
+ .error = copy_attr_error,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_file (src_path, dst_path, 0,
- (x->reduce_diagnostics
- && !x->require_preserve_xattr
- && x->data_copy_required) ? NULL : &ctx);
+ show_errors ? &ctx: NULL);
}
#else /* USE_XATTR */
@@ -533,7 +510,7 @@ copy_reg (char const *src_name, char const *dst_name,
security_context_t con = NULL;
if (getfscreatecon (&con) < 0)
{
- if (!x->reduce_diagnostics || x->require_preserve_context)
+ if (x->require_preserve_context)
error (0, errno, _("failed to get file system create context"));
if (x->require_preserve_context)
{
@@ -546,7 +523,7 @@ copy_reg (char const *src_name, char const *dst_name,
{
if (fsetfilecon (dest_desc, con) < 0)
{
- if (!x->reduce_diagnostics || x->require_preserve_context)
+ if (x->require_preserve_context)
error (0, errno,
_("failed to set the security context of %s to %s"),
quote_n (0, dst_name), quote_n (1, con));
@@ -1833,29 +1810,23 @@ copy_internal (char const *src_name, char const *dst_name,
{
if (setfscreatecon (con) < 0)
{
- if (!x->reduce_diagnostics || x->require_preserve_context)
- error (0, errno,
- _("failed to set default file creation context to %s"),
- quote (con));
if (x->require_preserve_context)
{
+ error (0, errno,
+ _("failed to set default file creation context to %s"),
+ quote (con));
freecon (con);
return false;
}
}
freecon (con);
}
- else
+ else if (x->require_preserve_context)
{
- if (!errno_unsupported (errno) || x->require_preserve_context)
- {
- if (!x->reduce_diagnostics || x->require_preserve_context)
- error (0, errno,
- _("failed to get security context of %s"),
- quote (src_name));
- if (x->require_preserve_context)
- return false;
- }
+ error (0, errno,
+ _("failed to get security context of %s"),
+ quote (src_name));
+ return false;
}
}
diff --git a/src/copy.h b/src/copy.h
index 8c5cab6..e1fe33a 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -184,15 +184,13 @@ struct cp_options
Set this only if the kernel is SELinux enabled. */
bool preserve_security_context;
- /* Useful only when preserve_security_context is true.
- If true, a failed attempt to preserve a file's security context
- propagates failure "out" to the caller. If false, a failure to
- preserve a file's security context does not change the invoking
- application's exit status. Give diagnostics for failed syscalls
- regardless of this setting. For example, with "cp --preserve=context"
- this flag is "true", while with "cp -a", it is false. That means
- "cp -a" attempts to preserve any security context, but does not
- fail if it is unable to do so. */
+ /* Useful only when preserve_context is true.
+ If true, a failed attempt to preserve file's security context
+ propagates failure "out" to the caller, along with full diagnostics.
+ If false, a failure to preserve file's security context does not
+ change the invoking application's exit status, or output diagnostics.
+ For example, with `cp --preserve=context` this flag is "true",
+ while with `cp --preserve=all` or `cp -a`, it is "false". */
bool require_preserve_context;
/* If true, attempt to preserve extended attributes using libattr.
@@ -201,19 +199,13 @@ struct cp_options
/* Useful only when preserve_xattr is true.
If true, a failed attempt to preserve file's extended attributes
- propagates failure "out" to the caller. If false, a failure to
- preserve file's extended attributes does not change the invoking
- application's exit status. Give diagnostics for failed syscalls
- regardless of this setting. For example, with "cp --preserve=xattr"
- this flag is "true", while with "cp --preserve=all", it is false. */
+ propagates failure "out" to the caller, along with full diagnostics.
+ If false, a failure to preserve file's extended attributes does not
+ change the invoking application's exit status, or output diagnostics.
+ For example, with `cp --preserve=xattr` this flag is "true",
+ while with `cp --preserve=all` or `cp -a`, it is "false". */
bool require_preserve_xattr;
- /* Used as difference boolean between cp -a and cp -dR --preserve=all.
- If true, non-mandatory failure diagnostics are not displayed. This
- should prevent poluting cp -a output.
- */
- bool reduce_diagnostics;
-
/* If true, copy directories recursively and copy special files
as themselves rather than copying their contents. */
bool recursive;
diff --git a/src/cp.c b/src/cp.c
index 13ce9e0..968f2c1 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -781,7 +781,6 @@ cp_option_init (struct cp_options *x)
x->preserve_security_context = false;
x->require_preserve_context = false;
x->preserve_xattr = false;
- x->reduce_diagnostics = false;
x->require_preserve_xattr = false;
x->data_copy_required = true;
@@ -956,7 +955,6 @@ main (int argc, char **argv)
if (selinux_enabled)
x.preserve_security_context = true;
x.preserve_xattr = true;
- x.reduce_diagnostics = true;
x.recursive = true;
break;
diff --git a/src/install.c b/src/install.c
index bef7f8a..31dee86 100644
--- a/src/install.c
+++ b/src/install.c
@@ -281,7 +281,6 @@ cp_option_init (struct cp_options *x)
x->preserve_links = false;
x->preserve_mode = false;
x->preserve_timestamps = false;
- x->reduce_diagnostics=false;
x->data_copy_required = true;
x->require_preserve = false;
x->require_preserve_context = false;
diff --git a/src/mv.c b/src/mv.c
index 91aadfa..e02ed57 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -118,7 +118,6 @@ cp_option_init (struct cp_options *x)
x->preserve_mode = true;
x->preserve_timestamps = true;
x->preserve_security_context = selinux_enabled;
- x->reduce_diagnostics = false;
x->data_copy_required = true;
x->require_preserve = false; /* FIXME: maybe make this an option */
x->require_preserve_context = false;
--------------030005090304020609030608--
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Sun, 11 Apr 2010 13:38:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1,?= Report bugs to , =?UTF-8?Q?=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127099306913638
(code B ref -1); Sun, 11 Apr 2010 13:38:02 +0000
Received: (at submit) by debbugs.gnu.org; 11 Apr 2010 13:37:49 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O0xMC-0003Xv-EJ
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 09:37:49 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0xMA-0003Xq-DP
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 09:37:47 -0400
Received: from lists.gnu.org ([199.232.76.165]:55497)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from ) id 1O0xM5-0006uF-BW
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 09:37:41 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O0xM4-0001aM-RL
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 09:37:40 -0400
Received: from [140.186.70.92] (port=51602 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O0xM2-0001Zr-Sn
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 09:37:40 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from ) id 1O0xM1-00048I-6s
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 09:37:38 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3]:51550)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0xM0-00047p-LS
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 09:37:37 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id CDAEF8180EE
for ; Sun, 11 Apr 2010 15:37:32 +0200 (CEST)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id E6D3A8180D1
for ; Sun, 11 Apr 2010 15:37:29 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id C4789BB6; Sun, 11 Apr 2010 15:37:29 +0200 (CEST)
From: Jim Meyering
In-Reply-To: <4BBFBDD0.3030309@draigBrady.com> =?UTF-8?Q?("P=C3=A1draig?=
Brady"'s message of "Sat, 10 Apr 2010 00:52:48 +0100")
References: <4BACA045.3070906@draigBrady.com> <4BBFBDD0.3030309@draigBrady.com>
Date: Sun, 11 Apr 2010 15:37:29 +0200
Message-ID: <871vemt8iu.fsf@meyering.net>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -4.9 (----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -4.9 (----)
P=C3=A1draig Brady wrote:
> On 26/03/10 11:53, P=C3=A1draig Brady wrote:
>> I was surprised that `cp --preserve=3Dall file.xattr /dev/shm` produced =
no warnings
>> In any case, this makes the docs match the behaviour.
>
> Actually some warnings could be output in this case so my patch is incorr=
ect.
> The xattr/selinux diagnostics from cp/mv/install are done like:
>
> 1. cp -a outputs no warnings
> 2. cp --preserve=3Dall outputs all but ENOTSUP
> 3. cp --preserve=3Dxattr,context outputs all errors
> 4. mv outputs all but ENOTSUP
> 5. install --preserve-context outputs all but ENOTSUP
>
> I'm not sure about treating xattr errors differently
> to other attribute preservation errors, and in
> addition ENOTSUP differently from other errors.
> It just seems a bit inconsistent to me.
It's a delicate balance.
We try very hard not to suppress diagnostics that may indicate a failure.
However, when adding xattr/selinux support we could not afford to change
legacy behavior of cp -a (and mv): reporting all failure-to-preserve
errors would have made cp -a inundate many users with irrelevant-to-them
errors. When copying to e.g., NTFS or FAT, you should expect SELinux
attributes not to be copied, and warning about that expected failure
would just annoy people and risk burying legitimate errors.
> So how about simplifying the code to match the doc change.
> I.E. don't output any warnings for 2,4 & 5 above.
> A diff to do that is attached:
> copy.c | 63 ++++++++++++++++---------------------------------------=
-------
> copy.h | 32 +++++++++++--------------------
> cp.c | 2 -
> install.c | 1
> mv.c | 1
> 5 files changed, 29 insertions(+), 70 deletions(-)
>
> Alternatively we could make 1 behave like 2,4,5?
As suggested above, I'm afraid that would make cp -a too verbose.
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Sun, 11 Apr 2010 15:19:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: Jim Meyering
Cc: Report bugs to , =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127099911216268
(code B ref -1); Sun, 11 Apr 2010 15:19:02 +0000
Received: (at submit) by debbugs.gnu.org; 11 Apr 2010 15:18:32 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O0yvg-0004EL-1i
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:18:32 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0yvd-0004EG-Vv
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:18:30 -0400
Received: from lists.gnu.org ([199.232.76.165]:40090)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from
) id 1O0yvY-0001GE-U0
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:18:25 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O0yvY-0003hC-CY
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:18:24 -0400
Received: from [140.186.70.92] (port=41327 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O0yvW-0003g2-FB
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:18:23 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from
) id 1O0yvU-0000Yw-RV
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:18:22 -0400
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:1903)
by eggs.gnu.org with smtp (Exim 4.69)
(envelope-from
) id 1O0yvU-0000Yj-Ha
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:18:20 -0400
Received: (qmail 86413 invoked from network); 11 Apr 2010 15:18:17 -0000
Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218)
by mail1.slb.deg.dub.stisp.net with SMTP; 11 Apr 2010 15:18:17 -0000
Message-ID: <4BC1E825.6060401@draigBrady.com>
Date: Sun, 11 Apr 2010 16:17:57 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
References: <4BACA045.3070906@draigBrady.com> <4BBFBDD0.3030309@draigBrady.com>
<871vemt8iu.fsf@meyering.net>
In-Reply-To: <871vemt8iu.fsf@meyering.net>
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -5.4 (-----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.5 (-----)
On 11/04/10 14:37, Jim Meyering wrote:
> Pádraig Brady wrote:
>> On 26/03/10 11:53, Pádraig Brady wrote:
>>> I was surprised that `cp --preserve=all file.xattr /dev/shm` produced no warnings
>>> In any case, this makes the docs match the behaviour.
>>
>> Actually some warnings could be output in this case so my patch is incorrect.
>> The xattr/selinux diagnostics from cp/mv/install are done like:
>>
>> 1. cp -a outputs no warnings
>> 2. cp --preserve=all outputs all but ENOTSUP
>> 3. cp --preserve=xattr,context outputs all errors
>> 4. mv outputs all but ENOTSUP
>> 5. install --preserve-context outputs all but ENOTSUP
>>
>> I'm not sure about treating xattr errors differently
>> to other attribute preservation errors, and in
>> addition ENOTSUP differently from other errors.
>> It just seems a bit inconsistent to me.
>
> It's a delicate balance.
> We try very hard not to suppress diagnostics that may indicate a failure.
I can see the tradeoff, but the result is currently confusing.
For example with /dev/shm (tmpfs) on my Fedora system I can preserve
security.selinux and system.posix_acl_access xattrs but
not security.capability or user.*. That's confusing and inconsistent
in itself, but when combined with ENOTSUP special casing from cp/mv
one really doesn't know what's going on.
In other words we shouldn't make any assumptions about what the
user might expect of a file system. We really can just print
error messages if they need the particular attribute preserved
and keep quiet otherwise.
Hrm I just noticed that you only get an error to copy context
when the file already exists (so fsetfilecon is used rather
than setfscreatecon)
$ sudo ./src/cp --preserve=context file vfat/
$ sudo ./src/cp --preserve=context file vfat/
./src/cp: failed to set the security context of `vfat/file' to
`system_u:object_r:user_home_t:s0': Operation not supported
Note `install` does an unlink() rather than open(O_TRUNC)
and so will not show an error
$ sudo ./src/ginstall --preserve-context file vfat/
$ sudo ./src/ginstall --preserve-context file vfat/
I also notice that install.c never sets require_preserve_context=true
which seems to contradict the description of --preserve-context,
though the point is somewhat moot due to fsetfilecon not
being called in any case.
cheers,
Pádraig.
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Sun, 11 Apr 2010 15:50:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1,?= Report bugs to , =?UTF-8?Q?=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127100099717140
(code B ref -1); Sun, 11 Apr 2010 15:50:02 +0000
Received: (at submit) by debbugs.gnu.org; 11 Apr 2010 15:49:57 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O0zQ4-0004SP-E4
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:49:56 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0zPB-0004S0-9b
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:49:54 -0400
Received: from lists.gnu.org ([199.232.76.165]:41902)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from ) id 1O0zO1-0002Ha-Me
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:47:49 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O0zO0-0005OT-Q2
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:47:48 -0400
Received: from [140.186.70.92] (port=56157 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O0zNy-0005O6-56
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:47:48 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from ) id 1O0zNr-0004Je-BR
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:47:40 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3]:53196)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0zNq-0004JL-Mk
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:47:39 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id 0F1BF8180FE
for ; Sun, 11 Apr 2010 17:47:34 +0200 (CEST)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id 2E1258180A4
for ; Sun, 11 Apr 2010 17:47:32 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id 0C81E584; Sun, 11 Apr 2010 17:47:32 +0200 (CEST)
From: Jim Meyering
In-Reply-To: <4BC1E825.6060401@draigBrady.com> =?UTF-8?Q?("P=C3=A1draig?=
Brady"'s message of "Sun, 11 Apr 2010 16:17:57 +0100")
References: <4BACA045.3070906@draigBrady.com>
<4BBFBDD0.3030309@draigBrady.com> <871vemt8iu.fsf@meyering.net>
<4BC1E825.6060401@draigBrady.com>
Date: Sun, 11 Apr 2010 17:47:31 +0200
Message-ID: <874ojirnxo.fsf@meyering.net>
Lines: 62
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -4.9 (----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -4.9 (----)
P=C3=A1draig Brady wrote:
> On 11/04/10 14:37, Jim Meyering wrote:
>> P=C3=A1draig Brady wrote:
>>> On 26/03/10 11:53, P=C3=A1draig Brady wrote:
>>>> I was surprised that `cp --preserve=3Dall file.xattr /dev/shm` produce=
d no warnings
>>>> In any case, this makes the docs match the behaviour.
>>>
>>> Actually some warnings could be output in this case so my patch is inco=
rrect.
>>> The xattr/selinux diagnostics from cp/mv/install are done like:
>>>
>>> 1. cp -a outputs no warnings
>>> 2. cp --preserve=3Dall outputs all but ENOTSUP
>>> 3. cp --preserve=3Dxattr,context outputs all errors
>>> 4. mv outputs all but ENOTSUP
>>> 5. install --preserve-context outputs all but ENOTSUP
>>>
>>> I'm not sure about treating xattr errors differently
>>> to other attribute preservation errors, and in
>>> addition ENOTSUP differently from other errors.
>>> It just seems a bit inconsistent to me.
>>
>> It's a delicate balance.
>> We try very hard not to suppress diagnostics that may indicate a failure.
>
> I can see the tradeoff, but the result is currently confusing.
> For example with /dev/shm (tmpfs) on my Fedora system I can preserve
> security.selinux and system.posix_acl_access xattrs but
> not security.capability or user.*. That's confusing and inconsistent
> in itself, but when combined with ENOTSUP special casing from cp/mv
> one really doesn't know what's going on.
> In other words we shouldn't make any assumptions about what the
> user might expect of a file system. We really can just print
> error messages if they need the particular attribute preserved
> and keep quiet otherwise.
>
> Hrm I just noticed that you only get an error to copy context
> when the file already exists (so fsetfilecon is used rather
> than setfscreatecon)
>
> $ sudo ./src/cp --preserve=3Dcontext file vfat/
> $ sudo ./src/cp --preserve=3Dcontext file vfat/
> ./src/cp: failed to set the security context of `vfat/file' to
> `system_u:object_r:user_home_t:s0': Operation not supported
>
> Note `install` does an unlink() rather than open(O_TRUNC)
> and so will not show an error
>
> $ sudo ./src/ginstall --preserve-context file vfat/
> $ sudo ./src/ginstall --preserve-context file vfat/
>
> I also notice that install.c never sets require_preserve_context=3Dtrue
> which seems to contradict the description of --preserve-context,
> though the point is somewhat moot due to fsetfilecon not
> being called in any case.
I agree that the current state is unsatisfying.
If you can find a way to improve things without
making commonly used options (cp -a, mv) produce
new warnings, I'm all for it.
Could it be that you want a new option (groan, maybe...)
to remove all of this diagnostic-suppressing behavior?
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Sun, 11 Apr 2010 16:00:03 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: Jim Meyering
Cc: Report bugs to , =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127100154217372
(code B ref -1); Sun, 11 Apr 2010 16:00:03 +0000
Received: (at submit) by debbugs.gnu.org; 11 Apr 2010 15:59:02 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O0zYr-0004W9-Qv
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:59:02 -0400
Received: from mx10.gnu.org ([199.232.76.166])
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O0zYp-0004Vy-Lj
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:59:00 -0400
Received: from lists.gnu.org ([199.232.76.165]:56386)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from
) id 1O0zYj-0002Uh-Uq
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 11:58:54 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O0zYi-00060U-RP
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:58:52 -0400
Received: from [140.186.70.92] (port=51953 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O0zYK-0005zB-MS
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:58:52 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from
) id 1O0zXY-0006Nn-LB
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:57:42 -0400
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:13717)
by eggs.gnu.org with smtp (Exim 4.69)
(envelope-from
) id 1O0zXY-0006Ne-98
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 11:57:40 -0400
Received: (qmail 93113 invoked from network); 11 Apr 2010 15:57:37 -0000
Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218)
by mail1.slb.deg.dub.stisp.net with SMTP; 11 Apr 2010 15:57:37 -0000
Message-ID: <4BC1F15D.608@draigBrady.com>
Date: Sun, 11 Apr 2010 16:57:17 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
References: <4BACA045.3070906@draigBrady.com> <4BBFBDD0.3030309@draigBrady.com>
<871vemt8iu.fsf@meyering.net> <4BC1E825.6060401@draigBrady.com>
<874ojirnxo.fsf@meyering.net>
In-Reply-To: <874ojirnxo.fsf@meyering.net>
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -5.4 (-----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.5 (-----)
On 11/04/10 16:47, Jim Meyering wrote:
> Pádraig Brady wrote:
>> On 11/04/10 14:37, Jim Meyering wrote:
>>> Pádraig Brady wrote:
>>>> On 26/03/10 11:53, Pádraig Brady wrote:
>>>>> I was surprised that `cp --preserve=all file.xattr /dev/shm` produced no warnings
>>>>> In any case, this makes the docs match the behaviour.
>>>>
>>>> Actually some warnings could be output in this case so my patch is incorrect.
>>>> The xattr/selinux diagnostics from cp/mv/install are done like:
>>>>
>>>> 1. cp -a outputs no warnings
>>>> 2. cp --preserve=all outputs all but ENOTSUP
>>>> 3. cp --preserve=xattr,context outputs all errors
>>>> 4. mv outputs all but ENOTSUP
>>>> 5. install --preserve-context outputs all but ENOTSUP
>>>>
>>>> I'm not sure about treating xattr errors differently
>>>> to other attribute preservation errors, and in
>>>> addition ENOTSUP differently from other errors.
>>>> It just seems a bit inconsistent to me.
>>>
>>> It's a delicate balance.
>>> We try very hard not to suppress diagnostics that may indicate a failure.
>>
>> I can see the tradeoff, but the result is currently confusing.
>> For example with /dev/shm (tmpfs) on my Fedora system I can preserve
>> security.selinux and system.posix_acl_access xattrs but
>> not security.capability or user.*. That's confusing and inconsistent
>> in itself, but when combined with ENOTSUP special casing from cp/mv
>> one really doesn't know what's going on.
>> In other words we shouldn't make any assumptions about what the
>> user might expect of a file system. We really can just print
>> error messages if they need the particular attribute preserved
>> and keep quiet otherwise.
>>
>> Hrm I just noticed that you only get an error to copy context
>> when the file already exists (so fsetfilecon is used rather
>> than setfscreatecon)
>>
>> $ sudo ./src/cp --preserve=context file vfat/
>> $ sudo ./src/cp --preserve=context file vfat/
>> ./src/cp: failed to set the security context of `vfat/file' to
>> `system_u:object_r:user_home_t:s0': Operation not supported
>>
>> Note `install` does an unlink() rather than open(O_TRUNC)
>> and so will not show an error
>>
>> $ sudo ./src/ginstall --preserve-context file vfat/
>> $ sudo ./src/ginstall --preserve-context file vfat/
>>
>> I also notice that install.c never sets require_preserve_context=true
>> which seems to contradict the description of --preserve-context,
>> though the point is somewhat moot due to fsetfilecon not
>> being called in any case.
>
> I agree that the current state is unsatisfying.
> If you can find a way to improve things without
> making commonly used options (cp -a, mv) produce
> new warnings, I'm all for it.
Well the patch _reduces_ warnings so that they're only
shown in case 3 above. They should probably also
be output in case 5 also which currently doesn't happen
as explained above.
> Could it be that you want a new option (groan, maybe...)
> to remove all of this diagnostic-suppressing behavior?
Well I had thought of that. I.E. output all
errors in cases 1,2,4 when --warnings is on.
There is the --verbose option but that also has
the side effect of outputting non warning text.
But the current situation is better than having
a new option I think.
cheers,
Pádraig.
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Sun, 11 Apr 2010 18:32:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1,?= Report bugs to , =?UTF-8?Q?=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127101070221296
(code B ref -1); Sun, 11 Apr 2010 18:32:01 +0000
Received: (at submit) by debbugs.gnu.org; 11 Apr 2010 18:31:42 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O11wc-0005XQ-6D
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 14:31:42 -0400
Received: from mx10.gnu.org ([199.232.76.166])
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O11wZ-0005XL-KU
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 14:31:40 -0400
Received: from lists.gnu.org ([199.232.76.165]:54955)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from ) id 1O11wV-0007Qk-22
for submit@debbugs.gnu.org; Sun, 11 Apr 2010 14:31:35 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O11wU-0001Oh-LK
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 14:31:34 -0400
Received: from [140.186.70.92] (port=35621 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O11wS-0001OZ-Gq
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 14:31:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from ) id 1O11wR-0003m7-5p
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 14:31:32 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3]:42176)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O11wQ-0003kf-Ip
for bug-coreutils@gnu.org; Sun, 11 Apr 2010 14:31:31 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id C59F081818A
for ; Sun, 11 Apr 2010 20:31:25 +0200 (CEST)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id E19798180FB
for ; Sun, 11 Apr 2010 20:31:22 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id 85C97AB0; Sun, 11 Apr 2010 20:31:22 +0200 (CEST)
From: Jim Meyering
In-Reply-To: <4BC1F15D.608@draigBrady.com> =?UTF-8?Q?("P=C3=A1draig?=
Brady"'s message of "Sun, 11 Apr 2010 16:57:17 +0100")
References: <4BACA045.3070906@draigBrady.com>
<4BBFBDD0.3030309@draigBrady.com> <871vemt8iu.fsf@meyering.net>
<4BC1E825.6060401@draigBrady.com> <874ojirnxo.fsf@meyering.net>
<4BC1F15D.608@draigBrady.com>
Date: Sun, 11 Apr 2010 20:31:22 +0200
Message-ID: <87mxx9rgcl.fsf@meyering.net>
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.0 (-----)
P=C3=A1draig Brady wrote:
...
> Well the patch _reduces_ warnings so that they're only
> shown in case 3 above. They should probably also
> be output in case 5 also which currently doesn't happen
> as explained above.
Yes, but I'm convinced that those warnings have some
value at least some of the time, so I'm very leery of
suppressing them, even if the rules for when they're
emitted are inconsistent and hard to describe.
>> Could it be that you want a new option (groan, maybe...)
>> to remove all of this diagnostic-suppressing behavior?
>
> Well I had thought of that. I.E. output all
> errors in cases 1,2,4 when --warnings is on.
> There is the --verbose option but that also has
> the side effect of outputting non warning text.
> But the current situation is better than having
> a new option I think.
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Mon, 12 Apr 2010 11:09:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: Jim Meyering
Cc: Report bugs to , =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127107052818712
(code B ref -1); Mon, 12 Apr 2010 11:09:02 +0000
Received: (at submit) by debbugs.gnu.org; 12 Apr 2010 11:08:48 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O1HVY-0004rl-9m
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:08:48 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O1HVV-0004rg-7X
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:08:46 -0400
Received: from lists.gnu.org ([199.232.76.165]:60317)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from
) id 1O1HVP-00061S-J4
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:08:39 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O1HVP-0003mP-B4
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:08:39 -0400
Received: from [140.186.70.92] (port=50663 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O1HVM-0003lj-Bx
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:08:38 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from
) id 1O1HVJ-00049a-Ib
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:08:36 -0400
Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:14285)
by eggs.gnu.org with smtp (Exim 4.69)
(envelope-from
) id 1O1HVJ-00049I-32
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:08:33 -0400
Received: (qmail 22102 invoked from network); 12 Apr 2010 11:08:31 -0000
Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218)
by mail1.slb.deg.dub.stisp.net with SMTP; 12 Apr 2010 11:08:31 -0000
Message-ID: <4BC2FF17.401@draigBrady.com>
Date: Mon, 12 Apr 2010 12:08:07 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
MIME-Version: 1.0
References: <4BACA045.3070906@draigBrady.com> <4BBFBDD0.3030309@draigBrady.com>
<871vemt8iu.fsf@meyering.net> <4BC1E825.6060401@draigBrady.com>
<874ojirnxo.fsf@meyering.net> <4BC1F15D.608@draigBrady.com>
<87mxx9rgcl.fsf@meyering.net>
In-Reply-To: <87mxx9rgcl.fsf@meyering.net>
X-Enigmail-Version: 1.0.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -4.8 (----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.6 (-----)
On 11/04/10 19:31, Jim Meyering wrote:
> Pádraig Brady wrote:
> ...
>> Well the patch _reduces_ warnings so that they're only
>> shown in case 3 above. They should probably also
>> be output in case 5 also which currently doesn't happen
>> as explained above.
>
> Yes, but I'm convinced that those warnings have some
> value at least some of the time, so I'm very leery of
> suppressing them, even if the rules for when they're
> emitted are inconsistent and hard to describe.
OK fair enough, I'll push this doc clarification soon
which attempts to better describe what's happening.
cheers,
Pádraig.
commit c420cfef77b9173a754806dc49deacabb436044f
Author: Pádraig Brady
Date: Mon Apr 12 08:46:37 2010 +0100
doc: clarify when cp and mv output xattr warnings
The 2010-03-26 commit, 4c38625e, "doc: fix info on cp --preserve..."
was not entirely correct as cp --preserve=all does produce some
xattr warnings.
* src/copy.h: Update and clarify the comments for reduce_diagnostics
and require_preserve_{xattr,context}.
* doc/coreutils.texi (cp invocation): Update the -a and
--preserve=xattr,context options to say when and which
xattr warnings are output.
(mv invocation): Mention that some warnings are output
when preserving xattrs.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index f549989..7561f2a 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7344,7 +7344,7 @@ directory structure; i.e., @samp{ls -U} may list the entries in a copied
directory in a different order).
Try to preserve SELinux security context and extended attributes (xattr),
but ignore any failure to do that and print no corresponding diagnostic.
-Equivalent to @option{-dR --preserve=all}.
+Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
@item -b
@itemx @w{@kbd{--backup}[=@var{method}]}
@@ -7507,18 +7507,18 @@ $ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b
@end smallexample
@itemx context
-Preserve SELinux security context of the file. @command{cp} will fail
-if the preserving of SELinux security context is not succesful.
+Preserve SELinux security context of the file, or fail with full diagnostics.
@itemx xattr
-Preserve extended attributes if @command{cp} is built with xattr support,
-and xattrs are supported and enabled on your file system.
+Preserve extended attributes of the file, or fail with full diagnostics.
+If @command{cp} is built without xattr support, ignore this option.
If SELinux context, ACLs or Capabilities are implemented using xattrs,
they are preserved by this option as well.
@itemx all
Preserve all file attributes.
Equivalent to specifying all of the above, but with the difference
that failure to preserve SELinux security context or extended attributes
-does not change @command{cp}'s exit status, or produce error messages.
+does not change @command{cp}'s exit status. In contrast to @option{-a},
+all but @samp{Operation not supported} warnings are output.
@end table
Using @option{--preserve} with no @var{attribute_list} is equivalent
@@ -8276,6 +8276,7 @@ original partition.
@cindex extended attributes, xattr
@command{mv} always tries to copy extended attributes (xattr), which may
include SELinux context, ACLs or Capabilities.
+Upon failure all but @samp{Operation not supported} warnings are output.
@cindex prompting, and @command{mv}
If a destination file exists but is normally
diff --git a/src/copy.h b/src/copy.h
index bd7359f..59e29f5 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -180,15 +180,13 @@ struct cp_options
Set this only if the kernel is SELinux enabled. */
bool preserve_security_context;
- /* Useful only when preserve_security_context is true.
- If true, a failed attempt to preserve a file's security context
- propagates failure "out" to the caller. If false, a failure to
- preserve a file's security context does not change the invoking
- application's exit status. Give diagnostics for failed syscalls
- regardless of this setting. For example, with "cp --preserve=context"
- this flag is "true", while with "cp -a", it is false. That means
- "cp -a" attempts to preserve any security context, but does not
- fail if it is unable to do so. */
+ /* Useful only when preserve_context is true.
+ If true, a failed attempt to preserve file's security context
+ propagates failure "out" to the caller, along with full diagnostics.
+ If false, a failure to preserve file's security context does not
+ change the invoking application's exit status, but may output diagnostics.
+ For example, with `cp --preserve=context` this flag is "true",
+ while with `cp --preserve=all` or `cp -a`, it is "false". */
bool require_preserve_context;
/* If true, attempt to preserve extended attributes using libattr.
@@ -197,16 +195,19 @@ struct cp_options
/* Useful only when preserve_xattr is true.
If true, a failed attempt to preserve file's extended attributes
- propagates failure "out" to the caller. If false, a failure to
- preserve file's extended attributes does not change the invoking
- application's exit status. Give diagnostics for failed syscalls
- regardless of this setting. For example, with "cp --preserve=xattr"
- this flag is "true", while with "cp --preserve=all", it is false. */
+ propagates failure "out" to the caller, along with full diagnostics.
+ If false, a failure to preserve file's extended attributes does not
+ change the invoking application's exit status, but may output diagnostics.
+ For example, with `cp --preserve=xattr` this flag is "true",
+ while with `cp --preserve=all` or `cp -a`, it is "false". */
bool require_preserve_xattr;
- /* Used as difference boolean between cp -a and cp -dR --preserve=all.
- If true, non-mandatory failure diagnostics are not displayed. This
- should prevent poluting cp -a output.
+ /* This allows us to output warnings in cases 2 and 4 below,
+ while being quiet for case 1 (when reduce_diagnostics is true).
+ 1. cp -a try to copy xattrs with no errors
+ 2. cp --preserve=all copy xattrs with all but ENOTSUP warnings
+ 3. cp --preserve=xattr,context copy xattrs with all errors
+ 4. mv copy xattrs with all but ENOTSUP warnings
*/
bool reduce_diagnostics;
From unknown Mon Jun 23 07:53:01 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#5775: [PATCH] doc: fix info to say cp -a does _not_ diagnose xattr failures
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-To: owner@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Mon, 12 Apr 2010 11:24:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 5775
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: =?UTF-8?Q?Ond=C5=99ej_?= =?UTF-8?Q?Va=C5=A1,?= Report bugs to , =?UTF-8?Q?=C3=ADk?=
Received: via spool by submit@debbugs.gnu.org id=B.127107144019091
(code B ref -1); Mon, 12 Apr 2010 11:24:02 +0000
Received: (at submit) by debbugs.gnu.org; 12 Apr 2010 11:24:00 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from )
id 1O1HkF-0004xs-NJ
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:23:59 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O1HkE-0004xn-Dz
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:23:59 -0400
Received: from lists.gnu.org ([199.232.76.165]:38091)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from ) id 1O1Hk8-0006SY-Sa
for submit@debbugs.gnu.org; Mon, 12 Apr 2010 07:23:52 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1O1Hk8-00011g-Ik
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:23:52 -0400
Received: from [140.186.70.92] (port=38337 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1O1Hk7-00011X-06
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:23:52 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.0
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from ) id 1O1Hk4-0006Po-Rn
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:23:50 -0400
Received: from smtp3-g21.free.fr ([212.27.42.3]:40894)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from ) id 1O1Hk4-0006P7-7L
for bug-coreutils@gnu.org; Mon, 12 Apr 2010 07:23:48 -0400
Received: from smtp3-g21.free.fr (localhost [127.0.0.1])
by smtp3-g21.free.fr (Postfix) with ESMTP id 1BC04818103
for ; Mon, 12 Apr 2010 13:23:43 +0200 (CEST)
Received: from mx.meyering.net (mx.meyering.net [82.230.74.64])
by smtp3-g21.free.fr (Postfix) with ESMTP id 0E2BB818036
for ; Mon, 12 Apr 2010 13:23:41 +0200 (CEST)
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
id E1BDEC14; Mon, 12 Apr 2010 13:23:40 +0200 (CEST)
From: Jim Meyering
In-Reply-To: <4BC2FF17.401@draigBrady.com> =?UTF-8?Q?("P=C3=A1draig?=
Brady"'s message of "Mon, 12 Apr 2010 12:08:07 +0100")
References: <4BACA045.3070906@draigBrady.com>
<4BBFBDD0.3030309@draigBrady.com> <871vemt8iu.fsf@meyering.net>
<4BC1E825.6060401@draigBrady.com> <874ojirnxo.fsf@meyering.net>
<4BC1F15D.608@draigBrady.com> <87mxx9rgcl.fsf@meyering.net>
<4BC2FF17.401@draigBrady.com>
Date: Mon, 12 Apr 2010 13:23:40 +0200
Message-ID: <87y6gsoqwz.fsf@meyering.net>
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
seldom 2.4 (older, 4)
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -5.0 (-----)
P=C3=A1draig Brady wrote:
> On 11/04/10 19:31, Jim Meyering wrote:
>> P=C3=A1draig Brady wrote:
>> ...
>>> Well the patch _reduces_ warnings so that they're only
>>> shown in case 3 above. They should probably also
>>> be output in case 5 also which currently doesn't happen
>>> as explained above.
>>
>> Yes, but I'm convinced that those warnings have some
>> value at least some of the time, so I'm very leery of
>> suppressing them, even if the rules for when they're
>> emitted are inconsistent and hard to describe.
>
> OK fair enough, I'll push this doc clarification soon
> which attempts to better describe what's happening.
...
> commit c420cfef77b9173a754806dc49deacabb436044f
> Author: P=C3=A1draig Brady
> Date: Mon Apr 12 08:46:37 2010 +0100
>
> doc: clarify when cp and mv output xattr warnings
>
> The 2010-03-26 commit, 4c38625e, "doc: fix info on cp --preserve..."
> was not entirely correct as cp --preserve=3Dall does produce some
> xattr warnings.
>
> * src/copy.h: Update and clarify the comments for reduce_diagnostics
> and require_preserve_{xattr,context}.
> * doc/coreutils.texi (cp invocation): Update the -a and
> --preserve=3Dxattr,context options to say when and which
> xattr warnings are output.
> (mv invocation): Mention that some warnings are output
> when preserving xattrs.
Nice work. Thank you.