[PATCH] config: Make sure profile.sh succeeds with set -e and set -o pipefail

Dmitry V. Levin ldv@strace.io
Tue Mar 26 22:59:13 GMT 2024


On Tue, Mar 26, 2024 at 09:49:48PM +0100, Mark Wielaard wrote:
> 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).
[...]
> -    DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ')
> +    DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || echo -n "")

The idiomatic expression in this case is ||:


-- 
ldv


More information about the Elfutils-devel mailing list