Skip to content
Snippets Groups Projects
Commit fe77a450 authored by chrfranke's avatar chrfranke
Browse files

Fix or disable all warnings from shellcheck.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5597 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 52fcae82
Branches
No related tags found
No related merge requests found
$Id$ $Id$
2024-01-24 Christian Franke <franke@computer.org>
Fix or disable all warnings from shellcheck.
2024-01-23 Christian Franke <franke@computer.org> 2024-01-23 Christian Franke <franke@computer.org>
Makefile.am: Add target 'shellcheck'. Makefile.am: Add target 'shellcheck'.
......
...@@ -109,6 +109,7 @@ for s in $sup_list; do ...@@ -109,6 +109,7 @@ for s in $sup_list; do
suppress="${suppress}${suppress:+ }--suppress=${s%%#*}" suppress="${suppress}${suppress:+ }--suppress=${s%%#*}"
done done
# shellcheck disable=SC2089
defs="\ defs="\
-U__KERNEL__ -U__KERNEL__
-U__LP64__ -U__LP64__
...@@ -147,6 +148,7 @@ $(for s in $suppress; do echo " $s \\"; done) ...@@ -147,6 +148,7 @@ $(for s in $suppress; do echo " $s \\"; done)
EOF EOF
# Run cppcheck with swapped stdout<>stderr # Run cppcheck with swapped stdout<>stderr
# shellcheck disable=SC2090
"$cppcheck" \ "$cppcheck" \
$v \ $v \
$jobs \ $jobs \
......
...@@ -84,6 +84,7 @@ if [ -n "${REV//[0-9]/}" ]; then ...@@ -84,6 +84,7 @@ if [ -n "${REV//[0-9]/}" ]; then
fi fi
(cd $WDROOT && svn status) | while read s; do (cd $WDROOT && svn status) | while read s; do
# shellcheck disable=SC2254
case "`echo $s | tr -s ' '`" in case "`echo $s | tr -s ' '`" in
"M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";; "M "$DIRPAT/smartmontools/ChangeLog) echo "$s: OK";;
"M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";; "M "$DIRPAT/smartmontools/NEWS) echo "$s: OK";;
...@@ -161,7 +162,7 @@ fi ...@@ -161,7 +162,7 @@ fi
set +v set +v
# Update configure.ac only after trunk releases # Update configure.ac only after trunk releases
if [ -z "$RC" -a "$DIRPAT" = "trunk" ]; then if [ -z "$RC" ] && [ "$DIRPAT" = "trunk" ]; then
# Comment out timestamp # Comment out timestamp
sed -e "s|^smartmontools_release_date=\(.*\)$|smartmontools_release_date= # \1|" \ sed -e "s|^smartmontools_release_date=\(.*\)$|smartmontools_release_date= # \1|" \
-e "s|^smartmontools_release_time=\(.*\)$|smartmontools_release_time= # \1|" \ -e "s|^smartmontools_release_time=\(.*\)$|smartmontools_release_time= # \1|" \
......
...@@ -17,7 +17,7 @@ myname=$0 ...@@ -17,7 +17,7 @@ myname=$0
usage() usage()
{ {
cat <<EOF cat <<EOF
Usage: $myname [-i] [-p] [-r] [METHOD...] [> svnversion.h] Usage: $myname [-i] [-pq] [-r] [METHOD...] [> svnversion.h]
-i Print new contents of svnversion.h -i Print new contents of svnversion.h
-p Print package version from configure.ac -p Print package version from configure.ac
...@@ -70,7 +70,7 @@ revision_from_svn() ...@@ -70,7 +70,7 @@ revision_from_svn()
local r t local r t
r=$(cd "$srcdir" && svnversion 2>/dev/null) || return 1 r=$(cd "$srcdir" && svnversion 2>/dev/null) || return 1
case $r in [1-9][0-9]*) ;; *) return 1 ;; esac case $r in [1-9][0-9]*) ;; *) return 1 ;; esac
t=$(cd "$srcdir" && TZ= LC_ALL=C svn info 2>/dev/null) || return 1 t=$(cd "$srcdir" && TZ='' LC_ALL=C svn info 2>/dev/null) || return 1
t=$(echo "$t" | sed -n 's,^.* Date: *\(2[-0-9]*\) \([0-9][:0-9]*\) .*$,\1 \2,p') t=$(echo "$t" | sed -n 's,^.* Date: *\(2[-0-9]*\) \([0-9][:0-9]*\) .*$,\1 \2,p')
test -n "$t" || return 1 test -n "$t" || return 1
svnrev=$r; revdate=${t% *}; revtime=${t#* } svnrev=$r; revdate=${t% *}; revtime=${t#* }
...@@ -91,7 +91,7 @@ revision_from_ids() ...@@ -91,7 +91,7 @@ revision_from_ids()
revision_from_git() revision_from_git()
{ {
local h r t x local h r t x
x=$(cd "$srcdir" && TZ= LC_ALL=C git log -1 --date=iso 2>/dev/null) || return 1 x=$(cd "$srcdir" && TZ='' LC_ALL=C git log -1 --date=iso 2>/dev/null) || return 1
h=$(echo "$x" | sed -n 's,^commit \([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\).*$,\1,p') h=$(echo "$x" | sed -n 's,^commit \([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\).*$,\1,p')
t=$(echo "$x" | sed -n 's,^Date: *\(2[-0-9]*\) \([0-9][:0-9]*\) .*$,\1 \2,p') t=$(echo "$x" | sed -n 's,^Date: *\(2[-0-9]*\) \([0-9][:0-9]*\) .*$,\1 \2,p')
r=$(echo "$x" | sed -n 's,^.*git-svn-id: [.:/a-z]*/smartmontools/code/trunk@\([1-9][0-9]*\) 4ea69e.*$,\1,p') r=$(echo "$x" | sed -n 's,^.*git-svn-id: [.:/a-z]*/smartmontools/code/trunk@\([1-9][0-9]*\) 4ea69e.*$,\1,p')
......
...@@ -19,6 +19,7 @@ usage() ...@@ -19,6 +19,7 @@ usage()
{ {
cat <<EOF cat <<EOF
Display or edit PE32 file header fields Display or edit PE32 file header fields
Usage: $myname [-s SUBSYSTEM] [-t SECONDS_OR_FILE] [-v] FILE.exe Usage: $myname [-s SUBSYSTEM] [-t SECONDS_OR_FILE] [-v] FILE.exe
-s SUBSYSTEM Set Subsystem: 2 = GUI, 3 = Console -s SUBSYSTEM Set Subsystem: 2 = GUI, 3 = Console
...@@ -90,8 +91,7 @@ fi ...@@ -90,8 +91,7 @@ fi
# Read first 512 bytes for quick access to header # Read first 512 bytes for quick access to header
x=$(od -A n -N 512 -t u1 -v -w1 "$file") || exit 1 x=$(od -A n -N 512 -t u1 -v -w1 "$file") || exit 1
declare -a header mapfile header <<<"$x"
header=( $x )
test "${#header[*]}" == 512 || error "$file: Invalid file size" test "${#header[*]}" == 512 || error "$file: Invalid file size"
# get_uint16 OFFSET # get_uint16 OFFSET
...@@ -162,7 +162,7 @@ print_header() ...@@ -162,7 +162,7 @@ print_header()
esac esac
printf 'Magic: 0x%04x [%s]\n' $magic "$txt" printf 'Magic: 0x%04x [%s]\n' $magic "$txt"
printf 'CheckSum: 0x%08x\n' $(get_uint32 $checksum_offs) printf 'CheckSum: 0x%08x\n' "$(get_uint32 $checksum_offs)"
val=$(get_uint16 $subsystem_offs) val=$(get_uint16 $subsystem_offs)
case $val in case $val in
......
...@@ -15,6 +15,7 @@ set -e ...@@ -15,6 +15,7 @@ set -e
# Set by config.status # Set by config.status
@ENABLE_SCRIPTPATH_TRUE@export PATH="@scriptpath@" @ENABLE_SCRIPTPATH_TRUE@export PATH="@scriptpath@"
# shellcheck disable=SC2034
PACKAGE="@PACKAGE@" PACKAGE="@PACKAGE@"
VERSION="@VERSION@" VERSION="@VERSION@"
prefix="@prefix@" prefix="@prefix@"
...@@ -67,6 +68,7 @@ if [ -z "${SMARTD_ADDRESS}${SMARTD_MAILER}" ]; then ...@@ -67,6 +68,7 @@ if [ -z "${SMARTD_ADDRESS}${SMARTD_MAILER}" ]; then
fi fi
# Get host and domain names # Get host and domain names
# shellcheck disable=SC2041
for cmd in @os_hostname@ 'echo "[Unknown]"'; do for cmd in @os_hostname@ 'echo "[Unknown]"'; do
hostname=`eval $cmd 2>/dev/null` || continue hostname=`eval $cmd 2>/dev/null` || continue
test -n "$hostname" || continue test -n "$hostname" || continue
...@@ -78,6 +80,7 @@ if [ "$dnsdomain" != "$hostname" ]; then ...@@ -78,6 +80,7 @@ if [ "$dnsdomain" != "$hostname" ]; then
# hostname command printed FQDN # hostname command printed FQDN
hostname=${hostname%%.*} hostname=${hostname%%.*}
else else
# shellcheck disable=SC2041
for cmd in @os_dnsdomainname@ 'echo'; do for cmd in @os_dnsdomainname@ 'echo'; do
dnsdomain=`eval $cmd 2>/dev/null` || continue dnsdomain=`eval $cmd 2>/dev/null` || continue
break break
...@@ -85,6 +88,7 @@ else ...@@ -85,6 +88,7 @@ else
test "$dnsdomain" != "(none)" || dnsdomain= test "$dnsdomain" != "(none)" || dnsdomain=
fi fi
# shellcheck disable=SC2041
for cmd in @os_nisdomainname@ 'echo'; do for cmd in @os_nisdomainname@ 'echo'; do
nisdomain=`eval $cmd 2>/dev/null` || continue nisdomain=`eval $cmd 2>/dev/null` || continue
break break
......
...@@ -268,6 +268,7 @@ check_file() ...@@ -268,6 +268,7 @@ check_file()
f=$1; firstchar=$2; minsize=$3; maxsize=$4 f=$1; firstchar=$2; minsize=$3; maxsize=$4
# Check first chars # Check first chars
# shellcheck disable=SC2254
case `dd if="$f" bs=1 count=1 2>/dev/null` in case `dd if="$f" bs=1 count=1 2>/dev/null` in
$firstchar) ;; $firstchar) ;;
\<) echo "HTML error message"; return 1 ;; \<) echo "HTML error message"; return 1 ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment