Re: [PATCH] scripts/decode_stacktrace.sh: remove trailing space

From: Carlos Llamas
Date: Mon Oct 07 2024 - 15:29:43 EST


On Thu, Oct 03, 2024 at 03:30:05AM -0700, Breno Leitao wrote:
> decode_stacktrace.sh adds a trailing space at the end of the decoded
> stack if the module is not set (in most of the lines), which makes the
> some lines of the stack having trailing space and some others not.
>
> Do not add an extra space at the end of the line if module is not set,
> adding consistency in output formatting.
>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> ---
> scripts/decode_stacktrace.sh | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
> index 826836d264c6..4b3502a007fd 100755
> --- a/scripts/decode_stacktrace.sh
> +++ b/scripts/decode_stacktrace.sh
> @@ -311,7 +311,12 @@ handle_line() {
> parse_symbol # modifies $symbol
>
> # Add up the line number to the symbol
> - echo "${words[@]}" "$symbol $module"
> + if [ -z ${module} ]
> + then

nit: it seems the convention would have been something like:
if [[ -z $module ]]; then

> + echo "${words[@]}" "$symbol"
> + else
> + echo "${words[@]}" "$symbol $module"

I guess the space could have also been prepended in module above? e.g
module=" $module"

> + fi
> }
>
> while read line; do
> --
> 2.43.5
>

...either way this looks good to me.

Reviewed-by: Carlos Llamas <cmllamas@xxxxxxxxxx>