* [PATCH v2] [gdb/config/djgpp] Make djcheck.sh and djconfig.sh shellcheck-clean
@ 2026-09-01 7:36 Tom de Vries
2026-09-01 13:05 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2026-09-01 7:36 UTC (permalink / raw)
To: gdb-patches
Make gdb/config/djgpp/{djcheck.sh,djconfig.sh} shellcheck-clean:
- add missing quotes
- add "|| exit 1" after cd
- use printf instead of echo -n
- disable SC2016 for "configure --prefix='${DJDIR}' assuming ${DJDIR} is
indeed not meant to be expanded
Add a .shellcheckrc to disable SC2006 to allow legacy backticked `...`.
I don't have a djgpp setup, so I can't test this.
Changes in v2:
- disable SC2006
Versions:
- v1 https://sourceware.org/pipermail/gdb-patches/2026-August/229858.html
---
gdb/config/djgpp/.shellcheckrc | 4 ++
gdb/config/djgpp/djcheck.sh | 18 ++++----
gdb/config/djgpp/djconfig.sh | 75 +++++++++++++++++-----------------
gdb/contrib/shellcheck.sh | 4 +-
4 files changed, 52 insertions(+), 49 deletions(-)
create mode 100644 gdb/config/djgpp/.shellcheckrc
diff --git a/gdb/config/djgpp/.shellcheckrc b/gdb/config/djgpp/.shellcheckrc
new file mode 100644
index 00000000000..cef62c6c16f
--- /dev/null
+++ b/gdb/config/djgpp/.shellcheckrc
@@ -0,0 +1,4 @@
+# There's a concern that $(...) is not (sufficiently) supported on DJGPP [1].
+# Disable SC2006 to allow legacy backticked `...`.
+# [1] https://sourceware.org/pipermail/gdb-patches/2026-August/229860.html
+disable=SC2006
diff --git a/gdb/config/djgpp/djcheck.sh b/gdb/config/djgpp/djcheck.sh
index fa75d03f776..e7e03315301 100644
--- a/gdb/config/djgpp/djcheck.sh
+++ b/gdb/config/djgpp/djcheck.sh
@@ -18,30 +18,30 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
ORIGDIR=`pwd`
-GDB=${ORIGDIR}/../gdb.exe
-SUBDIRS=`find $ORIGDIR -type d ! -ipath $ORIGDIR`
+GDB="${ORIGDIR}/../gdb.exe"
+SUBDIRS=`find "$ORIGDIR" -type d ! -ipath "$ORIGDIR"`
for d in $SUBDIRS
do
- cd $d
+ cd "$d" || exit 1
echo "Running tests in $d..."
for f in *.out
do
- test -f $f || break
- base=`basename $f .out`
+ test -f "$f" || break
+ base=`basename "$f" .out`
if test "${base}" = "dbx" ; then
options=-dbx
else
options=
fi
- $GDB ${options} < ${base}.in 2>&1 \
+ $GDB ${options} < "${base}.in" 2>&1 \
| sed -e '/GNU gdb /s/ [.0-9][.0-9]*//' \
-e '/^Copyright/s/[12][0-9][0-9][0-9]/XYZZY/g' \
-e '/Starting program: /s|[A-z]:/.*/||' \
-e '/main (/s/=0x[0-9a-f][0-9a-f]*/=XYZ/g' \
- > ${base}.tst
- if diff --binary -u ${base}.out ${base}.tst ; then
- rm -f ${base}.tst
+ > "${base}.tst"
+ if diff --binary -u "${base}.out" "${base}.tst" ; then
+ rm -f "${base}.tst"
fi
done
done
diff --git a/gdb/config/djgpp/djconfig.sh b/gdb/config/djgpp/djconfig.sh
index b630e6c0c58..27fea185cae 100644
--- a/gdb/config/djgpp/djconfig.sh
+++ b/gdb/config/djgpp/djconfig.sh
@@ -40,30 +40,30 @@ unset CDPATH
# then only forward slashes (/) in the directories. It should be
# an absolute path.
-if [ x$1 = x ]; then
+if [ "$1" = "" ]; then
srcdir=`pwd`
else
- srcdir=`cd $1 && pwd`
+ srcdir=`cd "$1" && pwd` || exit 1
shift
fi
# Make sure they don't have some file names mangled by untarring.
-echo -n "Checking the unpacked distribution..."
-if ( ! test -f ${srcdir}/bfd/ChangeLog.0203 || \
- ! test -f ${srcdir}/gdb/ChangeLog.002 || \
- ! test -f ${srcdir}/opcodes/ChangeLog.0203 || \
- ! test -f ${srcdir}/readline/config.h-in ) ; then
- if ( ! test -f ${srcdir}/bfd/ChangeLog.0203 ) ; then
- notfound=${srcdir}/bfd/ChangeLog.0203
+printf "Checking the unpacked distribution..."
+if ! test -f "${srcdir}/bfd/ChangeLog.0203" || \
+ ! test -f "${srcdir}/gdb/ChangeLog.002" || \
+ ! test -f "${srcdir}/opcodes/ChangeLog.0203" || \
+ ! test -f "${srcdir}/readline/config.h-in"; then
+ if ! test -f "${srcdir}/bfd/ChangeLog.0203"; then
+ notfound="${srcdir}/bfd/ChangeLog.0203"
else
- if ( ! test -f ${srcdir}/gdb/ChangeLog.002) ; then
- notfound=${srcdir}/gdb/ChangeLog.002
+ if ! test -f "${srcdir}/gdb/ChangeLog.002"; then
+ notfound="${srcdir}/gdb/ChangeLog.002"
else
- if ( ! test -f ${srcdir}/readline/config.h-in ) ; then
- notfound=${srcdir}/readline/config.h-in
+ if ! test -f "${srcdir}/readline/config.h-in"; then
+ notfound="${srcdir}/readline/config.h-in"
else
- if ( ! test -f ${srcdir}/opcodes/ChangeLog.0203 ) ; then
- notfound=${srcdir}/opcodes/ChangeLog.0203
+ if ! test -f "${srcdir}/opcodes/ChangeLog.0203"; then
+ notfound="${srcdir}/opcodes/ChangeLog.0203"
fi
fi
fi
@@ -85,7 +85,7 @@ else
fi
# Where is the directory with DJGPP-specific scripts?
-DJGPPDIR=${srcdir}/gdb/config/djgpp
+DJGPPDIR="${srcdir}/gdb/config/djgpp"
echo "Editing configure scripts for DJGPP..."
TMPFILE="${TMPDIR-.}/cfg.tmp"
@@ -103,22 +103,22 @@ fi
# We use explicit /dev/env/DJDIR/bin/find to avoid catching
# an incompatible DOS/Windows version that might be on their PATH.
for fix_dir in \
- `cd $srcdir && /dev/env/DJDIR/bin/find . -type d ! -ipath "${SKIPDIR}" ! -ipath "${SKIPFILES}"`
+ `cd "$srcdir" && /dev/env/DJDIR/bin/find . -type d ! -ipath "${SKIPDIR}" ! -ipath "${SKIPFILES}"`
do
- if test ! -f ${fix_dir}/configure.orig ; then
- if test -f ${srcdir}/${fix_dir}/configure ; then
- mkdir -p ${fix_dir}
- cp -p ${srcdir}/${fix_dir}/configure ${fix_dir}/configure.orig
+ if test ! -f "${fix_dir}/configure.orig" ; then
+ if test -f "${srcdir}/${fix_dir}/configure" ; then
+ mkdir -p "${fix_dir}"
+ cp -p "${srcdir}/${fix_dir}/configure" "${fix_dir}/configure.orig"
fi
fi
- if test -f ${fix_dir}/configure.orig ; then
- sed -f ${DJGPPDIR}/config.sed ${fix_dir}/configure.orig > $TMPFILE
- update $TMPFILE ${fix_dir}/configure
- touch ./${fix_dir}/configure -r ${fix_dir}/configure.orig
- rm -f $TMPFILE
+ if test -f "${fix_dir}/configure.orig" ; then
+ sed -f "${DJGPPDIR}/config.sed" "${fix_dir}/configure.orig" > "$TMPFILE"
+ update "$TMPFILE" "${fix_dir}/configure"
+ touch "./${fix_dir}/configure" -r "${fix_dir}/configure.orig"
+ rm -f "$TMPFILE"
fi
- if test -f ${fix_dir}/INSTALL ; then
- mv ${fix_dir}/INSTALL ${fix_dir}/INSTALL.txt
+ if test -f "${fix_dir}/INSTALL" ; then
+ mv "${fix_dir}/INSTALL" "${fix_dir}/INSTALL.txt"
fi
done
@@ -134,7 +134,7 @@ export CONFIG_SHELL=/dev/env/DJDIR/bin/sh.exe
# force to have the ltmain.sh script to be in DOS text format,
# otherwise the resulting ltconfig script will have mixed
# (UNIX/DOS) format and is unusable with Bash ports before v2.03.
-utod $srcdir/ltmain.sh
+utod "$srcdir/ltmain.sh"
# Give the configure script some hints:
export LD=ld
@@ -159,16 +159,16 @@ export lt_cv_sys_max_cmd_len=12288
# Force depcomp to use _deps rather than .deps as the name of the
# subdirectory where the *.Po dependency files are put. File names
# with leading dots are invalid on DOS 8+3 filesystems.
-export DEPDIR=${DEPDIR:-_deps}
+export DEPDIR="${DEPDIR:-_deps}"
# The configure script needs to see the `install-sh' script, otherwise
# it decides the source installation is broken. But "make install" will
# fail on 8+3 filesystems if it finds a file `install-', since there
# are numerous "install-foo" targets in Makefile's. So we rename the
# offending file after the configure step is done.
-if test ! -f ${srcdir}/install-sh ; then
- if test -f ${srcdir}/install-.sh ; then
- mv ${srcdir}/install-.sh ${srcdir}/install-sh
+if test ! -f "${srcdir}/install-sh" ; then
+ if test -f "${srcdir}/install-.sh" ; then
+ mv "${srcdir}/install-.sh" "${srcdir}/install-sh"
fi
fi
@@ -176,10 +176,11 @@ fi
# support, which is nearly impossible to be supported in the current way,
# since it relies on file names which will never work on DOS.
echo "Running the configure script..."
-$srcdir/configure --srcdir="$srcdir" --prefix='${DJDIR}' \
+# shellcheck disable=SC2016 # $DJDIR is not expanded here.
+"$srcdir/configure" --srcdir="$srcdir" --prefix='${DJDIR}' \
--disable-shared --disable-nls --verbose --enable-build-warnings=\
--Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith,-Wuninitialized $*
+-Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith,-Wuninitialized "$@"
-if test -f ${srcdir}/install- ; then
- mv ${srcdir}/install- ${srcdir}/install-.sh
+if test -f "${srcdir}/install-" ; then
+ mv "${srcdir}/install-" "${srcdir}/install-.sh"
fi
diff --git a/gdb/contrib/shellcheck.sh b/gdb/contrib/shellcheck.sh
index ad59e2b0871..6f5634ce38e 100755
--- a/gdb/contrib/shellcheck.sh
+++ b/gdb/contrib/shellcheck.sh
@@ -41,9 +41,7 @@ for f in "$@"; do
# Skip generated files.
continue
;;
- gdb/config/djgpp/djcheck.sh \
- | gdb/config/djgpp/djconfig.sh \
- | gdb/contrib/gdb-add-index.sh \
+ gdb/contrib/gdb-add-index.sh \
| gdb/gdb_buildall.sh \
| gdb/gdb_mbuild.sh )
# Skip unclean files.
base-commit: 2e9a026c2cd76b09f863ba877a1c492ebda76ee0
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] [gdb/config/djgpp] Make djcheck.sh and djconfig.sh shellcheck-clean
2026-09-01 7:36 [PATCH v2] [gdb/config/djgpp] Make djcheck.sh and djconfig.sh shellcheck-clean Tom de Vries
@ 2026-09-01 13:05 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2026-09-01 13:05 UTC (permalink / raw)
To: Tom de Vries, DJ Delorie; +Cc: gdb-patches
> From: Tom de Vries <tdevries@suse.de>
> Date: Tue, 1 Sep 2026 09:36:26 +0200
>
> Make gdb/config/djgpp/{djcheck.sh,djconfig.sh} shellcheck-clean:
> - add missing quotes
> - add "|| exit 1" after cd
> - use printf instead of echo -n
> - disable SC2016 for "configure --prefix='${DJDIR}' assuming ${DJDIR} is
> indeed not meant to be expanded
>
> Add a .shellcheckrc to disable SC2006 to allow legacy backticked `...`.
>
> I don't have a djgpp setup, so I can't test this.
>
> Changes in v2:
> - disable SC2006
>
> Versions:
> - v1 https://sourceware.org/pipermail/gdb-patches/2026-August/229858.html
> ---
> gdb/config/djgpp/.shellcheckrc | 4 ++
> gdb/config/djgpp/djcheck.sh | 18 ++++----
> gdb/config/djgpp/djconfig.sh | 75 +++++++++++++++++-----------------
> gdb/contrib/shellcheck.sh | 4 +-
> 4 files changed, 52 insertions(+), 49 deletions(-)
> create mode 100644 gdb/config/djgpp/.shellcheckrc
Thanks. This basically encloses various file names in quotes to cater
to whitespace and other special characters, AFAICT, so it's trivially
okay.
DJ, if you can spare a moment to look over this, I'd appreciate.
Approved-By: Eli Zaretskii <eliz@gnu.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-01 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 7:36 [PATCH v2] [gdb/config/djgpp] Make djcheck.sh and djconfig.sh shellcheck-clean Tom de Vries
2026-09-01 13:05 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox