From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9C9E7158008 for ; Wed, 14 Jun 2023 19:23:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B40A5E094E; Wed, 14 Jun 2023 19:23:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8A176E094E for ; Wed, 14 Jun 2023 19:23:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7A813340F13 for ; Wed, 14 Jun 2023 19:23:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E2D6CA8D for ; Wed, 14 Jun 2023 19:23:26 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1686770515.f5ae3c4b198f0d5543afbdd36d923422cd451272.floppym@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/package/ebuild/fetch.py X-VCS-Directories: lib/portage/package/ebuild/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: f5ae3c4b198f0d5543afbdd36d923422cd451272 X-VCS-Branch: master Date: Wed, 14 Jun 2023 19:23:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e005e985-9128-4f91-9b89-a439b247e4cd X-Archives-Hash: a0d598cea897d393df714a21656c3fd0 commit: f5ae3c4b198f0d5543afbdd36d923422cd451272 Author: Mike Gilbert gentoo org> AuthorDate: Tue Jun 6 18:15:36 2023 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Wed Jun 14 19:21:55 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5ae3c4b fetch: do not rely on os.stat() for DISTDIR write test If DISTDIR is an automount, os.stat() will not trigger it. Just try to create a file instead. Bug: https://bugs.gentoo.org/485100 Signed-off-by: Mike Gilbert gentoo.org> lib/portage/package/ebuild/fetch.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py index 0d30cb88e..0ecad162e 100644 --- a/lib/portage/package/ebuild/fetch.py +++ b/lib/portage/package/ebuild/fetch.py @@ -240,20 +240,15 @@ def _ensure_distdir(settings, distdir): userpriv = portage.data.secpass >= 2 and "userpriv" in settings.features write_test_file = os.path.join(distdir, ".__portage_test_write__") - try: - st = os.stat(distdir) - except OSError: - st = None - - if st is not None and stat.S_ISDIR(st.st_mode): - if not (userfetch or userpriv): - return - if _userpriv_test_write_file(settings, write_test_file): - return + if _userpriv_test_write_file(settings, write_test_file): + return _userpriv_test_write_file_cache.pop(write_test_file, None) + + already_exists = os.path.isdir(distdir) + if ensure_dirs(distdir, gid=dir_gid, mode=dirmode, mask=modemask): - if st is None: + if not already_exists: # The directory has just been created # and therefore it must be empty. return