[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Canonical pushes upstart into user session - systemd developer complains



On Sun, Dec 02, 2012 at 12:31:00PM +0100, Vincent Lefevre wrote:
> On 2012-12-01 10:16:54 +0100, Wouter Verhelst wrote:
> > On Fri, Nov 30, 2012 at 02:18:04AM +0100, Vincent Lefevre wrote:
> > > At least for Perl, I can't see anything related to validation.
> > 
> > That's because validating an ini file is trivially easy:
> > 
> > the line is a comment line, which must start with a # after optional
> > whitespace,
> > or it is a section header, where all data must be surrounded by [],
> > or it is a key-value pair, where the key must be one word and be
> > separated by the value by a =
> > 
> > or it is invalid.
> 
> No, that's not sufficient.

Of course it is.

> You may want relations between key-value pair. For instance, if you
> have a line with a key "foo", then a line with a key "bar" must also
> exist. Or a line with a key "number" must have a value that is a
> number (more generally matching some regexp).

That's not validation of the format, that's validation of the data.
Something like that is done by the actual code, not by a data format. A
library may be able to help, but that's all (and yes, there are plenty
of libraries that can do such thing for ini files).

> > There, validation.
> > 
> > To validate an XML file, much more is involved, including checks of
> > nested tags and escaped characters.
> 
> That's well-formedness (which also corresponds to validation with an
> empty schema).
> 
> > > BTW, how do you do nested blocks in .ini files?
> > 
> > You can't, and that's a feature. Instead, you have keys where the
> > value is the name of another section (or possibly another ini file)
> > containing the "nested" data.
> 
> So, there is a good reason to use XML (or some other format with
> similar features) instead of ini: if one needs nested blocks or
> may need them in the future.

I've never seen any config file with nested config blocks that didn't
make the file more complex and less easy to understand.

Like I said, that's a feature.

-- 
Copyshops should do vouchers. So that next time some bureaucracy requires you
to mail a form in triplicate, you can mail it just once, add a voucher, and
save on postage.


Reply to: