Re: pg_hba.conf - patch to report all parsing errors, and then bail

Lists: pgsql-hackers
From: Selena Deckelmann <selena(at)endpoint(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-07 18:10:06
Message-ID: 49B2B87E.2050001@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Currently, load_hba() bails on the first parsing error. It would be
better for the typo-prone sysadmin if it reported ALL errors, and THEN
bailed out.

This patch implements that behavior. Tested against 8.4 HEAD this morning.

Idea is to do a similar thing for postgresql.conf. That is a little more
complicated and will be a separate patch.

-selena

--
Selena Deckelmann
End Point Corporation
selena(at)endpoint(dot)com
503-282-2512

Attachment Content-Type Size
hba_report_all_parse_errors_v1.patch text/plain 1.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Selena Deckelmann <selena(at)endpoint(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-07 18:28:32
Message-ID: 15584.1236450512@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Selena Deckelmann <selena(at)endpoint(dot)com> writes:
> Currently, load_hba() bails on the first parsing error. It would be
> better for the typo-prone sysadmin if it reported ALL errors, and THEN
> bailed out.

> This patch implements that behavior. Tested against 8.4 HEAD this morning.

It sure looks like that's going to try to free new_parsed_lines more
than once. Shouldn't clean_hba_list be done just once?

regards, tom lane


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Selena Deckelmann <selena(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-07 18:49:17
Message-ID: 49B2C1AD.9070805@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Selena Deckelmann <selena(at)endpoint(dot)com> writes:
>> Currently, load_hba() bails on the first parsing error. It would be
>> better for the typo-prone sysadmin if it reported ALL errors, and THEN
>> bailed out.
>
>> This patch implements that behavior. Tested against 8.4 HEAD this morning.
>
> It sure looks like that's going to try to free new_parsed_lines more
> than once. Shouldn't clean_hba_list be done just once?

Yeah, it should be done in the if branch down below. And I think by our
coding standards (or at least by our conventions), the variable should
be "ok" and not "OK".

Unless there are any objections, I can do those cleanups and apply it.

//Magnus


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Selena Deckelmann <selena(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-07 18:51:49
Message-ID: 15918.1236451909@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Tom Lane wrote:
>> It sure looks like that's going to try to free new_parsed_lines more
>> than once. Shouldn't clean_hba_list be done just once?

> Yeah, it should be done in the if branch down below. And I think by our
> coding standards (or at least by our conventions), the variable should
> be "ok" and not "OK".

> Unless there are any objections, I can do those cleanups and apply it.

I thought the adjacent comments could do with a bit more wordsmithing,
also, but otherwise that about covers it.

regards, tom lane


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Selena Deckelmann <selena(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-07 21:28:10
Message-ID: 49B2E6EA.1090402@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> Tom Lane wrote:
>>> It sure looks like that's going to try to free new_parsed_lines more
>>> than once. Shouldn't clean_hba_list be done just once?
>
>> Yeah, it should be done in the if branch down below. And I think by our
>> coding standards (or at least by our conventions), the variable should
>> be "ok" and not "OK".
>
>> Unless there are any objections, I can do those cleanups and apply it.
>
> I thought the adjacent comments could do with a bit more wordsmithing,
> also, but otherwise that about covers it.

Applied.

//Magnus


From: Selena Deckelmann <selena(at)endpoint(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_hba.conf - patch to report all parsing errors, and then bail
Date: 2009-03-08 21:04:55
Message-ID: 49B432F7.7020807@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Magnus Hagander wrote:

>
> Applied.
>
> //Magnus

Thanks.

And thanks, Tom, for pointing out my multiple attempts to free.

-selena

--
Selena Deckelmann
End Point Corporation
selena(at)endpoint(dot)com
503-282-2512