]> git.ipfire.org Git - thirdparty/elfutils.git/commit
config: Make sure profile.sh succeeds with set -e and set -o pipefail
authorMark Wielaard <mark@klomp.org>
Tue, 26 Mar 2024 20:42:39 +0000 (21:42 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 27 Mar 2024 13:49:27 +0000 (14:49 +0100)
commit0ba2e4aa9945019a8c6db95d27d142b660a63a79
treec3fe539e1d95a41b8f955bced1bee93dc23db6c6
parent8f3818574a6abe1fbab1682698b2cef146522148
config: Make sure profile.sh succeeds with set -e and set -o pipefail

profile.sh might fail with set -o pipefail because:

cat /dev/null "${prefix}/etc/debuginfod"/*.urls 2>/dev/null | tr '\n' ' '

might fail when there isn't an *.urls file the first command in the
pipe fails (the 2>/dev/null is there to hide that failure).

This can be fixed by adding || : at the end.

This works because : always succeeds and  produces no outpur which is
what the script expects when the command would fail.

Also add a new testcase that runs profile.sh with bout  set -e
and set -o pipefail.

* config/profile.sh.in: Add || : at end of pipe.
* tests/run-debuginfod-client-profile.sh: New test.
* tests/Makefile.am (TESTS): Add run-debuginfod-client-profile.sh.
(EXTRA_DIST): Likewise.

https://sourceware.org/bugzilla/show_bug.cgi?id=31562

Signed-off-by: Mark Wielaard <mark@klomp.org>
config/profile.sh.in
tests/Makefile.am
tests/run-debuginfod-client-profile.sh [new file with mode: 0755]