Обсуждение: Require Assistance Solving Problem - erroneous pg_hba.conf
After messing with this all week and getting nowhere, I'm ready to pay
someone to call me at 800-481-5022 ext 3005 to get this resolved ASAP. Our
online scheduling system has been down all week and the troops are ready to
revolt. Background:
A RedHat Upgrade Saturday from 8.0 to 9.0 just did a 'minor' version
upgrade from 7.3.1 to 7.3.2. However, I have not been able to get a
connection since
the upgrade. Postmaster loads fine, but I get:
FATAL: Missing or erroneous pg_hba.conf file, see postmaster log for details
Here is my pg_hba.conf file (from /var/lib/pgsql/data) that has always
worked:
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all
trust
host all all 127.0.0.1 255.255.255.255
trust
host all all 192.168.1.0 255.255.255.0
trust
host all all 24.128.216.179 255.255.255.255
md5
host all all 217.33.107.74 255.255.255.248
md5
I even reloaded the entire data directory from tape backup. Postgresql.conf
file is the
default - all lines commented out. Postmaster starts with:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-i -p ${PGPORT}' start > /var/log/pgsql 2>&1" <
/dev/null
(where $PGDATA is /var/lib/pgsql/data and $PGPORT is 5432)
pgsql log shows:
FATAL: Missing or erroneous pg_hba.conf file, see postmaster log for
details
"OG: parse_hba: invalid syntax in pg_hba.conf file at line 31, token "
Even the log entry doesn't look right - double quotes - and the .conf file
certainly doesn't have 31 lines!
Please call if you have any ideas how to fix this. Thanks.
________________________
Greg Kelley, IT Director
Britannic Aviation, US and UK
US Office:
Pease Int'l Tradeport
68 New Hampshire Ave.
Portsmouth, NH 03801
603.766.3005
http://www.britannicaviation.com
AOPA, EAA, SSA
CFII SEL, MEL; Comm Glider
"Greg Kelley" <gkelley@britannicaviation.com> writes:
> pgsql log shows:
> FATAL: Missing or erroneous pg_hba.conf file, see postmaster log for
> details
> "OG: parse_hba: invalid syntax in pg_hba.conf file at line 31, token "
> Even the log entry doesn't look right - double quotes - and the .conf file
> certainly doesn't have 31 lines!
Indeed. I think it's a Windows-newline issue: you probably edited the
config file with something that put in \r\n instead of \n. The
overstruck LOG is a dead giveaway...
I thought we had fixed the various config file parsers to be reasonably
impervious to stray \r's, but you may have found a corner case where
it's not recognized as whitespace. Try getting rid of the \r's.
regards, tom lane
Tom Lane wrote: > "Greg Kelley" <gkelley@britannicaviation.com> writes: > > pgsql log shows: > > > FATAL: Missing or erroneous pg_hba.conf file, see postmaster log for > > details > > "OG: parse_hba: invalid syntax in pg_hba.conf file at line 31, token " > > > Even the log entry doesn't look right - double quotes - and the .conf file > > certainly doesn't have 31 lines! > > Indeed. I think it's a Windows-newline issue: you probably edited the > config file with something that put in \r\n instead of \n. The > overstruck LOG is a dead giveaway... > > I thought we had fixed the various config file parsers to be reasonably > impervious to stray \r's, but you may have found a corner case where > it's not recognized as whitespace. Try getting rid of the \r's. Also, please don't wait a week and have your users frustrated before asking for assistance --- we are here to help. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
"Greg Kelley" <gkelley@britannicaviation.com> writes:
> A RedHat Upgrade Saturday from 8.0 to 9.0 just did a 'minor' version
> upgrade from 7.3.1 to 7.3.2.
> [ and broke his pg_hba.conf ]
Ah-hah, I now know where the behavioral change came from: the Red Hat
RPMs contain this patch:
--- postgresql-7.3.2/src/backend/libpq/hba.c.sopwith 2003-01-09 09:09:01.000000000 -0500
+++ postgresql-7.3.2/src/backend/libpq/hba.c 2003-01-09 09:09:09.000000000 -0500
@@ -72,11 +72,13 @@
* Some standard C libraries, including GNU, have an isblank() function.
* Others, including Solaris, do not. So we have our own.
*/
+#ifndef isblank
static bool
isblank(const char c)
{
return c == ' ' || c == '\t' || c == '\r';
}
+#endif
/*
which on RHL 9 causes the system definition of isblank() to be
substituted for Postgres'. That means \r is no longer treated as
whitespace, as it was in prior versions.
There is a fix in our CVS tree that prevents this problem and restores
the old treatment of \r, but for now you gotta get rid of the Windows-
style newlines.
regards, tom lane
Never had them that I can tell - created a new .conf file using vi so I know
it was clean as I was testing. Uninstall/reinstall RPMs worked - sort of.
Now I'm getting pgadmin-II to blow up saying:
2003-04-17 12:27:17 - Error in pgAdmin
II:frmConnect.cmdConnect_Click: -2147417848 - Automation error
The object invoked has disconnected from its clients.
and my php-pgsql is showing:
pg_exec() query failed: ERROR: Bad date external representation
(but this may be a version out of sync as I just installed the php-pgsql
DSO)
...so all still isn't well in dodge...
I can run psql, connect to the scheduler database, do a SELECT, etc.
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Greg Kelley" <gkelley@britannicaviation.com>
Cc: <pgsql-admin@postgresql.org>; "Bruce Momjian" <pgman@candle.pha.pa.us>;
"Joe Conway" <mail@joeconway.com>
Sent: 17 April, 2003 12:53 PM
Subject: Re: [ADMIN] Require Assistance Solving Problem - erroneous
pg_hba.conf
"Greg Kelley" <gkelley@britannicaviation.com> writes:
> A RedHat Upgrade Saturday from 8.0 to 9.0 just did a 'minor' version
> upgrade from 7.3.1 to 7.3.2.
> [ and broke his pg_hba.conf ]
Ah-hah, I now know where the behavioral change came from: the Red Hat
RPMs contain this patch:
--- postgresql-7.3.2/src/backend/libpq/hba.c.sopwith 2003-01-09
09:09:01.000000000 -0500
+++ postgresql-7.3.2/src/backend/libpq/hba.c 2003-01-09
09:09:09.000000000 -0500
@@ -72,11 +72,13 @@
* Some standard C libraries, including GNU, have an isblank() function.
* Others, including Solaris, do not. So we have our own.
*/
+#ifndef isblank
static bool
isblank(const char c)
{
return c == ' ' || c == '\t' || c == '\r';
}
+#endif
/*
which on RHL 9 causes the system definition of isblank() to be
substituted for Postgres'. That means \r is no longer treated as
whitespace, as it was in prior versions.
There is a fix in our CVS tree that prevents this problem and restores
the old treatment of \r, but for now you gotta get rid of the Windows-
style newlines.
regards, tom lane
Yep, makes sense. This is clearly our bug because we overrode a
standard C function with one that didn't behave the same. My man page
says isblank tests only for space and tab, while we added \r to handle
DOS files cleanly.
---------------------------------------------------------------------------
Tom Lane wrote:
> "Greg Kelley" <gkelley@britannicaviation.com> writes:
> > A RedHat Upgrade Saturday from 8.0 to 9.0 just did a 'minor' version
> > upgrade from 7.3.1 to 7.3.2.
> > [ and broke his pg_hba.conf ]
>
> Ah-hah, I now know where the behavioral change came from: the Red Hat
> RPMs contain this patch:
>
> --- postgresql-7.3.2/src/backend/libpq/hba.c.sopwith 2003-01-09 09:09:01.000000000 -0500
> +++ postgresql-7.3.2/src/backend/libpq/hba.c 2003-01-09 09:09:09.000000000 -0500
> @@ -72,11 +72,13 @@
> * Some standard C libraries, including GNU, have an isblank() function.
> * Others, including Solaris, do not. So we have our own.
> */
> +#ifndef isblank
> static bool
> isblank(const char c)
> {
> return c == ' ' || c == '\t' || c == '\r';
> }
> +#endif
>
>
> /*
>
> which on RHL 9 causes the system definition of isblank() to be
> substituted for Postgres'. That means \r is no longer treated as
> whitespace, as it was in prior versions.
>
> There is a fix in our CVS tree that prevents this problem and restores
> the old treatment of \r, but for now you gotta get rid of the Windows-
> style newlines.
>
> regards, tom lane
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Re: Require Assistance Solving Problem - erroneous pg_hba.conf
От
dalgoda@ix.netcom.com (Mike Castle)
Дата:
In article <10547.1050590455@sss.pgh.pa.us>,
Tom Lane <tgl@sss.pgh.pa.us> wrote:
>I thought we had fixed the various config file parsers to be reasonably
>impervious to stray \r's, but you may have found a corner case where
>it's not recognized as whitespace. Try getting rid of the \r's.
I hate to jump on band-wagons, but..... would switching to an XML based
config file be worth it?
I was also wondering how XML would work for dump/restore.
mrc
--
Mike Castle dalgoda@ix.netcom.com www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc