On 07/28/2015 08:32 PM, Dmitry Yemanov wrote:
> 28.07.2015 20:12, Paul Reeves wrote:
>> Of course, there is another related question - what is the correct behaviour?
>> I know a lot of config file parsers are written to parse to the end and
>> whichever values are set last are the values used. For example postfix is
>> specifically designed to allow this:
>>
>>     myparam = x
>>     < snip lots of config >
>>     myparam = y
>>
>> and the final value used for myparam will be y.
> I think there's a difference between multiple subsequent assignments
> inside a plain config or inside one section:
>
> <database mydb>
>     enabled false
>     blah blah
>     enabled true
> </database>
>
> which probably should work as you describe,
>
> and multiple subsequently matched sections:
>
> <database mydb>
>     enabled false
>     blah blah
> </database>
>
> <database mydb>
>     enabled true
>     blah blah
> </database>
>
> which IMO should raise an error, as it's likely some copy-paste error
> (database name pattern was not changed after copying).

Dmitry, I think we must first of all decide more general question - what 
should be done with errors detected in .conf files. Code, parsing 
configs, was initially written for FB1.5, and though it was modified 
many times main approach, taken that time, was followed: config parser 
does it's best to ignore errors in .conf and when thar errors detected 
perform reasonable (from it's POV) action - typically use default value 
for problematic parameter. I.e. if one tries to type for example:
DefaultDbCachePages=Unlimited
firebird will work using default cache pages limit. When typing:
DefaultDbCachePage=8192
unknown parameter (missing 's' in the end) will be silently ignored - 
and once again default is used.

Must say that for most of other software any error found in .conf is 
fatal - server does not start at all. May be for FB3 it's too late - but 
should not we review that approach in next release instead of deciding 
what to do with specific cases? Ignoring errors is useally bad practice 
- imagine compiler replacing any error in your program with some default 
code ;)



------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to