Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:alsoft:LFS
elfutils
0003-config-Make-sure-profile.sh-succeeds-with-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-config-Make-sure-profile.sh-succeeds-with-set-e-and-.patch of Package elfutils
From 0ba2e4aa9945019a8c6db95d27d142b660a63a79 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <mark@klomp.org> Date: Tue, 26 Mar 2024 21:42:39 +0100 Subject: [PATCH 3/4] 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> --- config/profile.sh.in | 2 +- tests/Makefile.am | 2 ++ tests/run-debuginfod-client-profile.sh | 27 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 tests/run-debuginfod-client-profile.sh diff --git a/config/profile.sh.in b/config/profile.sh.in index 3f4397dc..84d3260d 100644 --- a/config/profile.sh.in +++ b/config/profile.sh.in @@ -6,7 +6,7 @@ if [ -z "$DEBUGINFOD_URLS" ]; then prefix="@prefix@" - 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' ' ' || :) [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS unset prefix fi diff --git a/tests/Makefile.am b/tests/Makefile.am index 9315ec3b..344d6706 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -209,6 +209,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ run-disasm-riscv64.sh \ run-pt_gnu_prop-tests.sh \ run-getphdrnum.sh run-test-includes.sh \ + run-debuginfod-client-profile.sh \ leb128 read_unaligned \ msg_tst system-elf-libelf-test system-elf-gelf-test \ $(asm_TESTS) run-disasm-bpf.sh run-low_high_pc-dw-form-indirect.sh \ @@ -636,6 +637,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ testfile_pt_gnu_prop.bz2 testfile_pt_gnu_prop32.bz2 \ run-getphdrnum.sh testfile-phdrs.elf.bz2 \ run-test-includes.sh run-low_high_pc-dw-form-indirect.sh \ + run-debuginfod-client-profile.sh \ run-readelf-dw-form-indirect.sh testfile-dw-form-indirect.bz2 \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ testfile_nvidia_linemap.bz2 \ diff --git a/tests/run-debuginfod-client-profile.sh b/tests/run-debuginfod-client-profile.sh new file mode 100755 index 00000000..7435ced8 --- /dev/null +++ b/tests/run-debuginfod-client-profile.sh @@ -0,0 +1,27 @@ +#! /bin/sh +# Copyright (C) 2024 Mark J. Wielaard +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +# Make sure the profile.sh or profile.d/debuginfod.sh works even with +# set -e (any command error is an error) and set -o pipefail (any error +# in a pipe fails the whole pipe command). + +set -e +set -o pipefail + +source ${abs_top_builddir}/config/profile.sh -- 2.44.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor