From a3077a4a4de47f04526cabd3efe342b4d548b06b Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Fri, 12 Oct 2018 04:13:47 -0400 Subject: [PATCH] minimal/do: fix failure with paths containing spaces. We grew a test for these at some point, but minimal/do didn't actually pass it. sh syntax oddity: if you say x=$1 y=$2 then it works fine when $1 and $2 contain spaces. But if you say export x=$1 y=$2 (or "local" instead of "export") then $1 and $2 will be split on IFS, and it won't do what you think. I guess this is because 'export' and 'local' are like commands, and command arguments are split if not quoted. --- minimal/do | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minimal/do b/minimal/do index 5f20bb8..3f20bc2 100755 --- a/minimal/do +++ b/minimal/do @@ -91,7 +91,7 @@ _find_dofile() _run_dofile() { export DO_DEPTH="$DO_DEPTH " - export REDO_TARGET=$PWD/$target + export REDO_TARGET="$PWD/$target" local line1 set -e read line1 <"$PWD/$dofile" || true @@ -106,7 +106,7 @@ _run_dofile() _do() { - local dir=$1 target=$2 tmp=$3 + local dir="$1" target="$2" tmp="$3" if [ ! -e "$target" ] || [ -d "$target" -a ! -e "$target.did" ]; then printf '%sdo %s%s%s%s\n' \ "$green" "$DO_DEPTH" "$bold" "$dir$target" "$plain" >&2