Hi Tiago,

On Thu, Aug 6, 2026 at 11:23 PM Tiago de Paula <[email protected]> wrote:
>
> Use an equivalent default value that allows profile.sh to be loaded in
> scripts with strict options ('-euo pipefail') even when not all
> debuginfod variables are defined.
>
> Both '${parameter:-[word]}' and 'set -u' are defined in POSIX Shell &
> Utilities.
>
>         * config/profile.sh.in: add fallbacks in variable expansions
>         * tests/run-debuginfod-client-profile.sh: add set -u
>
> Signed-off-by: Tiago de Paula <[email protected]>

Thanks for the patch, merged.

Aaron

> ---
>  config/profile.sh.in                   | 4 ++--
>  tests/run-debuginfod-client-profile.sh | 6 ++++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/config/profile.sh.in b/config/profile.sh.in
> index 9f3e415a..4b72e7de 100644
> --- a/config/profile.sh.in
> +++ b/config/profile.sh.in
> @@ -5,12 +5,12 @@
>  # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
>
>  prefix="@prefix@"
> -if [ -z "$DEBUGINFOD_URLS" ]; then
> +if [ -z "${DEBUGINFOD_URLS:-}" ]; then
>      DEBUGINFOD_URLS=$(find "@sysconfdir@/debuginfod" -name "*.urls"
> -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n' ' ' || :)
>      [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset
> DEBUGINFOD_URLS
>  fi
>
> -if [ -z "$DEBUGINFOD_IMA_CERT_PATH" ]; then
> +if [ -z "${DEBUGINFOD_IMA_CERT_PATH:-}" ]; then
>      DEBUGINFOD_IMA_CERT_PATH=$(find "@sysconfdir@/debuginfod" -name
> "*.certpath" -print0 2>/dev/null | xargs -0 cat 2>/dev/null | tr '\n'
> ':' || :)
>      [ -n "$DEBUGINFOD_IMA_CERT_PATH" ] && export
> DEBUGINFOD_IMA_CERT_PATH || unset DEBUGINFOD_IMA_CERT_PATH
>  fi
> diff --git a/tests/run-debuginfod-client-profile.sh
> b/tests/run-debuginfod-client-profile.sh
> index 12f5a83b..90b4b920 100755
> --- a/tests/run-debuginfod-client-profile.sh
> +++ b/tests/run-debuginfod-client-profile.sh
> @@ -18,10 +18,12 @@
>  . $srcdir/test-subr.sh
>
>  # Make sure the profile.sh or profile.d/debuginfod.sh works even with
> -# set -e (any command error is an error) and set -o pipefail (any error
> -# in a pipe fails the whole pipe command).
> +# set -e (any command error is an error), set -u (fail if a variable
> +# is unset) and set -o pipefail (any error in a pipe fails the whole
> +# pipe command).
>
>  set -e
> +set -u
>  set -o pipefail
>
>  source ${abs_top_builddir}/config/profile.sh
> --
> 2.55.0
>

Reply via email to