mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Srikar Dronamraju <srikar@linux.ibm.com>
Cc: Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	 Madhavan Srinivasan <maddy@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Revert "scripts/faddr2line: Combine three readelf calls into one"
Date: Wed, 2 Dec 2026 15:27:26 -0800	[thread overview]
Message-ID: <axCo-rpJOROhVCWl@jpoimboe> (raw)
In-Reply-To: <aqiqScJg8Ey5QnKl@linux.ibm.com>

On Tue, Sep 15, 2026 at 07:45:37AM +0530, Srikar Dronamraju wrote:
> The other options are
> 
> 1.  to reset sed -o errexit  in run_readelf
> diff --git a/scripts/faddr2line b/scripts/faddr2line
> index 622875396bcf..f1b83913d08c 100755
> --- a/scripts/faddr2line
> +++ b/scripts/faddr2line
> @@ -116,12 +116,14 @@ run_readelf() {
>  
>  	${READELF} --file-header --section-headers --symbols --wide "$objfile" > "$tmpfile"
>  
> +	set +o errexit
>  	# This assumes that readelf first prints the file header, then the section headers, then the symbols.
>  	# Note: It seems that GNU readelf does not prefix section headers with the "There are X section headers"
>  	# line when multiple options are given, so let's also match with the "Section Headers:" line.
>  	ELF_FILEHEADER=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/q;p' "$tmpfile")
>  	ELF_SECHEADERS=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/,$p' "$tmpfile" | sed -n '/Symbol table .* contains [0-9]* entries:/q;p')
>  	ELF_SYMS=$(sed -n '/Symbol table .* contains [0-9]* entries:/,$p' "$tmpfile")
> +	set -o errexit
>  
>  	rm -f -- "$tmpfile"
>  }
> 
> 
> 2. or use || true with sed, so that it doesn't fail.
> 
> diff --git a/scripts/faddr2line b/scripts/faddr2line
> index 622875396bcf..6e867b053ac4 100755
> --- a/scripts/faddr2line
> +++ b/scripts/faddr2line
> @@ -119,9 +119,9 @@ run_readelf() {
>  	# This assumes that readelf first prints the file header, then the section headers, then the symbols.
>  	# Note: It seems that GNU readelf does not prefix section headers with the "There are X section headers"
>  	# line when multiple options are given, so let's also match with the "Section Headers:" line.
> -	ELF_FILEHEADER=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/q;p' "$tmpfile")
> -	ELF_SECHEADERS=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/,$p' "$tmpfile" | sed -n '/Symbol table .* contains [0-9]* entries:/q;p')
> -	ELF_SYMS=$(sed -n '/Symbol table .* contains [0-9]* entries:/,$p' "$tmpfile")
> +	ELF_FILEHEADER=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/q;p' "$tmpfile" || true)
> +	ELF_SECHEADERS=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/,$p' "$tmpfile" | sed -n '/Symbol table .* contains [0-9]* entries:/q;p' || true)
> +	ELF_SYMS=$(sed -n '/Symbol table .* contains [0-9]* entries:/,$p' "$tmpfile" || true)
>  
>  	rm -f -- "$tmpfile"
>  }
> 
> Note: only the SECHEADERS line needs true but adding true to just that line looks hacky.

Hm, do you have SHELLOPTS=pipefail set in your environment?

-- 
Josh

  parent reply	other threads:[~2026-12-02 23:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05  1:24 Srikar Dronamraju
2026-09-14 19:00 ` Josh Poimboeuf
2026-09-15  2:15   ` Srikar Dronamraju
2026-09-23  9:26     ` Srikar Dronamraju
2026-11-25 15:47       ` Srikar Dronamraju
2026-12-02 23:27     ` Josh Poimboeuf [this message]
2026-12-03  2:37       ` Srikar Dronamraju
2026-12-03  4:49     ` Josh Poimboeuf
2026-12-03  6:46       ` Srikar Dronamraju

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=axCo-rpJOROhVCWl@jpoimboe \
    --to=jpoimboe@kernel.org \
    --cc=bjohannesmeyer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=srikar@linux.ibm.com \
    /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

all inboxes | Powered by JetHome®