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.
This commit is contained in:
Avery Pennarun 2018-10-12 04:13:47 -04:00
commit a3077a4a4d

View file

@ -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