Fix contrib/pg_upgrade/test.sh for $PWD containing spaces.
authorNoah Misch <noah@leadboat.com>
Fri, 20 Jun 2014 01:47:08 +0000 (21:47 -0400)
committerNoah Misch <noah@leadboat.com>
Fri, 20 Jun 2014 01:47:08 +0000 (21:47 -0400)
Most of the necessary quoting was in place; this catches the exceptions.

contrib/pg_upgrade/test.sh

index 9d31f9a6e45911332295650aac589dc83e3903c5..7bbd2c7c07e06bd3817b6a49957f4e0865d2afe9 100644 (file)
@@ -80,7 +80,7 @@ if [ "$1" = '--install' ]; then
    # use psql from the proper installation directory, which might
    # be outdated or missing. But don't override anything else that's
    # already in EXTRA_REGRESS_OPTS.
-   EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --psqldir=$bindir"
+   EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --psqldir='$bindir'"
    export EXTRA_REGRESS_OPTS
 fi
 
@@ -117,7 +117,7 @@ PGCONNECT_TIMEOUT=""; unset PGCONNECT_TIMEOUT
 PGHOSTADDR="";        unset PGHOSTADDR
 
 # Select a non-conflicting port number, similarly to pg_regress.c
-PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' $newsrc/src/include/pg_config.h | awk '{print $3}'`
+PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' "$newsrc"/src/include/pg_config.h | awk '{print $3}'`
 PGPORT=`expr $PG_VERSION_NUM % 16384 + 49152`
 export PGPORT
 
@@ -141,8 +141,8 @@ export EXTRA_REGRESS_OPTS
 # enable echo so the user can see what is being executed
 set -x
 
-$oldbindir/initdb -N
-$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w
+"$oldbindir"/initdb -N
+"$oldbindir"/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w
 if "$MAKE" -C "$oldsrc" installcheck; then
    pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$?
    if [ "$newsrc" != "$oldsrc" ]; then
@@ -167,7 +167,7 @@ if "$MAKE" -C "$oldsrc" installcheck; then
 else
    make_installcheck_status=$?
 fi
-$oldbindir/pg_ctl -m fast stop
+"$oldbindir"/pg_ctl -m fast stop
 if [ -n "$make_installcheck_status" ]; then
    exit 1
 fi