Merge pull request #1655 from callahad/SC2162

Resolve SC2162: 'read without -r mangles backslashes'
This commit is contained in:
Jose Diaz-Gonzalez
2015-11-05 00:36:48 -05:00
12 changed files with 15 additions and 15 deletions

4
debian/postinst vendored
View File

@@ -24,7 +24,7 @@ case "$1" in
touch /var/lib/dokku/core-plugins/config.toml /var/lib/dokku/plugins/config.toml
# 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
continue
elif [ -f /var/lib/dokku/plugins/$plugin/.core ]; then
@@ -35,7 +35,7 @@ case "$1" in
done
# 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
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

2
dokku
View File

@@ -95,7 +95,7 @@ case "$1" in
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%#*}
PROC_TYPE=${TRIM%%=*}
PROC_COUNT=${TRIM#*=}

View File

@@ -31,7 +31,7 @@ case "$1" in
dokku_log_warn "To proceed, type \"$APP\""
echo ""
read -p "> " app_name
read -rp "> " app_name
if [[ "$app_name" != "$APP" ]]; then
dokku_log_fail "Confirmation did not match $APP. Aborted."
fi

View File

@@ -72,7 +72,7 @@ case "$1" in
fi
# 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
plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"

View File

@@ -108,7 +108,7 @@ fi
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
exec < "$FILENAME"
while read LINE; do
while read -r LINE; do
# Name/value pair
if [[ "$LINE" =~ ^.+= ]]; then
TRIM=${LINE%#*}
@@ -143,7 +143,7 @@ do
fi
exec < "$FILENAME"
while read CHECK_URL EXPECTED; do
while read -r CHECK_URL EXPECTED; do
# Ignore empty lines and lines starting with #
# shellcheck disable=SC1001
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue

View File

@@ -24,7 +24,7 @@ output=""
if [[ -f "$PHASE_FILE_PATH" ]]; then
DONE=false
until $DONE; do
read line || DONE=true
read -r line || DONE=true
[[ ! -n "$line" ]] && continue

View File

@@ -6,7 +6,7 @@ IMPORT_DIR="$2"
TARGET_DIR="$3"
APPS="$4"
while read APP; do
while read -r APP; do
APP_PATH="$TARGET_DIR/$APP";
git init --bare $APP_PATH > /dev/null
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"

View File

@@ -33,7 +33,7 @@ case "$1" in
git-hook)
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
# if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]]; then

View File

@@ -233,7 +233,7 @@ EOF
local NGINX_SSL_PORT=$DOKKU_NGINX_SSL_PORT
fi
while read line; do
while read -r line; do
[[ -z "$line" ]] && continue
dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line

View File

@@ -111,7 +111,7 @@ case "$1" in
dokku_log_info1_quiet "Scaling for $APP"
dokku_col_log_info1_quiet "proctype" "qty"
dokku_col_log_info1_quiet "--------" "---"
while read line || [[ -n "$line" ]]; do
while read -r line || [[ -n "$line" ]]; do
[[ -z "$line" ]] && continue
PROC_NAME=${line%%=*}
PROC_COUNT=${line#*=}

View File

@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
print_dokku_scale_file() {
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"
done < "$DOKKU_SCALE_FILE"
}
@@ -25,7 +25,7 @@ generate_scale_file() {
if [[ ! -e "$PROCFILE" ]]; then
echo "web=1" >> $DOKKU_SCALE_FILE
else
while read line || [[ -n "$line" ]]; do
while read -r line || [[ -n "$line" ]]; do
[[ -z "$line" ]] && continue
NAME=${line%%:*}
NUM_PROCS=0

View File

@@ -18,7 +18,7 @@ case "$1" in
while true; do
trap '' SIGINT
read -ep "dokku> " line || {
read -rep "dokku> " line || {
echo; true; break
}
trap - SIGINT