From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1384776-garchives=archives.gentoo.org@lists.gentoo.org>
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 C020915808B
	for <garchives@archives.gentoo.org>; Tue, 12 Apr 2022 02:00:15 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B8F20E0895;
	Tue, 12 Apr 2022 02:00:12 +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) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id BB162E08AD
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Apr 2022 02:00:11 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6481A341AC1
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Apr 2022 02:00:10 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9FB40318
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Apr 2022 02:00:08 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1649728790.23c4a45827fccebb969d5130ccc234ed3d1a9b35.sam@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/isolated-functions.sh
X-VCS-Directories: bin/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 23c4a45827fccebb969d5130ccc234ed3d1a9b35
X-VCS-Branch: master
Date: Tue, 12 Apr 2022 02:00:08 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 3a1a8c9d-86ec-48f0-8794-ab8ee8b006f9
X-Archives-Hash: 52fe1bb1a30c99fe6455c43b0ae3f29d

commit:     23c4a45827fccebb969d5130ccc234ed3d1a9b35
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Mon Apr 11 13:46:06 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 12 01:59:50 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=23c4a458

eend: Output QA warning if ebegin has not been called

The assumption here is that ebegin-eend aren't nested.

Closes: https://bugs.gentoo.org/835824
Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Closes: https://github.com/gentoo/portage/pull/807
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/isolated-functions.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index bd8c065b2..539fea952 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -339,6 +339,7 @@ ebegin() {
 	[[ ${RC_ENDCOL} == "yes" ]] && echo >&2
 	LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
 	LAST_E_CMD="ebegin"
+	EBEGIN_EEND=1
 	return 0
 }
 
@@ -367,6 +368,11 @@ __eend() {
 
 eend() {
 	[[ -n $1 ]] || eqawarn "QA Notice: eend called without first argument"
+	if [[ -v EBEGIN_EEND ]] ; then
+		unset EBEGIN_EEND
+	else
+		eqawarn "QA Notice: eend called without preceding ebegin (phase: ${EBUILD_PHASE})"
+	fi
 	local retval=${1:-0}
 	shift