[PATCH] rpmostreepayload: Avoid shutil.copytree in favor of cp -r to fix symlinks

Colin Walters walters at verbum.org
Wed Dec 3 02:59:12 UTC 2014

shutil.copytree() follows symlinks by default which I didn't realize,
and this actively breaks things as grubenv is a symlink.

Since we're shelling out to 'cp' in a case above, might as well do it

This also means that if we hit e.g. ENOSPC we'll enter the error
handling codepath instead of an uncaught traceback.

(Yes, this code is crappy, should probably live in bootloader.py,
 except I'm going through gyrations here to avoid requiring
 any changes in how mainline bootloaders work)
 pyanaconda/packaging/rpmostreepayload.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
index ade664c..f96a316 100644
--- a/pyanaconda/packaging/rpmostreepayload.py
+++ b/pyanaconda/packaging/rpmostreepayload.py
@@ -119,7 +119,7 @@ class RPMOSTreePayload(ArchivePayload):
                     self._safeExecWithRedirect('cp', ['-r', '-p', sub_srcpath, sub_destpath])
                 log.info("Copying bootloader data: " + fname)
-                shutil.copytree(srcpath, destpath)
+                self._safeExecWithRedirect('cp', ['-r', '-p', srcpath, destpath])
     def install(self):
         mainctx = GLib.MainContext.new()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rpmostreepayload-Avoid-shutil.copytree-in-favor-of-c.patch
Type: text/x-patch
Size: 1513 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20141202/65a29800/attachment-0001.bin>

More information about the anaconda-patches mailing list