From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: <Haixiao.Yan.CN@windriver.com>,
<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core][PATCH v2] environment.d-openssl.sh: fix unbound variable with 'set -u'
Date: Tue, 09 Sep 2025 16:16:19 +0200 [thread overview]
Message-ID: <DCOC0GHAATJU.2COUF7546LC27@bootlin.com> (raw)
In-Reply-To: <20250905123421.3940634-1-haixiao.yan.cn@windriver.com>
On Fri Sep 5, 2025 at 2:34 PM CEST, Haixiao (CN) via lists.openembedded.org Yan wrote:
> From: Haixiao Yan <haixiao.yan.cn@windriver.com>
>
> 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'.
>
> Note: environment.d-curl.sh, environment.d-python3-requests.sh,
> and environment.d-git.sh have the same issue and should be fixed
> similarly.
>
> Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
> ---
Hi Haixiao,
Thanks for your patch.
It looks like this is leading to failed SDK installations in some cases,
as some other variables are undefined:
ERROR: core-image-sato-1.0-r0 do_testsdkext: Couldn't install the extensible SDK:
Poky (Yocto Project Reference Distro) Extensible SDK installer version 5.2.99+snapshot
======================================================================================
You are about to install the SDK to "/srv/pokybuild/yocto-worker/qemuarm64-armhost/build/build/tmp/work/qemuarm64-poky-linux/core-image-sato/1.0/testsdkext". Proceed [Y/n]? Y
Extracting SDK................................................done
Setting it up...
Extracting buildtools...
Preparing build system...
Contents of preparing_build_system.log:
sh: 17: /srv/pokybuild/yocto-worker/qemuarm64-armhost/build/build/tmp/work/qemuarm64-poky-linux/core-image-sato/1.0/testsdkext/layers/build/oe-init-build-env: BASH_SOURCE: parameter not set
https://autobuilder.yoctoproject.org/valkyrie/#/builders/8/builds/2375
https://autobuilder.yoctoproject.org/valkyrie/#/builders/36/builds/2346
https://autobuilder.yoctoproject.org/valkyrie/#/builders/80/builds/2197
SDK testing environment: x86_64-pokysdk-linux
Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/buildtools/build/meta/lib/oeqa/buildtools/cases/build.py", line 21, in test_libc
self._run('. %s/oe-init-build-env %s' % (corebase, testdir))
File "/srv/pokybuild/yocto-worker/buildtools/build/meta/lib/oeqa/sdk/case.py", line 17, in _run
return subprocess.check_output(". %s > /dev/null; %s;" % \
File "/usr/lib64/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib64/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
oeqa.utils.subprocesstweak.OETestCalledProcessError: Command '. /srv/pokybuild/yocto-worker/buildtools/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/buildtools-tarball/1.0/testimage-sdk/environment-setup-x86_64-pokysdk-linux > /dev/null; . /srv/pokybuild/yocto-worker/buildtools/build/oe-init-build-env /srv/pokybuild/yocto-worker/buildtools/build/build/tmp/work/x86_64-nativesdk-pokysdk-linux/buildtools-tarball/1.0/testimage-sdk/bitbake-build-vbmlrryg;' returned non-zero exit status 1.
Standard Output: /srv/pokybuild/yocto-worker/buildtools/build/oe-init-build-env: line 29: BBSERVER: unbound variable
https://autobuilder.yoctoproject.org/valkyrie/#/builders/43/builds/2371
Can you fix these failures please?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-09-09 14:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 12:34 [OE-core][PATCH v2] environment.d-openssl.sh: fix unbound variable with 'set -u' haixiao.yan.cn
2025-09-09 14:16 ` Mathieu Dubois-Briand [this message]
2025-09-10 8:52 ` Haixiao Yan
2025-09-11 13:28 ` Andreas Helbech Kleist
2025-09-12 2:02 ` Yan, Haixiao (CN)
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=DCOC0GHAATJU.2COUF7546LC27@bootlin.com \
--to=mathieu.dubois-briand@bootlin.com \
--cc=Haixiao.Yan.CN@windriver.com \
--cc=openembedded-core@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.