]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
copy: don't fail when unable to chown symlinks
authorPádraig Brady <P@draigBrady.com>
Sat, 3 Jun 2017 04:50:04 +0000 (21:50 -0700)
committerPádraig Brady <P@draigBrady.com>
Sat, 3 Jun 2017 04:54:03 +0000 (21:54 -0700)
* src/copy.c (copy_internal): Honor the x->require_preserve flag
for symlinks as we do for ordinary files, so we don't exit with
failure upon failure to chown a symbolic link.
* NEWS: Mention the bug fix.

NEWS
src/copy.c

diff --git a/NEWS b/NEWS
index 7c4429ddc473f913c015bfd166ae91f2f5d2549e..c811dbcb50371ced2bbc1c410d67d90d00fd076f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  cp and mv now only warn about failure to preserve ownership of symlinks.
+  cp (without -p) will no longer exit with a failure status, and mv will
+  also no longer leave such symlinks remaining in the source file system.
+  [the bug dates back to the initial implementation]
+
   date and touch no longer overwrite the heap with large
   user specified TZ values (CVE-2017-7476).
   [bug introduced in coreutils-8.27]
index e96ecdd5465083bf3aba1f070eebcc7928f554eb..965e8190db03a8a4ba665ea6d4e9d5f44055ae63 100644 (file)
@@ -2714,7 +2714,8 @@ copy_internal (char const *src_name, char const *dst_name,
             {
               error (0, errno, _("failed to preserve ownership for %s"),
                      dst_name);
-              goto un_backup;
+              if (x->require_preserve)
+                goto un_backup;
             }
           else
             {