1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

Improve bash quoting, and other similar best practices

This patch updates the shell scripts with some of the common best
practices, which should make them more resilient to unusual failures and
unexpected environments (in particular, directories with spaces).

Most of these were identified by shellcheck.
This commit is contained in:
Alberto Bertogli
2022-11-13 00:37:28 +00:00
parent e2481b07a9
commit 948cee1ce1
32 changed files with 133 additions and 126 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -e
. $(dirname ${0})/../../test/util/lib.sh
. "$(dirname "$0")/../../test/util/lib.sh"
init

View File

@@ -1,13 +1,14 @@
#!/bin/bash
set -e
. $(dirname ${0})/../../test/util/lib.sh
. "$(dirname "$0")/../../test/util/lib.sh"
init
# Build the binary once, so we can use it and launch it in chamuyero scripts.
# Otherwise, we not only spend time rebuilding it over and over, but also "go
# run" masks the exit code, which is something we care about.
# shellcheck disable=SC2086
if [ "${COVER_DIR}" != "" ]; then
go test -covermode=count -coverpkg=../../... -c \
$GOFLAGS -tags="coveragebin $GOTAGS"
@@ -22,9 +23,9 @@ if ! ./dovecot-auth-cli lalala 2>&1 | grep -q "invalid arguments"; then
fi
for i in *.cmy; do
if ! chamuyero $i > $i.log 2>&1 ; then
if ! chamuyero "$i" > "$i.log" 2>&1 ; then
echo "# Test $i failed, log follows"
cat $i.log
cat "$i.log"
exit 1
fi
done

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -e
. $(dirname ${0})/../../test/util/lib.sh
. "$(dirname "$0")/../../test/util/lib.sh"
init
@@ -11,9 +11,9 @@ init
go build
for i in *.cmy; do
if ! chamuyero $i > $i.log 2>&1 ; then
if ! chamuyero "$i" > "$i.log" 2>&1 ; then
echo "# Test $i failed, log follows"
cat $i.log
cat "$i.log"
exit 1
fi
done