public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug debuginfod/31562] New: profile.sh might fail with set -o pipefail
@ 2024-03-26 19:48 mark at klomp dot org
  2024-03-26 20:37 ` [Bug debuginfod/31562] " amerey at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-26 19:48 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 31562
           Summary: profile.sh might fail with set -o pipefail
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: debuginfod
          Assignee: unassigned at sourceware dot org
          Reporter: mark at klomp dot org
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

With set -o pipefail profile.sh might fail on:

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

This is because if 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 something like || echo -n "" like:

DEBUGINFOD_URLS=$(cat /dev/null "${prefix}/etc/debuginfod"/*.urls 2>/dev/null |
tr '\n' ' ' || echo -n "")

This works because echo -n "" produces the empty string, so the next line will
still unset DEBUGINFOD_URLS in that case:

[ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-27 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 19:48 [Bug debuginfod/31562] New: profile.sh might fail with set -o pipefail mark at klomp dot org
2024-03-26 20:37 ` [Bug debuginfod/31562] " amerey at redhat dot com
2024-03-26 20:50 ` mark at klomp dot org
2024-03-27 13:58 ` mark at klomp dot org
2024-03-27 14:44 ` mark at klomp dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).