diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2024-02-07 22:56:04 +0000 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2024-05-01 21:45:11 +0200 |
commit | b9ef20909b7def53db94bd0bbec4bc798746a6ac (patch) | |
tree | 2b7ce7feb167284af1f6151856d22cf4ec608c6b | |
parent | 57b9d78e8a4713f5bab9608ea7b07cb9dbbf419e (diff) | |
download | tcpdump-b9ef20909b7def53db94bd0bbec4bc798746a6ac.tar.gz |
Extend "make shellcheck" onto mkdep too. [skip appveyor]
For shell trap purposes, "1 2 3 13 15" is the same as "HUP INT QUIT PIPE
TERM" in AIX, FreeBSD, Hurd, illumos, Linux, macOS, NetBSD, OpenBSD and
Solaris. However, in Haiku SIGPIPE is 7 and 13 is SIGTSTP.
Address all warnings from shellcheck 0.9.0:
mkdep:66:11: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:73:34: warning: Trapping signals by number is not well defined.
Prefer signal names. [SC2172]
mkdep:75:4: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:75:10: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:77:41: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:77:49: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:79:17: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:97:16: warning: Use "$@" (with quotes) to prevent whitespace problems.
[SC2048]
mkdep:103:5: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:103:23: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:103:30: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:106:11: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:108:17: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:114:4: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:114:9: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:115:7: note: Double quote to prevent globbing and word splitting.
[SC2086]
mkdep:115:19: note: Double quote to prevent globbing and word splitting.
[SC2086]
(cherry picked from commit 983d4321e9579c09ab6aaa3896b1a834be95fca6)
-rw-r--r-- | Makefile.in | 2 | ||||
-rwxr-xr-x | mkdep | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/Makefile.in b/Makefile.in index 2d70dccd..e991cce2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -578,4 +578,4 @@ depend: @$(MKDEP) -c $(CC) -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) $(LIBNETDISSECT_SRC) shellcheck: - shellcheck -f gcc -e SC2006 autogen.sh build.sh build_matrix.sh build_common.sh .ci-coverity-scan-build.sh + shellcheck -f gcc -e SC2006 autogen.sh build.sh build_matrix.sh build_common.sh mkdep .ci-coverity-scan-build.sh @@ -63,20 +63,20 @@ if [ $# = 0 ] ; then exit 1 fi -if [ ! -w $MAKE ]; then +if [ ! -w "$MAKE" ]; then echo "mkdep: no writeable file \"$MAKE\"" exit 1 fi TMP=${TMPDIR:-/tmp}/mkdep$$ -trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 +trap 'rm -f "$TMP" ; exit 1' HUP INT QUIT PIPE TERM -cp $MAKE ${MAKE}.bak +cp "$MAKE" "${MAKE}.bak" -sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP +sed -e '/DO NOT DELETE THIS LINE/,$d' < "$MAKE" > "$TMP" -cat << _EOF_ >> $TMP +cat << _EOF_ >> "$TMP" # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. @@ -94,23 +94,25 @@ _EOF_ # Construct a list of source files with paths relative to the source directory. # sources="" -for srcfile in $* +for srcfile in "$@" do sources="$sources $SOURCE_DIRECTORY/$srcfile" done # XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait" -$CC $DEPENDENCY_CFLAG $flags $sources | +# $flags and $sources are meant to expand +# shellcheck disable=SC2086 +"$CC" "$DEPENDENCY_CFLAG" $flags $sources | sed " s; \./; ;g - $SED" >> $TMP + $SED" >> "$TMP" -cat << _EOF_ >> $TMP +cat << _EOF_ >> "$TMP" # IF YOU PUT ANYTHING HERE IT WILL GO AWAY _EOF_ # copy to preserve permissions -cp $TMP $MAKE -rm -f ${MAKE}.bak $TMP +cp "$TMP" "$MAKE" +rm -f "${MAKE}.bak" "$TMP" exit 0 |