commit: 8c46c6a567cf7d8e44f0c855b05589a482d9792e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 23 09:11:40 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 23 10:37:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8c46c6a5
emerge-webrsync: fix exit status reporting for rsync in sync_local()
As concerns the sync_local() function, a recent commit altered the
method by which rsync(1) is detected to have failed, by using the if
command. In many cases, such would be acceptable. However, in this
particular case, the diagnostic message expects to convey the exit
status of the utility, which is clobbered by if.
Address the issue by once again using the "||" control operator in
conjunction with a compound command. Further, improve the quality of the
diagnostic messages, both for eerror() and die().
Fixes: e2dc868b32deace30a470384969cd8f0fe6a1c43
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index f94cf95147..835405a1d7 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -423,10 +423,10 @@ sync_local() {
fi
chmod 755 .
- if ! rsync "${rsync_opts[@]}" -- . "${repo_location%/}"; then
- eerror "rsync failed: $?"
- die "Aborting because of rsync failure"
- fi
+ rsync "${rsync_opts[@]}" -- . "${repo_location%/}" || {
+ eerror "rsync unexpectedly exited with a status of $?"
+ die "couldn't sync ${repo_location@Q} with ${PWD@Q}"
+ }
fi
if (( ! from_portage )) && contains_word metadata-transfer
"${FEATURES}"; then