From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SaZR3-00068C-9u for garchives@archives.gentoo.org; Fri, 01 Jun 2012 21:31:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 66EBAE0527; Fri, 1 Jun 2012 21:30:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3521DE0527 for ; Fri, 1 Jun 2012 21:30:58 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9B89C1B4015 for ; Fri, 1 Jun 2012 21:30:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 5D827E5428 for ; Fri, 1 Jun 2012 21:30:56 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1338586237.9ed7bf27424890320b933e5d913804738d358bf1.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/__init__.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 9ed7bf27424890320b933e5d913804738d358bf1 X-VCS-Branch: master Date: Fri, 1 Jun 2012 21:30:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 4307ec82-82d0-4cb1-b9b6-118361af330b X-Archives-Hash: fdf42d39a1c96b137126bb914b433448 commit: 9ed7bf27424890320b933e5d913804738d358bf1 Author: Zac Medico gentoo org> AuthorDate: Fri Jun 1 21:30:37 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Jun 1 21:30:37 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D9ed7bf27 grablines: raise PermissionDenied if appropriate --- pym/portage/util/__init__.py | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 2e0a32b..4ffd599 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -469,7 +469,15 @@ def grablines(myfilename, recursive=3D0, remember_so= urce_file=3DFalse): if recursive and os.path.isdir(myfilename): if os.path.basename(myfilename) in _ignorecvs_dirs: return mylines - dirlist =3D os.listdir(myfilename) + try: + dirlist =3D os.listdir(myfilename) + except OSError as e: + if e.errno =3D=3D PermissionDenied.errno: + raise PermissionDenied(myfilename) + elif e.errno in (errno.ENOENT, errno.ESTALE): + return mylines + else: + raise dirlist.sort() for f in dirlist: if not f.startswith(".") and not f.endswith("~"): @@ -488,7 +496,10 @@ def grablines(myfilename, recursive=3D0, remember_so= urce_file=3DFalse): except IOError as e: if e.errno =3D=3D PermissionDenied.errno: raise PermissionDenied(myfilename) - pass + elif e.errno in (errno.ENOENT, errno.ESTALE): + pass + else: + raise return mylines =20 def writedict(mydict,myfilename,writekey=3DTrue):