|
Aaron Merey |
bb289a |
commit 0ba2e4aa9945019a8c6db95d27d142b660a63a79
|
|
Aaron Merey |
bb289a |
Author: Mark Wielaard <mark@klomp.org>
|
|
Aaron Merey |
bb289a |
Date: Tue Mar 26 21:42:39 2024 +0100
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
config: Make sure profile.sh succeeds with set -e and set -o pipefail
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
profile.sh might fail with set -o pipefail because:
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
cat /dev/null "${prefix}/etc/debuginfod"/*.urls 2>/dev/null | tr '\n' ' '
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
might fail when there isn't an *.urls file the first command in the
|
|
Aaron Merey |
bb289a |
pipe fails (the 2>/dev/null is there to hide that failure).
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
This can be fixed by adding || : at the end.
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
This works because : always succeeds and produces no outpur which is
|
|
Aaron Merey |
bb289a |
what the script expects when the command would fail.
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
Also add a new testcase that runs profile.sh with bout set -e
|
|
Aaron Merey |
bb289a |
and set -o pipefail.
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
* config/profile.sh.in: Add || : at end of pipe.
|
|
Aaron Merey |
bb289a |
* tests/run-debuginfod-client-profile.sh: New test.
|
|
Aaron Merey |
bb289a |
* tests/Makefile.am (TESTS): Add run-debuginfod-client-profile.sh.
|
|
Aaron Merey |
bb289a |
(EXTRA_DIST): Likewise.
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
https://sourceware.org/bugzilla/show_bug.cgi?id=31562
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
diff --git a/config/profile.sh.in b/config/profile.sh.in
|
|
Aaron Merey |
bb289a |
index 3f4397dcb44d..84d3260ddcfc 100644
|
|
Aaron Merey |
bb289a |
--- a/config/profile.sh.in
|
|
Aaron Merey |
bb289a |
+++ b/config/profile.sh.in
|
|
Aaron Merey |
bb289a |
@@ -6,7 +6,7 @@
|
|
Aaron Merey |
bb289a |
|
|
Aaron Merey |
bb289a |
if [ -z "$DEBUGINFOD_URLS" ]; then
|
|
Aaron Merey |
bb289a |
prefix="@prefix@"
|
|
Aaron Merey |
bb289a |
- DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ')
|
|
Aaron Merey |
bb289a |
+ DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ' || :)
|
|
Aaron Merey |
bb289a |
[ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS
|
|
Aaron Merey |
bb289a |
unset prefix
|
|
Aaron Merey |
bb289a |
fi
|
|
Aaron Merey |
bb289a |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
Aaron Merey |
bb289a |
index 9315ec3bbe4c..344d6706e16e 100644
|
|
Aaron Merey |
bb289a |
--- a/tests/Makefile.am
|
|
Aaron Merey |
bb289a |
+++ b/tests/Makefile.am
|
|
Aaron Merey |
bb289a |
@@ -209,6 +209,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
|
|
Aaron Merey |
bb289a |
run-disasm-riscv64.sh \
|
|
Aaron Merey |
bb289a |
run-pt_gnu_prop-tests.sh \
|
|
Aaron Merey |
bb289a |
run-getphdrnum.sh run-test-includes.sh \
|
|
Aaron Merey |
bb289a |
+ run-debuginfod-client-profile.sh \
|
|
Aaron Merey |
bb289a |
leb128 read_unaligned \
|
|
Aaron Merey |
bb289a |
msg_tst system-elf-libelf-test system-elf-gelf-test \
|
|
Aaron Merey |
bb289a |
$(asm_TESTS) run-disasm-bpf.sh run-low_high_pc-dw-form-indirect.sh \
|
|
Aaron Merey |
bb289a |
@@ -636,6 +637,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
|
|
Aaron Merey |
bb289a |
testfile_pt_gnu_prop.bz2 testfile_pt_gnu_prop32.bz2 \
|
|
Aaron Merey |
bb289a |
run-getphdrnum.sh testfile-phdrs.elf.bz2 \
|
|
Aaron Merey |
bb289a |
run-test-includes.sh run-low_high_pc-dw-form-indirect.sh \
|
|
Aaron Merey |
bb289a |
+ run-debuginfod-client-profile.sh \
|
|
Aaron Merey |
bb289a |
run-readelf-dw-form-indirect.sh testfile-dw-form-indirect.bz2 \
|
|
Aaron Merey |
bb289a |
run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
|
|
Aaron Merey |
bb289a |
testfile_nvidia_linemap.bz2 \
|
|
Aaron Merey |
bb289a |
diff --git a/tests/run-debuginfod-client-profile.sh b/tests/run-debuginfod-client-profile.sh
|
|
Aaron Merey |
bb289a |
new file mode 100755
|
|
Aaron Merey |
bb289a |
index 000000000000..7435ced83f15
|
|
Aaron Merey |
bb289a |
--- /dev/null
|
|
Aaron Merey |
bb289a |
+++ b/tests/run-debuginfod-client-profile.sh
|
|
Aaron Merey |
bb289a |
@@ -0,0 +1,27 @@
|
|
Aaron Merey |
bb289a |
+#! /bin/sh
|
|
Aaron Merey |
bb289a |
+# Copyright (C) 2024 Mark J. Wielaard
|
|
Aaron Merey |
bb289a |
+# This file is part of elfutils.
|
|
Aaron Merey |
bb289a |
+#
|
|
Aaron Merey |
bb289a |
+# This file is free software; you can redistribute it and/or modify
|
|
Aaron Merey |
bb289a |
+# it under the terms of the GNU General Public License as published by
|
|
Aaron Merey |
bb289a |
+# the Free Software Foundation; either version 3 of the License, or
|
|
Aaron Merey |
bb289a |
+# (at your option) any later version.
|
|
Aaron Merey |
bb289a |
+#
|
|
Aaron Merey |
bb289a |
+# elfutils is distributed in the hope that it will be useful, but
|
|
Aaron Merey |
bb289a |
+# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Aaron Merey |
bb289a |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Aaron Merey |
bb289a |
+# GNU General Public License for more details.
|
|
Aaron Merey |
bb289a |
+#
|
|
Aaron Merey |
bb289a |
+# You should have received a copy of the GNU General Public License
|
|
Aaron Merey |
bb289a |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Aaron Merey |
bb289a |
+
|
|
Aaron Merey |
bb289a |
+. $srcdir/test-subr.sh
|
|
Aaron Merey |
bb289a |
+
|
|
Aaron Merey |
bb289a |
+# Make sure the profile.sh or profile.d/debuginfod.sh works even with
|
|
Aaron Merey |
bb289a |
+# set -e (any command error is an error) and set -o pipefail (any error
|
|
Aaron Merey |
bb289a |
+# in a pipe fails the whole pipe command).
|
|
Aaron Merey |
bb289a |
+
|
|
Aaron Merey |
bb289a |
+set -e
|
|
Aaron Merey |
bb289a |
+set -o pipefail
|
|
Aaron Merey |
bb289a |
+
|
|
Aaron Merey |
bb289a |
+source ${abs_top_builddir}/config/profile.sh
|