Validate $ROOT inside the --resume merge list in order to avoid a pottential
authorZac Medico <zmedico@gentoo.org>
Sat, 6 Dec 2008 05:30:39 +0000 (05:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 6 Dec 2008 05:30:39 +0000 (05:30 -0000)
KeyError due to a stale merge list that was for a different $ROOT setting.
Thanks to Ned Ludd <solar@g.o> for reporting.

svn path=/main/trunk/; revision=12166

pym/_emerge/__init__.py

index 20597c0536c907dfa63ebff80452e28598518c0f..bb9ae689d657c4cfbbd0fea7cdef632c2068361b 100644 (file)
@@ -13130,6 +13130,18 @@ def action_build(settings, trees, mtimedb,
                if not isinstance(mergelist, list):
                        del mtimedb[k]
                        continue
+               for x in mergelist:
+                       if not (isinstance(x, list) and len(x) == 4):
+                               continue
+                       pkg_type, pkg_root, pkg_key, pkg_action = x
+                       if pkg_root not in trees:
+                               # Current $ROOT setting differs,
+                               # so the list must be stale.
+                               mergelist = None
+                               break
+               if not mergelist:
+                       del mtimedb[k]
+                       continue
                resume_opts = resume_data.get("myopts")
                if not isinstance(resume_opts, (dict, list)):
                        del mtimedb[k]