Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26c825e

Browse files
committed
Allow initdb to handle relative paths for PGDATA, by converting them to
absolute before starting a backend.
1 parent bc9b199 commit 26c825e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/bin/initdb/initdb.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#
2424
# Copyright (c) 1994, Regents of the University of California
2525
#
26-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.108 2000/10/29 11:36:44 petere Exp $
26+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.109 2000/11/02 19:48:39 petere Exp $
2727
#
2828
#-------------------------------------------------------------------------
2929

@@ -321,16 +321,6 @@ then
321321
exit 1
322322
fi
323323

324-
# The data path must be absolute, because the backend doesn't like
325-
# '.' and '..' stuff. (Should perhaps be fixed there.)
326-
327-
echo "$PGDATA" | grep '^/' > /dev/null 2>&1
328-
if [ "$?" -ne 0 ]
329-
then
330-
echo "$CMDNAME: data path must be specified as an absolute path"
331-
exit 1
332-
fi
333-
334324

335325
#-------------------------------------------------------------------------
336326
# Find the input files
@@ -434,6 +424,11 @@ else
434424
fi
435425
fi
436426

427+
# Be sure that PGDATA is an absolute path, otherwise backend croaks.
428+
429+
unset CDPATH
430+
PGDATA=`cd $PGDATA && pwd`
431+
437432

438433
##########################################################################
439434
#

0 commit comments

Comments
 (0)