Unlink for all distfile layouts rather than for all but primary.  This
wrongly assumed that the primary layout will always be removed
as a result of earlier code.  However, the rename() call correctly
assumes that the primary layout may be an old symlink, and operates
on realpath().  Therefore, the real file from a secondary layout may
be renamed, leaving dangling symlink.

Bug: https://bugs.gentoo.org/697906
Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 lib/portage/_emirrordist/DeletionTask.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/_emirrordist/DeletionTask.py 
b/lib/portage/_emirrordist/DeletionTask.py
index db5ac5ffb..a4bb29419 100644
--- a/lib/portage/_emirrordist/DeletionTask.py
+++ b/lib/portage/_emirrordist/DeletionTask.py
@@ -102,7 +102,7 @@ class DeletionTask(CompositeTask):
 
        def _delete_links(self):
                success = True
-               for layout in self.config.layouts[1:]:
+               for layout in self.config.layouts:
                        distfile_path = os.path.join(
                                self.config.options.distfiles,
                                layout.get_path(self.distfile))
-- 
2.23.0


Reply via email to