From 474e12eed8b41c159a5a1567c6cfb3cfaa46e95e Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Tue, 11 Dec 2018 01:19:58 +0000 Subject: [PATCH] Fix minimal/do and tests when built in a path containing spaces. Basically all just missing quotes around shell strings that use $PWD. Most paths inside a project, since redo uses relative paths, only need to worry when project-internal directories or filenames have spaces in them. Reported-by: Jeff Stearns --- install.do | 17 +++++++++-------- minimal/do | 9 +++++---- minimal/do.test | 4 ++-- redo/sh.do | 2 +- t/360-symlinks/a.do | 2 +- t/999-installer/all.do | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/install.do b/install.do index 51dbc0e..de35ff1 100644 --- a/install.do +++ b/install.do @@ -19,24 +19,25 @@ read py &2 fi @@ -89,7 +90,7 @@ if [ -z "$DO_BUILT" -a "$_cmd" != "redo-whichdo" ]; then xargs -0 rm -f 2>/dev/null mv "$DO_BUILT.new" "$DO_BUILT" DO_PATH=$DO_BUILT.dir - export PATH=$DO_PATH:$PATH + export PATH="$DO_PATH:$PATH" rm -rf "$DO_PATH" mkdir "$DO_PATH" for d in redo redo-ifchange redo-whichdo; do diff --git a/minimal/do.test b/minimal/do.test index 2c0c3c7..292e8ef 100755 --- a/minimal/do.test +++ b/minimal/do.test @@ -102,8 +102,8 @@ check_s "" "$_dirsplit_base" SECTION _relpath -check "a/b/c" _relpath $PWD/a/b/c -check "../a/b/c" _relpath $PWD/../a/b/c +check "a/b/c" _relpath "$PWD/a/b/c" +check "../a/b/c" _relpath "$PWD/../a/b/c" check "" _relpath "$PWD" (cd / && check "a/b/c" _relpath a/b/c) (cd / && check "a/b/c" _relpath /a/b/c) diff --git a/redo/sh.do b/redo/sh.do index af01ac0..c0f0c4c 100644 --- a/redo/sh.do +++ b/redo/sh.do @@ -25,7 +25,7 @@ for sh in dash /usr/xpg4/bin/sh ash posh mksh ksh ksh88 ksh93 pdksh \ SH=$PWD/$1.new/sh set +e - ( cd ../t && $SH shelltest.od ) >shelltest.tmp 2>&1 + ( cd ../t && "$SH" shelltest.od ) >shelltest.tmp 2>&1 RV=$? set -e diff --git a/t/360-symlinks/a.do b/t/360-symlinks/a.do index a16ed7f..f8e4d39 100644 --- a/t/360-symlinks/a.do +++ b/t/360-symlinks/a.do @@ -2,6 +2,6 @@ printf x >>a.ran rm -f dir/$2.1 $2.2 $2.3 $2.final echo foo >$2.final ln -s $2.final $2.3 -ln -s $PWD/$2.3 $2.2 +ln -s "$PWD/$2.3" $2.2 ln -s ../$2.2 dir/$2.1 ln -s dir/$2.1 $3 diff --git a/t/999-installer/all.do b/t/999-installer/all.do index 91721a2..31c1f43 100644 --- a/t/999-installer/all.do +++ b/t/999-installer/all.do @@ -1,2 +1,2 @@ rm -rf test.tmp -DESTDIR=$PWD/test.tmp redo ../../install >install.log 2>&1 +DESTDIR="$PWD/test.tmp" redo ../../install >install.log 2>&1