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.

Reply via email to