From 941bd48235cceceb4f1c072e06a4bedd14b5e0b5 Mon Sep 17 00:00:00 2001 From: Ondřej Vašík Date: Fri, 17 Apr 2009 11:00:35 +0200 Subject: mv: ignore xattr-preservation failure when not supported by filesystem *src/copy.c: Do not warn about xattr-preservation failure when xattrs are not supported and preservation of xattrs is not explicitly required. Reported by Eric Sandeen in http://bugzilla.redhat.com/496142 --- NEWS | 3 +++ src/copy.c | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8cb17cc62..c537432e3 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,9 @@ GNU coreutils NEWS -*- outline -*- ls -v and sort -V now order names like "#.b#" properly + mv: do not print diagnostics when failing to preserve xattr's on file + systems without xattr support. + ** Changes in behavior shred, sort, shuf: now use an internal pseudorandom generator by default. diff --git a/src/copy.c b/src/copy.c index c45224c8a..d01f9b365 100644 --- a/src/copy.c +++ b/src/copy.c @@ -139,6 +139,22 @@ copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED, int err = errno; va_list ap; + if (errno != ENOTSUP && errno != ENODATA) + { + /* 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, + char const *fmt, ...) +{ + int err = errno; + va_list ap; + /* use verror module to print error message */ va_start (ap, fmt); verror (0, err, fmt, ap); @@ -163,7 +179,7 @@ copy_attr_by_fd (char const *src_path, int src_fd, { struct error_context ctx = { - .error = copy_attr_error, + .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error, .quote = copy_attr_quote, .quote_free = copy_attr_free }; @@ -177,7 +193,7 @@ copy_attr_by_name (char const *src_path, char const *dst_path, { struct error_context ctx = { - .error = copy_attr_error, + .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error, .quote = copy_attr_quote, .quote_free = copy_attr_free }; -- cgit v1.2.3-70-g09d2