]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
buildtools-tarball: fix unbound variable issues under 'set -u'
authorHaixiao Yan <haixiao.yan.cn@windriver.com>
Tue, 16 Sep 2025 13:19:18 +0000 (21:19 +0800)
committerSteve Sakoman <steve@sakoman.com>
Wed, 17 Sep 2025 16:32:52 +0000 (09:32 -0700)
commit4cf131ebd157b79226533b5a5074691dd0e1a4ab
tree12df206c0f27b6019099ae6e4ed517daee6a1397
parent0276bd0e8d5cefb6f98d685bc9faa0451780bef9
buildtools-tarball: fix unbound variable issues under 'set -u'

When Bash runs with 'set -u' (nounset), accessing an unset variable
directly (e.g. [ -z "$SSL_CERT_FILE" ]) causes a fatal "unbound variable"
error. As a result, the fallback logic to set SSL_CERT_FILE/SSL_CERT_DIR
is never triggered and the script aborts.

The current code assumes these variables may be unset or empty, but does
not guard against 'set -u'. This breaks builds in stricter shell
environments or when users explicitly enable 'set -u'.

Fix this by using parameter expansion with a default value, e.g.
"${SSL_CERT_FILE:-}", so that unset variables are treated as empty
strings. This preserves the intended logic (respect host env first, then
CAFILE/CAPATH, then buildtools defaults) and makes the script robust
under 'set -u'.

Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4d880c2eccd534133a2a4e6579d955605c0956ec)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-connectivity/openssl/files/environment.d-openssl.sh
meta/recipes-devtools/git/git/environment.d-git.sh
meta/recipes-devtools/python/python3-requests/environment.d-python3-requests.sh
meta/recipes-support/curl/curl/environment.d-curl.sh