commit:     b1bd23aba297f26a9338163438a65945202e0738
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 22 14:10:22 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Nov 22 14:18:13 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b1bd23ab

file_copy: do not attempt to use _fastcopy on Darwin

The old linux reflink module would only trigger on Linux.  With the
introduction of util/file_copy it changed to always trying to exploit
faster ways of copying falling back to shutil.copyfile.  However, on
Darwin this always fails, and the fallback isn't silent (it generates
warnings and backtraces) so don't try on this platform to save time and
make the output nicer.

Bug: https://bugs.gentoo.org/966267
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 lib/portage/util/file_copy.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/portage/util/file_copy.py b/lib/portage/util/file_copy.py
index 078a526f19..3d8c8b0ead 100644
--- a/lib/portage/util/file_copy.py
+++ b/lib/portage/util/file_copy.py
@@ -147,7 +147,14 @@ def copyfile(src, dst):
     @type dst: str
     """
 
-    try:
-        _fastcopy(src, dst)
-    except OSError:
-        shutil.copyfile(src, dst)
+    # BEGIN PREFIX LOCAL: don't try _fastcopy on Darwin, it fails for
+    # everything and gives fugly backtraces, bug #966267
+    if platform.system() != "Darwin":
+        try:
+            _fastcopy(src, dst)
+            return
+        except OSError:
+            pass
+
+    shutil.copyfile(src, dst)
+    # END PREFIX LOCAL

Reply via email to