Re: [PATCH] Revert "scripts/faddr2line: Combine three readelf calls into one"

From: Srikar Dronamraju

Date: Thu Dec 03 2026 - 01:46:28 EST


* Josh Poimboeuf <jpoimboe@xxxxxxxxxx> [2026-12-02 20:49:52]:

> > As you can see, the last executed line line is
> >
> > 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')
> > which it self is called from run_readelf
> >
> > since sed -o errexit is set in the script, sed returns an non-zero error
> > and that causes the script to exit if the line is not found.
>
> Hm... since it's a silent failure it really seems like a pipefail.
>
> Can you run "echo $" immediately after the script to get the exit code?

echo $? returned 141 which meant the script failed due to SIGPIPE.

> And then after that, change the ELF_SECHEADERS line to:
>
> 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'; echo "PIPESTATUS=${PIPESTATUS[*]} SHELLOPTS=$SHELLOPTS" >&2)
>

faddr2line output with this change.

./scripts/faddr2line build/master/vmlinux __switch_to+0xfc/0x190 ; echo $?
braceexpand:hashall:interactive-comments:pipefail
PIPESTATUS=141 0
+SHELLOPTS=braceexpand:hashall:interactive-comments:nounset:pipefail
__switch_to+0xfc/0x190:
__switch_to at arch/powerpc/kernel/process.c:1351


Then I looked at why faddr2line is showing pipefail but not on my shell.
So apparently I have a BASH_ENV pointing to a file that has set -o pipefail.

Once I unset BASH_ENV, faddr2line works again.

> and then run again and see what is shown for PIPESTATUS and SHELLOPTS.
>
> --
> Josh

--
Thanks and Regards
Srikar Dronamraju