Merge pull request #1655 from callahad/SC2162
Resolve SC2162: 'read without -r mangles backslashes'
This commit is contained in:
4
debian/postinst
vendored
4
debian/postinst
vendored
@@ -24,7 +24,7 @@ case "$1" in
|
|||||||
touch /var/lib/dokku/core-plugins/config.toml /var/lib/dokku/plugins/config.toml
|
touch /var/lib/dokku/core-plugins/config.toml /var/lib/dokku/plugins/config.toml
|
||||||
|
|
||||||
# migrate old plugins
|
# migrate old plugins
|
||||||
find /var/lib/dokku/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do
|
find /var/lib/dokku/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
|
||||||
if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then
|
if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then
|
||||||
continue
|
continue
|
||||||
elif [ -f /var/lib/dokku/plugins/$plugin/.core ]; then
|
elif [ -f /var/lib/dokku/plugins/$plugin/.core ]; then
|
||||||
@@ -35,7 +35,7 @@ case "$1" in
|
|||||||
done
|
done
|
||||||
|
|
||||||
# enable all core plugins
|
# enable all core plugins
|
||||||
find /var/lib/dokku/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do
|
find /var/lib/dokku/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
|
||||||
if [ ! -d /var/lib/dokku/plugins/available/$plugin ]; then
|
if [ ! -d /var/lib/dokku/plugins/available/$plugin ]; then
|
||||||
ln -s /var/lib/dokku/core-plugins/available/$plugin /var/lib/dokku/plugins/available/$plugin;
|
ln -s /var/lib/dokku/core-plugins/available/$plugin /var/lib/dokku/plugins/available/$plugin;
|
||||||
PLUGIN_PATH=/var/lib/dokku/core-plugins plugn enable $plugin
|
PLUGIN_PATH=/var/lib/dokku/core-plugins plugn enable $plugin
|
||||||
|
|||||||
2
dokku
2
dokku
@@ -95,7 +95,7 @@ case "$1" in
|
|||||||
|
|
||||||
DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG)
|
DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG)
|
||||||
|
|
||||||
while read line || [[ -n "$line" ]]; do
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
TRIM=${line%#*}
|
TRIM=${line%#*}
|
||||||
PROC_TYPE=${TRIM%%=*}
|
PROC_TYPE=${TRIM%%=*}
|
||||||
PROC_COUNT=${TRIM#*=}
|
PROC_COUNT=${TRIM#*=}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ case "$1" in
|
|||||||
dokku_log_warn "To proceed, type \"$APP\""
|
dokku_log_warn "To proceed, type \"$APP\""
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
read -p "> " app_name
|
read -rp "> " app_name
|
||||||
if [[ "$app_name" != "$APP" ]]; then
|
if [[ "$app_name" != "$APP" ]]; then
|
||||||
dokku_log_fail "Confirmation did not match $APP. Aborted."
|
dokku_log_fail "Confirmation did not match $APP. Aborted."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# create all the app directories
|
# create all the app directories
|
||||||
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
|
while read -r app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
|
||||||
|
|
||||||
# have the plugins import their stuff
|
# have the plugins import their stuff
|
||||||
plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ fi
|
|||||||
|
|
||||||
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
|
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
|
||||||
exec < "$FILENAME"
|
exec < "$FILENAME"
|
||||||
while read LINE; do
|
while read -r LINE; do
|
||||||
# Name/value pair
|
# Name/value pair
|
||||||
if [[ "$LINE" =~ ^.+= ]]; then
|
if [[ "$LINE" =~ ^.+= ]]; then
|
||||||
TRIM=${LINE%#*}
|
TRIM=${LINE%#*}
|
||||||
@@ -143,7 +143,7 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exec < "$FILENAME"
|
exec < "$FILENAME"
|
||||||
while read CHECK_URL EXPECTED; do
|
while read -r CHECK_URL EXPECTED; do
|
||||||
# Ignore empty lines and lines starting with #
|
# Ignore empty lines and lines starting with #
|
||||||
# shellcheck disable=SC1001
|
# shellcheck disable=SC1001
|
||||||
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
|
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ output=""
|
|||||||
if [[ -f "$PHASE_FILE_PATH" ]]; then
|
if [[ -f "$PHASE_FILE_PATH" ]]; then
|
||||||
DONE=false
|
DONE=false
|
||||||
until $DONE; do
|
until $DONE; do
|
||||||
read line || DONE=true
|
read -r line || DONE=true
|
||||||
|
|
||||||
[[ ! -n "$line" ]] && continue
|
[[ ! -n "$line" ]] && continue
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ IMPORT_DIR="$2"
|
|||||||
TARGET_DIR="$3"
|
TARGET_DIR="$3"
|
||||||
APPS="$4"
|
APPS="$4"
|
||||||
|
|
||||||
while read APP; do
|
while read -r APP; do
|
||||||
APP_PATH="$TARGET_DIR/$APP";
|
APP_PATH="$TARGET_DIR/$APP";
|
||||||
git init --bare $APP_PATH > /dev/null
|
git init --bare $APP_PATH > /dev/null
|
||||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ case "$1" in
|
|||||||
git-hook)
|
git-hook)
|
||||||
APP=$2
|
APP=$2
|
||||||
|
|
||||||
while read oldrev newrev refname; do
|
while read -r oldrev newrev refname; do
|
||||||
# Only run this script for the master branch. You can remove this
|
# Only run this script for the master branch. You can remove this
|
||||||
# if block if you wish to run it for others as well.
|
# if block if you wish to run it for others as well.
|
||||||
if [[ $refname = "refs/heads/master" ]]; then
|
if [[ $refname = "refs/heads/master" ]]; then
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ EOF
|
|||||||
local NGINX_SSL_PORT=$DOKKU_NGINX_SSL_PORT
|
local NGINX_SSL_PORT=$DOKKU_NGINX_SSL_PORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read line; do
|
while read -r line; do
|
||||||
[[ -z "$line" ]] && continue
|
[[ -z "$line" ]] && continue
|
||||||
dokku_log_info1 "Configuring SSL for $line..."
|
dokku_log_info1 "Configuring SSL for $line..."
|
||||||
SSL_SERVER_NAME=$line
|
SSL_SERVER_NAME=$line
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ case "$1" in
|
|||||||
dokku_log_info1_quiet "Scaling for $APP"
|
dokku_log_info1_quiet "Scaling for $APP"
|
||||||
dokku_col_log_info1_quiet "proctype" "qty"
|
dokku_col_log_info1_quiet "proctype" "qty"
|
||||||
dokku_col_log_info1_quiet "--------" "---"
|
dokku_col_log_info1_quiet "--------" "---"
|
||||||
while read line || [[ -n "$line" ]]; do
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
[[ -z "$line" ]] && continue
|
[[ -z "$line" ]] && continue
|
||||||
PROC_NAME=${line%%=*}
|
PROC_NAME=${line%%=*}
|
||||||
PROC_COUNT=${line#*=}
|
PROC_COUNT=${line#*=}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
|
|
||||||
print_dokku_scale_file() {
|
print_dokku_scale_file() {
|
||||||
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||||
while read line || [[ -n "$line" ]]; do
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
dokku_log_info2_quiet "$line"
|
dokku_log_info2_quiet "$line"
|
||||||
done < "$DOKKU_SCALE_FILE"
|
done < "$DOKKU_SCALE_FILE"
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ generate_scale_file() {
|
|||||||
if [[ ! -e "$PROCFILE" ]]; then
|
if [[ ! -e "$PROCFILE" ]]; then
|
||||||
echo "web=1" >> $DOKKU_SCALE_FILE
|
echo "web=1" >> $DOKKU_SCALE_FILE
|
||||||
else
|
else
|
||||||
while read line || [[ -n "$line" ]]; do
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
[[ -z "$line" ]] && continue
|
[[ -z "$line" ]] && continue
|
||||||
NAME=${line%%:*}
|
NAME=${line%%:*}
|
||||||
NUM_PROCS=0
|
NUM_PROCS=0
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ case "$1" in
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
trap '' SIGINT
|
trap '' SIGINT
|
||||||
read -ep "dokku> " line || {
|
read -rep "dokku> " line || {
|
||||||
echo; true; break
|
echo; true; break
|
||||||
}
|
}
|
||||||
trap - SIGINT
|
trap - SIGINT
|
||||||
|
|||||||
Reference in New Issue
Block a user