From ca5358bc3f6887b59790ef860194a4ac5f4e4786 Mon Sep 17 00:00:00 2001 From: Nicolas KAROLAK Date: Thu, 9 Aug 2018 11:23:04 +0200 Subject: [PATCH] fix(restc): avoid word splitting for options --- INSTALL.md | 2 +- handlers/restic.in | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 4ea8112..175fe1f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,7 +15,7 @@ Requirements: Recommended: - rdiff-backup duplicity rsync borgbackup gzip hwinfo sfdisk cryptsetup flashrom hwinfo + borgbackup cryptsetup duplicity flashrom gzip hwinfo rdiff-backup restic rsync sfdisk To install backupninja, simply do the following: diff --git a/handlers/restic.in b/handlers/restic.in index c6aaf2d..0ababc1 100644 --- a/handlers/restic.in +++ b/handlers/restic.in @@ -75,8 +75,9 @@ function run_cmd { while [ $pass -lt $retry_run ]; do (( pass++ )) debug "Attempt $pass" + info "Running command in a subshell. This may take a while..." # return when cmd succeeded, pass when failed - $cmd && return 0 || : + eval $cmd && return 0 || : sleep $retry_wait done @@ -126,7 +127,7 @@ function run_cmd { cmd_global_options+="--no-lock " [ -n "$option" ] && \ - cmd_global_options+="$(for i in $option; do echo "--option $i "; done)" + cmd_global_options+="$(for i in "${option[@]}"; do echo "--option $i "; done)" [ -n "$quiet" ] && \ cmd_global_options+="--quiet "