From 3bf0e97d6564ef1aee5a4bf97931884df1b9501a Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Fri, 17 Apr 2009 11:00:35 +0200 Subject: [PATCH] mv: do not produce xattr preserving failures when not supported by filesystem *src/copy.c: Do not show error diagnostics when xattrs not supported and preservation of xattrs is not explicitly required (reported by Eric Sandeen in rhbz #496142) --- NEWS | 3 +++ src/copy.c | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d8ffde0..063d07f 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,9 @@ GNU coreutils NEWS -*- outline -*- LS_COLORS environment variable. To disable it you can add something like this to your profile: eval `dircolors | sed s/hl=[^:]*:/hl=:/` + mv: do not produce diagnostic errors for preserving xattr's on file + systems without xattr support. + * Noteworthy changes in release 7.1 (2009-02-21) [stable] diff --git a/src/copy.c b/src/copy.c index 9b0e139..d9db23c 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 }; -- 1.5.6.1.156.ge903b