From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 finch.gentoo.org (Postfix) with ESMTPS id 556E1158074 for ; Sat, 28 Jun 2025 02:31:01 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 3F9A8340D23 for ; Sat, 28 Jun 2025 02:31:01 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 3C108110566; Sat, 28 Jun 2025 02:30:38 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 354C6110566 for ; Sat, 28 Jun 2025 02:30:38 +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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CD528340EC7 for ; Sat, 28 Jun 2025 02:30:37 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CE9682AA3 for ; Sat, 28 Jun 2025 02:30:34 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1751077815.7fd6d076b20ebdf617b74e4b25917f5d01e5b16d.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-functions.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 7fd6d076b20ebdf617b74e4b25917f5d01e5b16d X-VCS-Branch: master Date: Sat, 28 Jun 2025 02:30:34 +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: 4e01945d-be02-4836-9d5c-431fe128f78e X-Archives-Hash: 96896cdc5bf5373df2692cac292c08d7 commit: 7fd6d076b20ebdf617b74e4b25917f5d01e5b16d Author: Kerin Millar plushkava net> AuthorDate: Fri Jun 27 04:42:44 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jun 28 02:30:15 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7fd6d076 phase-functions.sh: use find(1) to potentially delete PORTAGE_BUILDDIR Presently, the __dyn_clean() function concludes with an invocation of rmdir(1) that attempts to delete the directory specified by the 'PORTAGE_BUILDDIR' variable, immediately followed by an invocation of the true builtin. Clearly, the author of this code acknowledged that the directory might still be populated, but chose to silence the ensuing error and jettison the exit status of rmdir(1). Address this issue by instead invoking find(1) with the primaries necessary for it to identify an empty directory, and by having it execute rmdir(1) in that event. Further, pass the "--" operand to rmdir(1) to signify end-of-options. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/phase-functions.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index de86b00cc4..c3a051bb7b 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -331,9 +331,8 @@ __dyn_clean() { # result in it wiping the users distfiles directory (bad). rm -rf "${PORTAGE_BUILDDIR}/distdir" - rmdir "${PORTAGE_BUILDDIR}" 2>/dev/null - - true + printf '%s\0' "${PORTAGE_BUILDDIR}" \ + | find0 -maxdepth 0 -type d -empty -exec rmdir -- {} \; } __abort_handler() {