From f97fb271e3699347a2202acb71e94dcd27335976 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 10 Nov 2025 17:10:00 +0100 Subject: [PATCH] scripts: fix shellcheck SC2046 warnings Also: - use more `--` end-of-options markers. - checksrc.sh: use literal quotes. Closes #1739 --- Makefile.am | 2 +- ci/checksrc.sh | 2 +- ci/cmakelint.sh | 3 ++- ci/shellcheck.sh | 4 ++-- ci/spellcheck.sh | 9 +++++---- maketgz | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index dfb03e65..0934fb81 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,7 @@ DISTCLEANFILES += ChangeLog dist-hook: rm -rf $(top_builddir)/tests/log - find $(distdir) -name "*.dist" -exec rm {} \; + find $(distdir) -name "*.dist" -exec rm -- {} \; (distit=`find $(srcdir) -name "*.dist"`; \ for file in $$distit; do \ strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ diff --git a/ci/checksrc.sh b/ci/checksrc.sh index 68fe3e5c..c5c0577b 100755 --- a/ci/checksrc.sh +++ b/ci/checksrc.sh @@ -6,7 +6,7 @@ set -eu cd "$(dirname "$0")"/.. -git ls-files "*.[ch]" "*.cc" | xargs -n1 \ +git ls-files '*.[ch]' '*.cc' | xargs -n1 \ ci/checksrc.pl -i4 -m79 -AFIXME -AERRNOVAR -AFOPENMODE -ATYPEDEFSTRUCT \ -aaccept \ -afclose \ diff --git a/ci/cmakelint.sh b/ci/cmakelint.sh index d4c1ce2c..8b1c6250 100755 --- a/ci/cmakelint.sh +++ b/ci/cmakelint.sh @@ -57,4 +57,5 @@ cd "$(dirname "$0")"/.. --max-branches 12 \ --max-arguments 5 \ --max-localvars 15 \ - --max-statements 50 + --max-statements 50 \ + -- diff --git a/ci/shellcheck.sh b/ci/shellcheck.sh index 3be54f70..d40d46e5 100755 --- a/ci/shellcheck.sh +++ b/ci/shellcheck.sh @@ -7,7 +7,7 @@ set -eu cd "$(dirname "$0")"/.. -# shellcheck disable=SC2046 +git grep -z -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' | xargs -0 -r \ shellcheck --exclude=1091 \ --enable=avoid-nullary-conditions,deprecate-which \ - $(grep -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' $(git ls-files)) + -- diff --git a/ci/spellcheck.sh b/ci/spellcheck.sh index 312e1569..c2476f90 100755 --- a/ci/spellcheck.sh +++ b/ci/spellcheck.sh @@ -6,7 +6,8 @@ set -eu cd "$(dirname "$0")"/.. -# shellcheck disable=SC2046 -codespell --skip='docs/AUTHORS' \ - --ignore-words='ci/codespell-ignore.words' \ - $(git ls-files) +git ls-files -z | xargs -0 -r \ +codespell \ + --skip 'docs/AUTHORS' \ + --ignore-words 'ci/codespell-ignore.words' \ + -- diff --git a/maketgz b/maketgz index 80f557cd..c9d23245 100755 --- a/maketgz +++ b/maketgz @@ -124,7 +124,7 @@ retar() { mkdir "$tempdir" cd "$tempdir" gzip -dc "../$targz" | tar -xf - - find libssh2-* -depth -exec touch -c -t "$filestamp" '{}' + + find libssh2-* -depth -exec touch -c -t "$filestamp" -- '{}' + tar --create --format=ustar --owner=0 --group=0 --numeric-owner --sort=name libssh2-* | gzip --best --no-name > out.tar.gz mv out.tar.gz ../ cd ..