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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 48DDC1396D0 for ; Thu, 31 Aug 2017 18:10:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A7E521FC005; Thu, 31 Aug 2017 18:10:39 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 884061FC005 for ; Thu, 31 Aug 2017 18:10:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7815A33BF43 for ; Thu, 31 Aug 2017 18:10:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F03078947 for ; Thu, 31 Aug 2017 18:10:36 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1504203005.40da7ee19c4c195da35083bf2d2fcbd852ad3846.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh X-VCS-Directories: bin/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 40da7ee19c4c195da35083bf2d2fcbd852ad3846 X-VCS-Branch: master Date: Thu, 31 Aug 2017 18:10:36 +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-Archives-Salt: d66f707e-7f67-4346-81d6-48ff0cb86549 X-Archives-Hash: d5303dafabb4f09efd30ef36fbd5de0b commit: 40da7ee19c4c195da35083bf2d2fcbd852ad3846 Author: Michał Górny gentoo org> AuthorDate: Thu Aug 31 14:31:11 2017 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Aug 31 18:10:05 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40da7ee1 ebuild.sh: Fail on command-not-found in global scope The PMS specifies that ebuilds must not call external commands in global scope. We can not prevent that from happening at the moment since a few ebuilds in Gentoo are still doing that. Instead, start increasing strictness by explicitly failing if ebuilds call external commands that are not found. This is not going to really break any ebuilds that are not broken already (since command-not-found usually indicates something is going wrong), and it will help noticing typos and reliance on non-common external commands. A similar change has been tested in pkgcore, and confirmed not to cause any failures with the current state of the Gentoo repository. Closes: https://github.com/gentoo/portage/pull/198 Reviewed-by: Zac Medico gentoo.org> bin/ebuild.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index f1ac3f278..c23561651 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -79,6 +79,10 @@ else eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }" done unset funcs x + + command_not_found_handle() { + die "Command not found while sourcing ebuild: ${*}" + } fi # Don't use sandbox's BASH_ENV for new shells because it does