Do more validation of resume data from the mtimedb. (trunk r10165)
authorZac Medico <zmedico@gentoo.org>
Sun, 4 May 2008 06:41:57 +0000 (06:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 4 May 2008 06:41:57 +0000 (06:41 -0000)
svn path=/main/branches/2.1.2/; revision=10166

bin/emerge

index 2e9b0d0c28e04a1d7c138d6eb0aaf963c23fa33f..75da6349cfc90b96e1c3b5127e15b224635891da 100755 (executable)
@@ -7761,12 +7761,24 @@ def action_build(settings, trees, mtimedb,
        # validate the state of the resume data
        # so that we can make assumptions later.
        for k in ("resume", "resume_backup"):
-               if k in mtimedb:
-                       if "mergelist" in mtimedb[k]:
-                               if not mtimedb[k]["mergelist"]:
-                                       del mtimedb[k]
-                       else:
-                               del mtimedb[k]
+               if k not in mtimedb:
+                       continue
+               resume_data = mtimedb[k]
+               if not isinstance(resume_data, dict):
+                       del mtimedb[k]
+                       continue
+               mergelist = resume_data.get("mergelist")
+               if not isinstance(mergelist, list):
+                       del mtimedb[k]
+                       continue
+               resume_opts = resume_data.get("myopts")
+               if not isinstance(resume_opts, (dict, list)):
+                       del mtimedb[k]
+                       continue
+               favorites = resume_data.get("favorites")
+               if not isinstance(resume_opts, list):
+                       del mtimedb[k]
+                       continue
 
        resume = False
        if "--resume" in myopts and \