* [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
* [Bug debuginfod/31562] profile.sh might fail with set -o pipefail
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 ` amerey at redhat dot com
2024-03-26 20:50 ` mark at klomp dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: amerey at redhat dot com @ 2024-03-26 20:37 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=31562
Aaron Merey <amerey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amerey at redhat dot com
Assignee|unassigned at sourceware dot org |amerey at redhat dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debuginfod/31562] profile.sh might fail with set -o pipefail
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
3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-26 20:50 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=31562
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Proposed patch:
https://inbox.sourceware.org/elfutils-devel/20240326204948.794765-1-mark@klomp.org/
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debuginfod/31562] profile.sh might fail with set -o pipefail
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
3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-27 13:58 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=31562
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
commit 0ba2e4aa9945019a8c6db95d27d142b660a63a79
Author: Mark Wielaard <mark@klomp.org>
Date: Tue Mar 26 21:42:39 2024 +0100
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>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debuginfod/31562] profile.sh might fail with set -o pipefail
2024-03-26 19:48 [Bug debuginfod/31562] New: profile.sh might fail with set -o pipefail mark at klomp dot org
` (2 preceding siblings ...)
2024-03-27 13:58 ` mark at klomp dot org
@ 2024-03-27 14:44 ` mark at klomp dot org
3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-27 14:44 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=31562
--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Note that the testcase would fail on systems where /bin/sh !== bash. Fixed with
a followup patch:
commit 3f956f8f8609f508ead2becc594c2338681cc6d0
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Mar 27 15:25:16 2024 +0100
tests: Use bash for run-debuginfod-client-profile.sh
The test uses set -o pipefail which is a bashism and so the test fails
on systems where /bin/sh isn't bash.
* tests/run-debuginfod-client-profile.sh: Use bash.
Signed-off-by: Mark Wielaard <mark@klomp.org>
--
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).