Fix Shellcheck SC2086: Quote to prevent splitting

Double quote to prevent globbing and word splitting.

https://github.com/koalaman/shellcheck/wiki/SC2086

Signed-off-by: Dan Callahan <danc@element.io>
This commit is contained in:
Dan Callahan 2021-10-22 22:46:06 +01:00
parent 31096132c3
commit 13f084eb58
No known key found for this signature in database
GPG Key ID: 5FAD56482D9EB851
13 changed files with 42 additions and 42 deletions

View File

@ -3,7 +3,7 @@
# Test for the export-data admin command against sqlite and postgres # Test for the export-data admin command against sqlite and postgres
set -xe set -xe
cd "`dirname $0`/../.." cd "`dirname "$0"`/../.."
echo "--- Install dependencies" echo "--- Install dependencies"

View File

@ -7,7 +7,7 @@
set -xe set -xe
cd "`dirname $0`/../.." cd "`dirname "$0"`/../.."
echo "--- Install dependencies" echo "--- Install dependencies"

View File

@ -98,7 +98,7 @@ esac
--output-file="${PACKAGE_BUILD_DIR}/etc/matrix-synapse/log.yaml" --output-file="${PACKAGE_BUILD_DIR}/etc/matrix-synapse/log.yaml"
# add a dependency on the right version of python to substvars. # add a dependency on the right version of python to substvars.
PYPKG=`basename $SNAKE` PYPKG=`basename "$SNAKE"`
echo "synapse:pydepends=$PYPKG" >> debian/matrix-synapse-py3.substvars echo "synapse:pydepends=$PYPKG" >> debian/matrix-synapse-py3.substvars

View File

@ -6,14 +6,14 @@ DIR="$( cd "$( dirname "$0" )" && pwd )"
PID_FILE="$DIR/servers.pid" PID_FILE="$DIR/servers.pid"
if [ -f $PID_FILE ]; then if [ -f "$PID_FILE" ]; then
echo "servers.pid exists!" echo "servers.pid exists!"
exit 1 exit 1
fi fi
for port in 8080 8081 8082; do for port in 8080 8081 8082; do
rm -rf ${DIR:?}/$port rm -rf "${DIR:?}/$port"
rm -rf $DIR/media_store.$port rm -rf "$DIR/media_store.$port"
done done
rm -rf ${DIR:?}/etc rm -rf "${DIR:?}/etc"

View File

@ -12,7 +12,7 @@ PYTHONPATH=$(readlink -f "$(pwd)")
export PYTHONPATH export PYTHONPATH
echo $PYTHONPATH echo "$PYTHONPATH"
for port in 8080 8081 8082; do for port in 8080 8081 8082; do
echo "Starting server on port $port... " echo "Starting server on port $port... "
@ -28,12 +28,12 @@ for port in 8080 8081 8082; do
--config-path "$DIR/etc/$port.config" \ --config-path "$DIR/etc/$port.config" \
--report-stats no --report-stats no
if ! grep -F "Customisation made by demo/start.sh" -q $DIR/etc/$port.config; then if ! grep -F "Customisation made by demo/start.sh" -q "$DIR/etc/$port.config"; then
printf '\n\n# Customisation made by demo/start.sh\n' >> $DIR/etc/$port.config printf '\n\n# Customisation made by demo/start.sh\n' >> "$DIR/etc/$port.config"
echo "public_baseurl: http://localhost:$port/" >> $DIR/etc/$port.config echo "public_baseurl: http://localhost:$port/" >> "$DIR/etc/$port.config"
echo 'enable_registration: true' >> $DIR/etc/$port.config echo 'enable_registration: true' >> "$DIR/etc/$port.config"
# Warning, this heredoc depends on the interaction of tabs and spaces. Please don't # Warning, this heredoc depends on the interaction of tabs and spaces. Please don't
# accidentaly bork me with your fancy settings. # accidentaly bork me with your fancy settings.
@ -57,26 +57,26 @@ for port in 8080 8081 8082; do
compress: false compress: false
PORTLISTENERS PORTLISTENERS
) )
echo "${listeners}" >> $DIR/etc/$port.config echo "${listeners}" >> "$DIR/etc/$port.config"
# Disable tls for the servers # Disable tls for the servers
printf '\n\n# Disable tls on the servers.' >> $DIR/etc/$port.config printf '\n\n# Disable tls on the servers.' >> "$DIR/etc/$port.config"
echo '# DO NOT USE IN PRODUCTION' >> $DIR/etc/$port.config echo '# DO NOT USE IN PRODUCTION' >> "$DIR/etc/$port.config"
echo 'use_insecure_ssl_client_just_for_testing_do_not_use: true' >> $DIR/etc/$port.config echo 'use_insecure_ssl_client_just_for_testing_do_not_use: true' >> "$DIR/etc/$port.config"
echo 'federation_verify_certificates: false' >> $DIR/etc/$port.config echo 'federation_verify_certificates: false' >> "$DIR/etc/$port.config"
# Set tls paths # Set tls paths
echo "tls_certificate_path: \"$DIR/etc/localhost:$https_port.tls.crt\"" >> $DIR/etc/$port.config echo "tls_certificate_path: \"$DIR/etc/localhost:$https_port.tls.crt\"" >> "$DIR/etc/$port.config"
echo "tls_private_key_path: \"$DIR/etc/localhost:$https_port.tls.key\"" >> $DIR/etc/$port.config echo "tls_private_key_path: \"$DIR/etc/localhost:$https_port.tls.key\"" >> "$DIR/etc/$port.config"
# Generate tls keys # Generate tls keys
openssl req -x509 -newkey rsa:4096 -keyout $DIR/etc/localhost:$https_port.tls.key -out $DIR/etc/localhost:$https_port.tls.crt -days 365 -nodes -subj "/O=matrix" openssl req -x509 -newkey rsa:4096 -keyout "$DIR/etc/localhost:$https_port.tls.key" -out "$DIR/etc/localhost:$https_port.tls.crt" -days 365 -nodes -subj "/O=matrix"
# Ignore keys from the trusted keys server # Ignore keys from the trusted keys server
echo '# Ignore keys from the trusted keys server' >> $DIR/etc/$port.config echo '# Ignore keys from the trusted keys server' >> "$DIR/etc/$port.config"
echo 'trusted_key_servers:' >> $DIR/etc/$port.config echo 'trusted_key_servers:' >> "$DIR/etc/$port.config"
echo ' - server_name: "matrix.org"' >> $DIR/etc/$port.config echo ' - server_name: "matrix.org"' >> "$DIR/etc/$port.config"
echo ' accept_keys_insecurely: true' >> $DIR/etc/$port.config echo ' accept_keys_insecurely: true' >> "$DIR/etc/$port.config"
# Reduce the blacklist # Reduce the blacklist
blacklist=$(cat <<-BLACK blacklist=$(cat <<-BLACK
@ -91,12 +91,12 @@ for port in 8080 8081 8082; do
- 'fc00::/7' - 'fc00::/7'
BLACK BLACK
) )
echo "${blacklist}" >> $DIR/etc/$port.config echo "${blacklist}" >> "$DIR/etc/$port.config"
fi fi
# Check script parameters # Check script parameters
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
if [ $1 = "--no-rate-limit" ]; then if [ "$1" = "--no-rate-limit" ]; then
# Disable any rate limiting # Disable any rate limiting
ratelimiting=$(cat <<-RC ratelimiting=$(cat <<-RC
@ -138,15 +138,15 @@ for port in 8080 8081 8082; do
burst_count: 1000 burst_count: 1000
RC RC
) )
echo "${ratelimiting}" >> $DIR/etc/$port.config echo "${ratelimiting}" >> "$DIR/etc/$port.config"
fi fi
fi fi
if ! grep -F "full_twisted_stacktraces" -q $DIR/etc/$port.config; then if ! grep -F "full_twisted_stacktraces" -q "$DIR/etc/$port.config"; then
echo "full_twisted_stacktraces: true" >> $DIR/etc/$port.config echo "full_twisted_stacktraces: true" >> "$DIR/etc/$port.config"
fi fi
if ! grep -F "report_stats" -q $DIR/etc/$port.config ; then if ! grep -F "report_stats" -q "$DIR/etc/$port.config" ; then
echo "report_stats: false" >> $DIR/etc/$port.config echo "report_stats: false" >> "$DIR/etc/$port.config"
fi fi
python3 -m synapse.app.homeserver \ python3 -m synapse.app.homeserver \

View File

@ -8,7 +8,7 @@ for pid_file in $FILES; do
pid=$(cat "$pid_file") pid=$(cat "$pid_file")
if [[ $pid ]]; then if [[ $pid ]]; then
echo "Killing $pid_file with $pid" echo "Killing $pid_file with $pid"
kill $pid kill "$pid"
fi fi
done done

View File

@ -5,7 +5,7 @@
set -ex set -ex
# Get the codename from distro env # Get the codename from distro env
DIST=`cut -d ':' -f2 <<< ${distro:?}` DIST=`cut -d ':' -f2 <<< "${distro:?}"`
# we get a read-only copy of the source: make a writeable copy # we get a read-only copy of the source: make a writeable copy
cp -aT /synapse/source /synapse/build cp -aT /synapse/source /synapse/build

View File

@ -44,8 +44,8 @@ echo
matched=0 matched=0
for f in `git diff --name-only FETCH_HEAD... -- changelog.d`; do for f in `git diff --name-only FETCH_HEAD... -- changelog.d`; do
# check that any modified newsfiles on this branch end with a full stop. # check that any modified newsfiles on this branch end with a full stop.
lastchar=`tr -d '\n' < $f | tail -c 1` lastchar=`tr -d '\n' < "$f" | tail -c 1`
if [ $lastchar != '.' ] && [ $lastchar != '!' ]; then if [ "$lastchar" != '.' ] && [ "$lastchar" != '!' ]; then
echo -e "\e[31mERROR: newsfragment $f does not end with a '.' or '!'\e[39m" >&2 echo -e "\e[31mERROR: newsfragment $f does not end with a '.' or '!'\e[39m" >&2
echo -e "$CONTRIBUTING_GUIDE_TEXT" >&2 echo -e "$CONTRIBUTING_GUIDE_TEXT" >&2
exit 1 exit 1

View File

@ -25,7 +25,7 @@
# terminators are found, 0 otherwise. # terminators are found, 0 otherwise.
# cd to the root of the repository # cd to the root of the repository
cd "`dirname $0`/.." || exit cd "`dirname "$0"`/.." || exit
# Find and print files with non-unix line terminators # Find and print files with non-unix line terminators
if find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$'; then if find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$'; then

View File

@ -24,7 +24,7 @@
set -e set -e
# Change to the repository root # Change to the repository root
cd "$(dirname $0)/.." cd "$(dirname "$0")/.."
# Check for a user-specified Complement checkout # Check for a user-specified Complement checkout
if [[ -z "$COMPLEMENT_DIR" ]]; then if [[ -z "$COMPLEMENT_DIR" ]]; then
@ -61,8 +61,8 @@ cd "$COMPLEMENT_DIR"
EXTRA_COMPLEMENT_ARGS="" EXTRA_COMPLEMENT_ARGS=""
if [[ -n "$1" ]]; then if [[ -n "$1" ]]; then
# A test name regex has been set, supply it to Complement # A test name regex has been set, supply it to Complement
EXTRA_COMPLEMENT_ARGS+="-run $1 " EXTRA_COMPLEMENT_ARGS=(-run "$1")
fi fi
# Run the tests! # Run the tests!
go test -v -tags synapse_blacklist,msc2946,msc3083,msc2403,msc2716 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests/... go test -v -tags synapse_blacklist,msc2946,msc3083,msc2403,msc2716 -count=1 "${EXTRA_COMPLEMENT_ARGS[@]}" ./tests/...

View File

@ -3,7 +3,7 @@
# Exits with 0 if there are no problems, or another code otherwise. # Exits with 0 if there are no problems, or another code otherwise.
# cd to the root of the repository # cd to the root of the repository
cd "`dirname $0`/.." || exit cd "`dirname "$0"`/.." || exit
# Restore backup of sample config upon script exit # Restore backup of sample config upon script exit
trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT

View File

@ -60,5 +60,5 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts
# Update the Debian changelog. # Update the Debian changelog.
ver=${1} ver=${1}
dch -M -v "$(sed -Ee 's/(rc|a|b|c)/~\1/' <<<$ver)" "New synapse release $ver." dch -M -v "$(sed -Ee 's/(rc|a|b|c)/~\1/' <<<"$ver")" "New synapse release $ver."
dch -M -r -D stable "" dch -M -r -D stable ""

View File

@ -4,7 +4,7 @@
set -e set -e
cd "`dirname $0`/.." cd "`dirname "$0"`/.."
SAMPLE_CONFIG="docs/sample_config.yaml" SAMPLE_CONFIG="docs/sample_config.yaml"
SAMPLE_LOG_CONFIG="docs/sample_log_config.yaml" SAMPLE_LOG_CONFIG="docs/sample_log_config.yaml"