public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: Breno Leitao <leitao@debian.org>
Cc: akpm@linux-foundation.org,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Elliot Berman <quic_eberman@quicinc.com>,
	Xiong Nandi <xndchn@gmail.com>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	Bjorn Andersson <quic_bjorande@quicinc.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scripts/decode_stacktrace.sh: remove trailing space
Date: Tue, 8 Oct 2024 18:01:11 +0000	[thread overview]
Message-ID: <ZwVzZ2TfmS7pLOdh@google.com> (raw)
In-Reply-To: <ZwUVBW72bZQNaWqt@gmail.com>

On Tue, Oct 08, 2024 at 12:18:29PM +0100, Breno Leitao wrote:
> Hello Carlos,
> 
> On Mon, Oct 07, 2024 at 07:29:27PM +0000, Carlos Llamas wrote:
> > 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@debian.org>
> > > ---
> > >  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
> 
> That is how I wrote originally, in fact, but, the rest of the code is
> using the other way. Example:
> 
>         if [ -z $release ] ; then

This is actually problematic if $release can have any spaces but I
suspect it's not possible here. I'd still either quote "$release" or use
double brackets e.g. [[ -z $release ]] to be safe.

BTW, I assume $module can't have any spaces either?

>                 release=$(gdb -ex 'print init_uts_ns.name.release' -ex 'quit' -quiet -batch "$vmlinux" 2>/dev/null | sed -n 's/\$1 = "\(.*\)".*/\1/p')
>         fi
>         if [ -n "${release}" ] ; then

Yeah, there is no need for the curly braces here, they are not doing
anything.

>                 release_dirs="/usr/lib/debug/lib/modules/$release /lib/modules/$release"
>         fi
> 
> Thanks for the review,
> Breno

Note that I was initally referring to the 'then' being on a new line but
these are all minor nits.

Cheers,
Carlos Llamas

  reply	other threads:[~2024-10-08 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 10:30 [PATCH] scripts/decode_stacktrace.sh: remove trailing space Breno Leitao
2024-10-04 20:30 ` Stephen Boyd
2024-10-07 19:29 ` Carlos Llamas
2024-10-08 11:18   ` Breno Leitao
2024-10-08 18:01     ` Carlos Llamas [this message]
2024-10-10 21:14 ` Elliot Berman

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=ZwVzZ2TfmS7pLOdh@google.com \
    --to=cmllamas@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kent.overstreet@linux.dev \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_eberman@quicinc.com \
    --cc=swboyd@chromium.org \
    --cc=xndchn@gmail.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