Re: proposal: a validator for configuration files

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Selena Deckelmann <selena(at)chesnok(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: a validator for configuration files
Date: 2011-07-14 13:18:15
Message-ID: 4D165825-4B76-4D28-8724-8F6EB053A72D@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Jul 14, 2011, at 4:38 AM, Alvaro Herrera wrote:

> Excerpts from Florian Pflug's message of mié jul 13 20:12:28 -0400 2011:
>> On Jul14, 2011, at 01:38 , Alvaro Herrera wrote:
>>> One strange thing here is that you could get two such messages; say if a
>>> file has 100 parse errors and there are also valid lines that contain
>>> bogus settings (foo = bar). I don't find this to be too problematic,
>>> and I think fixing it would be excessively annoying.
>>>
>>> For example, a bogus run would end like this:
>>>
>>> 95 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 4, near end of line
>>> 96 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 41, near end of line
>>> 97 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 104, near end of line
>>> 98 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 156, near end of line
>>> 99 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 208, near end of line
>>> 100 LOG: syntax error in file "/pgsql/install/HEAD/data/postgresql.conf" line 260, near end of line
>>> 101 LOG: too many errors found, stopped processing file "/pgsql/install/HEAD/data/postgresql.conf"
>>> 102 LOG: unrecognized configuration parameter "plperl.err"
>>> 103 LOG: unrecognized configuration parameter "this1"
>>> 104 LOG: too many errors found, stopped processing file "/pgsql/install/HEAD/data/postgresql.conf"
>>> 105 FATAL: errors detected while parsing configuration files
>>
>> How about changing ParseConfigFile to say "too many *syntax* error found"
>> instead? It'd be more precise, and we wouldn't emit exactly the
>> same message twice.
>
> Yeah, I thought about doing it that way but refrained because it'd be
> one more string to translate. That's a poor reason, I admit :-) I'll
> change it.

This is happening because a check for total number of errors so far is happening only after coming across at least one non-recognized configuration option. What about adding one more check right after ParseConfigFile, so we can bail out early when overwhelmed with syntax errors? This would save a line in translation :).

>
>> Do you want me to take a closer look at your modified version of the
>> patch before you commit, or did you post it more as a "FYI, this is
>> how it's going to look like"?
>
> I know I'd feel more comfortable if you (and Alexey, and Selena) gave it
> another look :-)

I have checked it here and don't see any more problems with it.

--
Command Prompt, Inc. http://www.CommandPrompt.com
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2011-07-14 14:23:47 Re: [BUG] SSPI authentication fails on Windows when server parameter is localhost or domain name
Previous Message Radosław Smogura 2011-07-14 12:52:33 Re: Patch Review: Bugfix for XPATH() if text or attribute nodes are selected