public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@strace.io>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] config: Make sure profile.sh succeeds with set -e and set -o pipefail
Date: Wed, 27 Mar 2024 00:59:13 +0200	[thread overview]
Message-ID: <20240326225913.GA28349@altlinux.org> (raw)
In-Reply-To: <20240326204948.794765-1-mark@klomp.org>

On Tue, Mar 26, 2024 at 09:49:48PM +0100, Mark Wielaard wrote:
> 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).
[...]
> -    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' ' ' || echo -n "")

The idiomatic expression in this case is ||:


-- 
ldv

  reply	other threads:[~2024-03-26 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 20:49 Mark Wielaard
2024-03-26 22:59 ` Dmitry V. Levin [this message]
2024-03-27 13:52   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240326225913.GA28349@altlinux.org \
    --to=ldv@strace.io \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).