commit: a9b74b15ebdb402b36959c74b53be8110d09e458
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jun 17 02:48:23 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 17 17:58:39 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9b74b15
emerge-webrsync: override the die() function of isolated-functions.sh
Presently, emerge-webrsync declares a simple die() function, only for it
be overridden by the implementation from "isolated-functions.sh". The
latter implementation is over-engineered and unsuitable for standalone
scripts.
Address this issue by ensuring that the function is declared after having
sourced "isolated-functions.sh". Also, make it act as the implementation
from "gentoo-functions.sh" does.
It should be noted that this change prevents emerge-webrsync from
displaying ridiculous diagnostic messages such as the one below.
BEFORE:
* ERROR: /:: failed:
* signature verification failed
*
* If you need support, post the output of `emerge --info '=/::'`,
* the complete build log and the output of `emerge -pqv '=/::'`.
* Working directory: '/var/tmp/portage/webrsync.4UwA9A'
AFTER:
emerge-webrsync: signature verification failed
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 76d98a9c20..0187f61fa2 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -626,12 +626,6 @@ vvecho() { (( opt[quiet] )) || echo "$@"; }
# Only echo if in quiet mode
nvecho() { (( ! opt[quiet] )) || echo "$@"; }
-# Unfortunately, gentoo-functions doesn't yet have a die() (bug #878505)
-die() {
- eerror "$@"
- exit 1
-}
-
# Use emerge and portageq from the same directory/prefix as the current script,
# so that we don't have to rely on PATH including the current EPREFIX.
emerge=$(PATH="${BASH_SOURCE[0]%/*}:${PATH}" type -P emerge)
@@ -650,6 +644,20 @@ export http_proxy https_proxy ftp_proxy
source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+# The implementation of die() from isolated-functions.sh is over-engineered and
+# unsuitable for standalone scripts. This one mimics gentoo-functions.
+die() {
+ case $? in
+ 0)
+ local exitval=1
+ ;;
+ *)
+ local exitval=$?
+ esac
+ printf '%s: %s\n' "${0##*/}" "$*" >&2
+ exit "${exitval}"
+}
+
# Opportunistically use gentoo-functions for its implementations of einfo(),
# ewarn() and eerror(). As of late, these are better maintained.
functions_script="${EPREFIX}/lib/gentoo/functions.sh"