From: Zac Medico Date: Wed, 2 Apr 2008 18:03:08 +0000 (-0000) Subject: Handle a potential FileNotFound exception in new_protect_filename() when X-Git-Tag: v2.2_pre6~272 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1fec9aa092ace6272d3b7bae934ecdf25df7f6e9;p=portage.git Handle a potential FileNotFound exception in new_protect_filename() when the last ._cfg* file happens to be a broken symlink. Thanks to bonsaikitten for reporting. svn path=/main/trunk/; revision=9677 --- diff --git a/pym/portage/util.py b/pym/portage/util.py index 155a787f5..fae0d63fc 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -1072,9 +1072,15 @@ def new_protect_filename(mydest, newmd5=None): old_pfile = normalize_path(os.path.join(real_dirname, last_pfile)) if last_pfile and newmd5: import portage.checksum - if portage.checksum.perform_md5( - os.path.join(real_dirname, last_pfile)) == newmd5: - return old_pfile + try: + last_pfile_md5 = portage.checksum.perform_md5( + os.path.join(real_dirname, last_pfile)) + except FileNotFound: + # The file suddenly disappeared or it's a broken symlink. + pass + else: + if last_pfile_md5 == newmd5: + return old_pfile return new_pfile def getlibpaths():