commit:     3fe9f55a78f96e56711a933ebe259841423a703a
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jun  7 12:47:47 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  7 22:54:14 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3fe9f55a

ecompress: improve the error handling that occurs before exiting

Refrain from invoking the fix_symlinks() function in the case that not
all of the files were successfully compressed.

In the case that not all the files were successfully compressed, have
the exception message clearly explain so.

In the case that not all of the broken symlinks were successfully
repaired, have the exception message clearly explain so.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ecompress | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index ded4b4b824..6ff956bc6b 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -235,7 +235,7 @@ export PORTAGE_COMPRESS_SUFFIX PORTAGE_COMPRESS_FLAGS 
PORTAGE_COMPRESS
 printf '%s\0' "${ED}" \
 | find0 -name '*.ecompress' -delete -print0 \
 | ___parallel_xargs -0 "${PORTAGE_BIN_PATH}"/ecompress-file
-ret=$?
+all_compressed=$(( $? == 0 ))
 
 if [[ -s ${T}/.ecompress_had_precompressed ]]; then
        eqawarn "QA Notice: One or more compressed files were found in 
docompress-ed"
@@ -252,8 +252,8 @@ if [[ -s ${T}/.ecompress_had_precompressed ]]; then
        done <"${T}"/.ecompress_had_precompressed
 fi
 
-fix_symlinks
-: $(( ret |= ${?} ))
-[[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
-
-exit ${ret}
+if (( ! all_compressed )); then
+       __helpers_die "${0##*/}: one or more files coudn't be compressed"
+elif ! fix_symlinks; then
+       __helpers_die "${0##*/}: one or more symlinks couldn't be repaired"
+fi

Reply via email to