From: Pádraig Brady Date: Fri, 24 Feb 2023 15:15:20 +0000 (+0000) Subject: cp,install,mv: --debug: output debug info when reflinking X-Git-Tag: v9.2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65bb2765646df18488b266e6c1851593d3f9c966;p=thirdparty%2Fcoreutils.git cp,install,mv: --debug: output debug info when reflinking * src/copy.c (copy_reg): Always check whether to output debug info. (emit_debug): Restrict output with `cp --attributes-only`. --- diff --git a/src/copy.c b/src/copy.c index ca43faac25..39197872c9 100644 --- a/src/copy.c +++ b/src/copy.c @@ -187,7 +187,7 @@ copy_debug_sparse_string (enum copy_debug_val debug_val) static void emit_debug (const struct cp_options *x) { - if (! x->hard_link && ! x->symbolic_link) + if (! x->hard_link && ! x->symbolic_link && x->data_copy_required) printf ("copy offload: %s, reflink: %s, sparse detection: %s\n", copy_debug_string (copy_debug.offload), copy_debug_string (copy_debug.reflink), @@ -1608,10 +1608,6 @@ copy_reg (char const *src_name, char const *dst_name, return_val = false; goto close_src_and_dst_desc; } - - /* Output debug info for data copying operations. */ - if (x->debug) - emit_debug (x); } if (x->preserve_timestamps) @@ -1707,6 +1703,10 @@ close_src_desc: return_val = false; } + /* Output debug info for data copying operations. */ + if (x->debug) + emit_debug (x); + alignfree (buf); return return_val; }