From 4fc6208abebfe6b8c8348c412b4bcc594ae11c88 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 13 May 2025 20:42:26 +0300 Subject: [PATCH] Scripts: Add shellcheck directives to silence warnings Set also shell because the xz*.in files start with '#!@POSIX_SHELL@'. SC1003 and SC2016 are only info messages, not warnings. Several other shellcheck info messages remain. They are safe to ignore, but I didn't want to disable them now. Partially-fixes: https://github.com/tukaani-project/xz/issues/174 --- src/scripts/xzdiff.in | 4 ++++ src/scripts/xzgrep.in | 2 ++ src/scripts/xzless.in | 2 ++ src/scripts/xzmore.in | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in index 174347a4..8e1e0a22 100644 --- a/src/scripts/xzdiff.in +++ b/src/scripts/xzdiff.in @@ -16,6 +16,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# shellcheck shell=sh disable=SC1003,SC2016 + @enable_path_for_scripts@ #SET_PATH - This line is a placeholder to ease patching this script. @@ -90,6 +92,8 @@ if test $# -eq 1; then printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2 exit 2;; esac + # The FILE variable is used with eval, and shellcheck doesn't see that. + # shellcheck disable=SC2034 case $1 in *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4) FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;; diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in index c9cd02d0..511ea39c 100644 --- a/src/scripts/xzgrep.in +++ b/src/scripts/xzgrep.in @@ -19,6 +19,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# shellcheck shell=sh disable=SC1003,SC2016 + @enable_path_for_scripts@ #SET_PATH - This line is a placeholder to ease patching this script. diff --git a/src/scripts/xzless.in b/src/scripts/xzless.in index 6346966b..47f5b0b2 100644 --- a/src/scripts/xzless.in +++ b/src/scripts/xzless.in @@ -16,6 +16,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# shellcheck shell=sh disable=SC2089,SC2090 + @enable_path_for_scripts@ #SET_PATH - This line is a placeholder to ease patching this script. diff --git a/src/scripts/xzmore.in b/src/scripts/xzmore.in index acfbd7f3..d9656720 100644 --- a/src/scripts/xzmore.in +++ b/src/scripts/xzmore.in @@ -16,6 +16,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# shellcheck shell=sh + @enable_path_for_scripts@ #SET_PATH - This line is a placeholder to ease patching this script.