aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python-internal.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2025-09-19 16:44:13 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2025-09-19 20:28:57 -0400
commit5a60265e41769b7e1d176bda075738326c9ee2d8 (patch)
tree6b31b73e0176861e5b1ce6bab0689638d2670f6b /gdb/python/python-internal.h
parenta1ea391005f1539e7045df2a42b0902a879ea910 (diff)
downloadbinutils-5a60265e41769b7e1d176bda075738326c9ee2d8.zip
binutils-5a60265e41769b7e1d176bda075738326c9ee2d8.tar.gz
binutils-5a60265e41769b7e1d176bda075738326c9ee2d8.tar.bz2
gdb: fix long options with arguments in gcore-1.in and gstack-1.in
Shellcheck 0.11.0 produces the same warning for gcore-1.in and gstack-1.in: In gcore-1.in line 74: OPTARG="${OPTARG#'$OPT'}" ^----^ SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. In gstack-1.in line 67: OPTARG="${OPTARG#$OPT}" ^--^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. The code in question exists to handle long option with arguments by hand, like `--foo=bar`, since that is not supported natively by getopts. At that line, OPTARG would contain `foo=bar`, OPT would contain `foo`, and we're trying to strip `$OPT` from the beginning of `$OPTARG`. For this to work, OPT needs to be expanded, and therefore needs double quotes (or no quotes at all, but then shellcheck complains). This bug is harmless right now because we don't use long options with arguments. I tested this by temporarily making gcore support -o|--output: o | output) prefix=$OPTARG ;; And verified that this works: $ ./gcore --output=salut 51286 ... Saved corefile salut.51286 ... Change-Id: I025be574699d67b18ada9d73ce8f2aa0c87d5a0d Reviewed-By: Sébastien Darche <sdarche@efficios.com> Reviewed-By: Keith Seitz <keiths@redhat.com>
Diffstat (limited to 'gdb/python/python-internal.h')
0 files changed, 0 insertions, 0 deletions