From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] [gdb] Make regformats/regdat.sh shellcheck-clean
Date: Fri, 28 Aug 2026 08:43:28 -0400 [thread overview]
Message-ID: <17c2d558-7cd7-4906-8fa2-b4f21f56f52a@simark.ca> (raw)
In-Reply-To: <20260828120439.3857602-2-tdevries@suse.de>
On 2026-08-28 08:04, Tom de Vries wrote:
> Make regformats/regdat.sh shellcheck-clean:
> - use read -r
> - use $()
> - ignore intentional word-splitting
> - add missing quotes
> - use $(())
>
> Handle a shellcheck error in this:
> ...
> if eval test \"\${${r}}\" = \"\ \"
> ...
> by simplifying to:
> ...
> eval "rvalue=\$$r"
> if test "${rvalue:-}" = " "
> ...
>
> Note that shellcheck can't detect that rvalue is assigned to, so we use
> '${parameter:-word}' to use default value "", to silence a SC2154 [1].
>
> Also, handle a shellcheck error in this:
> ...
> eval ${r}=""
> ...
> by simplifying to:
> ...
> eval "$r=''"
> ...
>
> Tested on x86_64-linux using:
> ...
> $ for f in $(find gdb/regformats -name "*.dat"); do \
> sh gdb/regformats/regdat.sh \
> $f \
> gdbsupport/osabi.def \
> $(echo $f | sed 's%/%-%g'); \
> done
> ...
> and comparing the generated files with and without this patch.
LGTM, thanks.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Random thought: I wonder why we don't check in the result of running
regdat.sh in the repo, like we do for gdbarch-gen.{c,h},
target-delegates-gen.c, and the features directory. The output doesn't
change from build to build, and that would make it easy to see that your
patch did not produce any change in the output files.
Simon
next prev parent reply other threads:[~2026-08-28 12:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 12:04 [PATCH 0/2] [gdb] Two regformats/regdat.sh fixes Tom de Vries
2026-08-28 12:04 ` [PATCH 1/2] [gdb] Make regformats/regdat.sh shellcheck-clean Tom de Vries
2026-08-28 12:43 ` Simon Marchi [this message]
2026-08-28 14:40 ` Tom de Vries
2026-08-28 13:34 ` Andreas Schwab
2026-08-28 14:04 ` Tom de Vries
2026-08-28 12:04 ` [PATCH 2/2] [gdb] Fix unbound variable in regformats/regdat.sh Tom de Vries
2026-08-28 12:46 ` Simon Marchi
2026-08-28 14:19 ` Tom de Vries
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=17c2d558-7cd7-4906-8fa2-b4f21f56f52a@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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