This PR is supposed to prevent accidental misuse of cirrus.sh. Maybe there is a way to check if CC, AR and NM are set within the loop that deals with the other variables, but so far I did not come up with one (that's POSIX shell compliant).
ci: set -u in cirrus.sh to treat unset variables as an error #1154
pull jonasnick wants to merge 2 commits into bitcoin-core:master from jonasnick:safer-cirrus-sh changing 2 files +12 −6-
jonasnick commented at 2:12 PM on November 16, 2022: contributor
-
sipa commented at 2:30 PM on November 17, 2022: contributor
utACK 1c820cd63f00c6946435e56cc7aae312a2b2f2b6
- hebasto approved
-
hebasto commented at 1:17 PM on December 16, 2022: member
ACK 28fa827908b5f2017fd2de98d52a94d1fbaf6828, I have reviewed the code and it looks OK.
I've compared some CI logs as well. For example, https://api.cirrus-ci.com/v1/task/5602148176625664/logs/test.log vs https://api.cirrus-ci.com/v1/task/4915160440111104/logs/test.log.
-
in ci/cirrus.sh:35 in 28fa827908 outdated
31 | + if [ -n "${AR+x}" ]; then 32 | + echo -n "AR=\"${AR}\" " 33 | + fi 34 | + if [ -n "${NM+x}" ]; then 35 | + echo -n "NM=\"${NM}\" " 36 | + fi
real-or-random commented at 3:24 PM on December 16, 2022:for loop and without
echo -nwhich is not POSIX (I don't think we really care in CI but so far we tried to stick to POSIX)for var in CC CFLAGS AR NM; do eval "isset=\${$var+x}" if [ -n "$isset" ]; then eval "val=\${$var}" # shellcheck disable=SC2154 printf '%s="%s" ' "$var" "$val" fi done
hebasto commented at 3:37 PM on December 16, 2022:Can't find the point where
shellcheckis called... Did I miss a script in CI?
hebasto commented at 3:41 PM on December 16, 2022:With the suggested loop, why do separate CC, CFLAGS, AR and NM variables from others? A tiny overhead for a check seems an acceptable tradeoff for the succinct code, no?
real-or-random commented at 9:48 AM on December 19, 2022:With the suggested loop, why do separate CC, CFLAGS, AR and NM variables from others? A tiny overhead for a check seems an acceptable tradeoff for the succinct code, no?
Oh indeed. If we have a working loop that handles arbitrary variables, we should use it for all variables. Actually this makes me more convinced of my suggestion than I was before (the eval is somehwat ugly but having one piece of code for all env variables is probably a good idea.) @jonasnick What do you think?
Can't find the point where shellcheck is called... Did I miss a script in CI?
Sorry, I called it locally on my machine. :D I've seen it being very useful a few times in Core, and so I thought it doesn't hurt to add the shellcheck comment here (even if maintainers use locally). Perhaps we want to add it in the future. If @jonasnick picks up this suggestion at all, I'll let him decide if the comment is appropriate / consistent without running shellcheck in CI. ;)
hebasto commented at 10:56 AM on December 19, 2022:I've seen it being very useful a few times in Core,
Indeed.
jonasnick commented at 1:24 PM on December 19, 2022:Thanks @real-or-random, with your snippet I was able to merge these variables with the loop above. I'd keep the shellcheck directive, since I'm using shellcheck locally.
real-or-random commented at 3:24 PM on December 16, 2022: contributorACK mod suggestion
ci: set -u in cirrus.sh to treat unset variables as an error c2e0fdadebci: add missing CFLAGS & CPPFLAGS variable to print_environment 7a74688201jonasnick force-pushed on Dec 19, 2022real-or-random approvedreal-or-random commented at 1:37 PM on December 19, 2022: contributorACK 7a74688201318cbbe30b0d1601aae16dc14ee17a
hebasto approvedhebasto commented at 1:39 PM on December 19, 2022: memberre-ACK 7a74688201318cbbe30b0d1601aae16dc14ee17a
real-or-random merged this on Dec 19, 2022real-or-random closed this on Dec 19, 2022dhruv referenced this in commit 78b5ddf28b on Jan 11, 2023dhruv referenced this in commit 215394a1d5 on Jan 11, 2023dhruv referenced this in commit 6aeec7c530 on Jan 13, 2023dhruv referenced this in commit 863cf15b37 on Jan 13, 2023dhruv referenced this in commit 61f942a096 on Jan 23, 2023dhruv referenced this in commit 4d33046ce3 on Feb 1, 2023dhruv referenced this in commit 55e7f2cf2b on Feb 2, 2023stratospher referenced this in commit 647f63669e on Feb 6, 2023dhruv referenced this in commit a4351c0df6 on Feb 20, 2023stratospher referenced this in commit 23f825fc8b on Feb 21, 2023hebasto referenced this in commit 7c0cc5d976 on Mar 7, 2023dhruv referenced this in commit a5df79db12 on Mar 7, 2023dhruv referenced this in commit 77b510d84c on Mar 7, 2023sipa referenced this in commit 763079a3f1 on Mar 8, 2023div72 referenced this in commit 945b094575 on Mar 14, 2023vmta referenced this in commit e1120c94a1 on Jun 4, 2023vmta referenced this in commit 8f03457eed on Jul 1, 2023jonasnick cross-referenced this on Jul 19, 2023 from issue Upstream PRs 1174, 1154, 1178, 1177, 1171, 1158, 1183, 1185, 1186, 1188, 1187 by jonasnickContributors
This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 19:15 UTC
More mirrored repositories can be found on mirror.b10c.me