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