dpolovinkin / rpms / anaconda

Forked from rpms/anaconda 3 years ago
Clone

Blame SOURCES/0031-rpmostreepayload-Avoid-shutil.copytree-in-favor-of-c.patch

fbcaed
From d4cd779ea38a42a2f122738e7c8083ca3ac6a367 Mon Sep 17 00:00:00 2001
fbcaed
From: Colin Walters <walters@verbum.org>
fbcaed
Date: Tue, 2 Dec 2014 21:47:43 -0500
fbcaed
Subject: [PATCH] rpmostreepayload: Avoid shutil.copytree in favor of cp -r to
fbcaed
 fix symlinks
fbcaed
fbcaed
shutil.copytree() follows symlinks by default which I didn't realize,
fbcaed
and this actively breaks things as grubenv is a symlink.
fbcaed
fbcaed
Since we're shelling out to 'cp' in a case above, might as well do it
fbcaed
here.
fbcaed
fbcaed
This also means that if we hit e.g. ENOSPC we'll enter the error
fbcaed
handling codepath instead of an uncaught traceback.
fbcaed
fbcaed
(Yes, this code is crappy, should probably live in bootloader.py,
fbcaed
 except I'm going through gyrations here to avoid requiring
fbcaed
 any changes in how mainline bootloaders work)
fbcaed
---
fbcaed
 pyanaconda/packaging/rpmostreepayload.py | 2 +-
fbcaed
 1 file changed, 1 insertion(+), 1 deletion(-)
fbcaed
fbcaed
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
fbcaed
index ade664c..f96a316 100644
fbcaed
--- a/pyanaconda/packaging/rpmostreepayload.py
fbcaed
+++ b/pyanaconda/packaging/rpmostreepayload.py
fbcaed
@@ -119,7 +119,7 @@ class RPMOSTreePayload(ArchivePayload):
fbcaed
                     self._safeExecWithRedirect('cp', ['-r', '-p', sub_srcpath, sub_destpath])
fbcaed
             else:
fbcaed
                 log.info("Copying bootloader data: " + fname)
fbcaed
-                shutil.copytree(srcpath, destpath)
fbcaed
+                self._safeExecWithRedirect('cp', ['-r', '-p', srcpath, destpath])
fbcaed
 
fbcaed
     def install(self):
fbcaed
         mainctx = GLib.MainContext.new()
fbcaed
-- 
fbcaed
1.8.3.1
fbcaed