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

Reply via email to