From 24682a3197621b4a48b166853a5edfb9a853866c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 3 Jan 2022 03:13:50 +0100 Subject: [PATCH 1/2] contrib: push_pkg: fix lint issues with shellcheck 0.7.1 0.7.1 complains about unescaped backslashes in double quotes (which are intepreted by printf in the two affected places). While the warning was retired with shellcheck 0.7.2, it seems like a good idea to fix it anyways. --- contrib/push_pkg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/push_pkg.sh b/contrib/push_pkg.sh index 4b9fe740..c12a02e6 100755 --- a/contrib/push_pkg.sh +++ b/contrib/push_pkg.sh @@ -48,7 +48,7 @@ shift $(( OPTIND - 1 )) if [ "$build_only" -eq 0 ]; then remote_info=$(ssh -p "${ssh_port}" "root@${ssh_host}" ' source /etc/os-release - printf "%s\t%s\n" "$OPENWRT_BOARD" "$OPENWRT_ARCH" + printf "%s\\t%s\\n" "$OPENWRT_BOARD" "$OPENWRT_ARCH" ') REMOTE_OPENWRT_BOARD="$(echo "$remote_info" | cut -f 1)" REMOTE_OPENWRT_ARCH="$(echo "$remote_info" | cut -f 2)" @@ -92,7 +92,7 @@ while [ $# -gt 0 ]; do opkg_packages="$(make TOPDIR="${topdir}" -C "${pkgdir}" DUMP=1 | awk '/^Package: / { print $2 }')" search_package() { - find "$2" -name "$1_*.ipk" -printf "%f\n" + find "$2" -name "$1_*.ipk" -printf '%f\n' } make TOPDIR="${topdir}" -C "${pkgdir}" clean From f32c68360166d2d26386bc70f1aa0bf005e19a4a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 3 Jan 2022 03:22:01 +0100 Subject: [PATCH 2/2] scripts: lint-sh: ignore warnings about POSIX sh compatiblity The following features are available in Busybox ash, so we don't need to warn about them for runtime scripts: - local keyword - echo -n / -e - String indexing These warnings are new in shellcheck 0.7.2, which would otherwise fail for various scripts. --- scripts/lint-sh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lint-sh.sh b/scripts/lint-sh.sh index 71ce5463..96335c7a 100755 --- a/scripts/lint-sh.sh +++ b/scripts/lint-sh.sh @@ -17,7 +17,7 @@ find package -type f | while read -r file; do is_scriptfile "$file" || continue echo "Checking $file" - shellcheck -f gcc -x -s sh -e SC2039,SC1091,SC2155,SC2034 "$file" + shellcheck -f gcc -x -s sh -e SC2039,SC1091,SC2155,SC2034,SC3043,SC3037,SC3057 "$file" done find scripts -type f | while read -r file; do