From e92fe2aa4c8c3291dc79aaf7a891339bbdab9c1c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 2 Apr 2008 18:13:08 +0000 Subject: 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. (trunk r9676:9678) svn path=/main/branches/2.1.2/; revision=9679 --- pym/portage_util.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'pym') diff --git a/pym/portage_util.py b/pym/portage_util.py index bad313bdc..eb54076d4 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -1058,7 +1058,12 @@ 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(old_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 -- cgit v1.2.3-1-g7c22