dbTalk Databases Forums  

[BUGS] Fwd: Bug#358546: failure of pg_ctl start -w -D

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Fwd: Bug#358546: failure of pg_ctl start -w -D in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Pitt
 
Posts: n/a

Default [BUGS] Fwd: Bug#358546: failure of pg_ctl start -w -D - 03-26-2006 , 07:50 PM







--C1iGAkRnbeBonpVg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi PostgreSQL developers,

the bug report below was recently sent to Debian. The details and my
reply are at http://bugs.debian.org/358546, the executive summary is:
pg_ctl's -w option does not honour postgresql.conf's
unix_socket_directory configuration (and neither $PGHOST).

Thanks,

Martin

----- Forwarded message from Stephen Gildea <gildea (AT) stop (DOT) mail-abuse.org> --=
---

Subject: Bug#358546: failure of pg_ctl start -w -D
Reply-To: Stephen Gildea <gildea (AT) stop (DOT) mail-abuse.org>,
358546 (AT) bugs (DOT) debian.org
=46rom: Stephen Gildea <gildea (AT) stop (DOT) mail-abuse.org>
To: submit (AT) bugs (DOT) debian.org
Date: Wed, 22 Mar 2006 22:39:27 -0500
X-Spam-Status: No, score=3D1.3 required=3D4.0 tests=3DBAYES_50,DATE_IN_FUTU=
RE_06_12=20
autolearn=3Dno version=3D3.0.3

Package: postgresql-7.4
Version: 7.4.12-2
Tags: patch

When starting the PostgreSQL server (with "pg_ctl start") with a
specific directory (the -D flag), the "wait" code (triggered with the -w
option) fails to use the directory to find the Unix socket, and so it
fails to connect to the newly-started server.

To repeat, create a new database and start a server on it:

/usr/lib/postgresql/bin/initdb -D /some/directory
Edit /some/directory/postgresql.conf to define unix_socket_directory.
(It may be a separate bug that this step is necessary.)
/usr/lib/postgresql/bin/pg_ctl start -w -D /some/directory -l /some/directo=
ry/postgres.log
Note the "failed" error message, even though the server did start.


The following simple patch passes the Unix socket directory to psql for
the wait check.

In PostgreSQL 8, the pg_ctl shell script has been replaced by a C
program. I haven't tested it, but from looking at the code in pg_ctl.c,
I suspect the same bug is present. Running "start -w" calls
test_postmaster_connection(). As with the buggy script, that routine
sets only the port and fails to set the host/directory as well.

< Stephen

--- postgresql-7.4.12/src/bin/pg_ctl/pg_ctl.sh 2004-10-21 20:24:27.00000000=
0 -0400
+++ src/bin/pg_ctl/pg_ctl.sh 2006-03-20 13:31:23.000000000 -0500
@@ -387,20 +387,23 @@
if [ -z "$PGPORT" ];then
PGPORT=3D`sed -ne 's/^[ ]*port[^=3D]*=3D[ ]\+\([0-9]\+\).*/\1/p'=
$CONFFILE 2>/dev/null`
if [ -z "$PGPORT" ];then
PGPORT=3D"$DEF_PGPORT"
fi
fi
+ if [ -z "$PGHOST" ];then
+ PGHOST=3D`sed -ne "s/^[ ]*unix_socket_directory[^=3D]*=3D[ ]\+'\=
([^'].*\)'/\1/p" "$CONFFILE" 2>/dev/null`
+ fi
=20
# wait for postmaster to start
if [ "$wait" =3D yes ];then
cnt=3D0
$silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C
while :
do
- if "$PGPATH/psql" -p $PGPORT -l >/dev/null 2>&1
+ if "$PGPATH/psql" -p $PGPORT -h "$PGHOST" -l >/dev/null 2>&1
then
break;
else
$silence_echo $ECHO_N "."$ECHO_C
cnt=3D`expr $cnt + 1`
if [ "$cnt" -gt "$wait_seconds" ];then

----- End forwarded message -----

--=20
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntu.com
Debian Developer http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

--C1iGAkRnbeBonpVg
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEJosBDecnbV4Fd/IRAt2hAKCGhJPhELOCK3m5MqJvr85BehnjcQCeNdhV
cxsrlQArv2pttq3TzZ/XDts=
=eZQ9
-----END PGP SIGNATURE-----

--C1iGAkRnbeBonpVg--

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.