Re: [PATCH] Improve Configuration Checking and Parsing

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sun, 06 Jan 2013 16:46:46 -0700

On 01/04/2013 11:12 PM, Amos Jeffries wrote:

>> All the current ato* functions (in
>> src/Parsing.cc) will call self_destruct() when error occurs, which in
>> turn prints out the bungled line in the configuration file (this's
>> really good!).

> Getting rid of that bungled message is one of our config parsing upgrade
> goals. If we can adjust the xato*() calls to report errors without
> aborting Squid it will make them more useful and re-usable. They should
> still log an error, but IMO aborting is going too far.

IMO, Squid should abort when it cannot be sure its interpretation of a
configured value is correct. I agree that, in some cases, the caller is
more knowledgeable about parsing context and may decide to proceed
anyway or generate a better error message. However, I think the default
should be to abort.

In C++, this kind of problem is handled nicely by exceptions: If the
caller wants to treat the error condition specially, it can catch the
exception. Otherwise, the exception is propagated to the default handler
(which aborts, showing the exception-derived error message).

I realize that others believe that starting Squid is more important than
starting Squid with correct/intended configuration and so the default
should be to report and ignore errors. The consensus may [still] favor
that point of view. (Perhaps the default choice should be configurable.)

I just wanted to [re-]state this opinion since we are discussing
adjusting low-level parsing functions.

HTH,

Alex.
Received on Sun Jan 06 2013 - 23:47:11 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 07 2013 - 12:00:05 MST