From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] common/hooks/post-install/04-create-xbps-metadata-scripts.sh: fix return code of failed trigger runs
Date: Thu, 22 Jul 2021 05:26:58 +0200 [thread overview]
Message-ID: <20210722032658.q9U1qTgO589q568gpmH6Pa45-RgzYCMp_Qjw5uHWMoE@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-32120@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
There is an updated pull request by ahesford against master on the void-packages repository
https://github.com/ahesford/void-packages trigger-fix
https://github.com/void-linux/void-packages/pull/32120
common/hooks/post-install/04-create-xbps-metadata-scripts.sh: fix return code of failed trigger runs
When a template defines `$triggers`, `xbps-src` writes an `INSTALL` script that will invoke the triggers. If the triggers fail, the test in
[ $? -ne 0 ] && exit $?
will succeed and `exit` will be invoked. However, at the time `exit` is invoked, `$?` will take the value of *the test* `[ $? -ne 0 ]`, which is always `0` (or else the `&&` will short-circuit and the `exit` will not run).
The right thing to do is capture `$?` in a persistent variable, `$ret`, that can be tested and returned to properly forward the failure code through the trigger.
**NOTE**: This needs a bit of testing, because I don't yet understand the ramifications for `xbps-install` receiving a non-zero trigger return when all of them have returned `0` thus far.
A patch file from https://github.com/void-linux/void-packages/pull/32120.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-trigger-fix-32120.patch --]
[-- Type: text/x-diff, Size: 1546 bytes --]
From dd2fd23e59baa5aca6e52c25d25de7d4d4b7aba8 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 21 Jul 2021 22:57:10 -0400
Subject: [PATCH] common/hooks/post-install/04-create-xbps-metadata-scripts.sh:
fix return code of failed trigger runs
---
.../hooks/post-install/04-create-xbps-metadata-scripts.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
index 8bb86c4487a5..1d41b58a4ee6 100644
--- a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
+++ b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
@@ -326,8 +326,7 @@ _EOF
if ! [[ $j =~ pre-${action} ]]; then
continue
fi
- printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE} \${CONF_FILE}\n" >> $tmpf
- printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
+ printf "\t\${TRIGGERSDIR}/$f run $j \"\${PKGNAME}\" \"\${VERSION}\" \"\${UPDATE}\" \"\${CONF_FILE}\" || exit\n" >> $tmpf
done
done
printf "\t;;\n" >> $tmpf
@@ -338,8 +337,7 @@ _EOF
if ! [[ $j =~ post-${action} ]]; then
continue
fi
- printf "\t\${TRIGGERSDIR}/$f run $j \${PKGNAME} \${VERSION} \${UPDATE} \${CONF_FILE}\n" >> $tmpf
- printf "\t[ \$? -ne 0 ] && exit \$?\n" >> $tmpf
+ printf "\t\${TRIGGERSDIR}/$f run $j \"\${PKGNAME}\" \"\${VERSION}\" \"\${UPDATE}\" \"\${CONF_FILE}\" || exit\n" >> $tmpf
done
done
printf "\t;;\n" >> $tmpf
next prev parent reply other threads:[~2021-07-22 3:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 3:03 [PR PATCH] " ahesford
2021-07-22 3:26 ` ahesford [this message]
2021-07-22 3:30 ` ahesford
2021-08-31 15:39 ` [PR PATCH] [Updated] " ahesford
2021-08-31 15:39 ` ahesford
2021-08-31 15:41 ` ahesford
2022-05-30 2:15 ` github-actions
2022-10-10 10:23 ` Duncaen
2022-10-11 17:48 ` [PR PATCH] [Closed]: " ahesford
2022-10-11 17:53 ` ahesford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210722032658.q9U1qTgO589q568gpmH6Pa45-RgzYCMp_Qjw5uHWMoE@z \
--to=ahesford@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).