commit: 3483b585a0d416ab345666b885e325bbfaf231bf
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 10 01:03:46 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 7 22:54:07 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3483b585
ecompress: honour the exit status value of guess_suffix()
Presently, the 'PORTAGE_COMPRESS_SUFFIX' variable is assigned by way of
a command substitution in which the guess_suffix() function is called.
However, the variable is simultaneously exported, duly defeating the
error check. The issue is that the value of the '?' parameter will be
the exit status value of the export builtin, which will never fail.
Address this issue by exporting the variable as a separate step.
Further, ensure that die() throws a meaningful exception in the event
that the call to guest_suffix() does fail.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/ecompress | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bin/ecompress b/bin/ecompress
index aa8a3b8076..05c5de0578 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -159,7 +159,10 @@ guess_suffix() {
}
# figure out the new suffix
-export PORTAGE_COMPRESS_SUFFIX=$(guess_suffix) || die
+if ! PORTAGE_COMPRESS_SUFFIX=$(guess_suffix); then
+ die "Failed to determine the suffix of archives created by
${PORTAGE_COMPRESS@Q}"
+fi
+export PORTAGE_COMPRESS_SUFFIX
fix_symlinks() {
# Repeat until nothing changes, in order to handle multiple