2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

scripts: fix shellcheck warnings

On my system (shellcheck v0.7.1) make lint shows a few warnings about
needing to quote variables.

Fix those.

PS I am not sure why those are not shown by GHA CI, I assume there is
different shellcheck version used. Add shellcheck -- version to the
appropriate Makefile target to avoid confusion.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2021-04-22 15:30:47 -07:00 committed by Andrei Vagin
parent 5f3631916a
commit 2166d47482
4 changed files with 8 additions and 7 deletions

View File

@ -401,6 +401,7 @@ lint:
flake8 --config=scripts/flake8.cfg test/inhfd/*.py
flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py
flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py
shellcheck --version
shellcheck scripts/*.sh
shellcheck scripts/ci/*.sh scripts/ci/apt-install
shellcheck test/others/crit/*.sh

View File

@ -12,7 +12,7 @@ max_apt_retries=5
# hashsum mismatches, DNS errors and similar things
while true; do
(( install_retry_counter+=1 ))
if [ ${install_retry_counter} -gt ${max_apt_retries} ]; then
if [ "${install_retry_counter}" -gt "${max_apt_retries}" ]; then
exit 1
fi
# shellcheck disable=SC2068
@ -20,5 +20,5 @@ while true; do
# In case it is a network error let's wait a bit.
echo "Retrying attempt ${install_retry_counter}"
sleep ${install_retry_counter}
sleep "${install_retry_counter}"
done

View File

@ -45,8 +45,8 @@ bindmount=""
function remove_bindmount {
if [ -n "$bindmount" ]; then
$JOIN_CT umount $bindmount
$JOIN_CT rm -rf $bindmount
$JOIN_CT umount "$bindmount"
$JOIN_CT rm -rf "$bindmount"
bindmount=""
fi
}
@ -107,7 +107,7 @@ function save_mountpoint {
# Nothing to do, if no file system is on top of autofs
[ "$top_mount_fs_type" = "autofs" ] && return
bindmount=$($JOIN_CT mktemp -d)
bindmount="$($JOIN_CT mktemp -d)"
if [ -z "$bindmount" ]; then
echo "Failed to create temporary directory"
return 1

View File

@ -26,7 +26,7 @@ IMGFILE=$CRTOOLS_IMAGE_DIR"/tmpfiles.tar.gz"
MY_NAME=$(basename "$0")
case "$CRTOOLS_SCRIPT_ACTION" in
$POSTDUMP )
"$POSTDUMP")
if [ "$#" -lt 1 ]; then
echo "$MY_NAME: ERROR! No files are given."
exit 1
@ -34,7 +34,7 @@ case "$CRTOOLS_SCRIPT_ACTION" in
tar "$DUMPARGS" "$IMGFILE" -- "$@"
exit $?
;;
$PRERESTORE )
"$PRERESTORE")
if [ "$#" -ne 0 ]; then
echo "$MY_NAME: ERROR! Not expected script args."
exit 1