From: Zac Medico Date: Wed, 1 Sep 2010 16:00:48 +0000 (-0700) Subject: Make atomic directory creation code in dblink.mergeme() use equivalent X-Git-Tag: v2.2_rc73~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=338dc567385c5dd247c80f60b663bb6c6894adae;p=portage.git Make atomic directory creation code in dblink.mergeme() use equivalent error handling to portage.util.ensure_dirs(). --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 45ed955ed..25956f198 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3619,8 +3619,14 @@ class dblink(object): else: os.mkdir(mydest) except OSError as e: - if e.errno not in (errno.EEXIST, errno.EISDIR): - # Bug 187518 - sometimes mkdir raises EISDIR on FreeBSD + # Error handling should be equivalent to + # portage.util.ensure_dirs() for cases + # like bug #187518. + if e.errno in (errno.EEXIST,): + pass + elif os.path.isdir(mydest): + pass + else: raise del e @@ -3637,8 +3643,14 @@ class dblink(object): else: os.mkdir(mydest) except OSError as e: - if e.errno not in (errno.EEXIST, errno.EISDIR): - # Bug 187518 - sometimes mkdir raises EISDIR on FreeBSD + # Error handling should be equivalent to + # portage.util.ensure_dirs() for cases + # like bug #187518. + if e.errno in (errno.EEXIST,): + pass + elif os.path.isdir(mydest): + pass + else: raise del e os.chmod(mydest, mystat[0])