Re: Suggested dual human/binary interface for proc/devfs

From: Russ Allbery (rra@stanford.edu)
Date: Sun Apr 09 2000 - 16:29:39 EST


Olaf Titz <olaf@bigred.inka.de> writes:

>> processor 0 {
>> vendor_id:GenuineIntel
>> cpu family:6
>> model:6
>> ...
>> }

> This kind of format has gotten rather popular lately (see INN, BIND,
> DANTE...) but I doubt it fits the purpose (of all of them). The braces
> and indentation stuff suggest we have a context-free language here, and
> in fact parsers are commonly implemented in yacc because it's so nice
> and easy, but as long as there is no real nested structure, there is no
> point in this syntax.

Yeah, INN uses it specifically because several of the config files *do*
have nested structure, and once you've started using it in a few places,
it's less confusing for everyone to eventually just standardize on the
same syntax everywhere. It's sometimes not ideal for the application, but
I think that's made up for by having consistency.

I used to dislike this configuration style because it's fairly verbose,
compared to unlabelled fields. But after some time maintaining this
stuff, I've become convinced that the labels on the fields serve an
important purpose for the person new to the software.

> In most cases the needed grouping is exactly one level. For this kind
> of structure we have the Windows/Samba/KDE .INI file format:

> [Processor 0]
> VendorID=GenuineIntel
> CPUFamily=6
> ...
> [Processor 1]
> VendorID=GenuineIntel
> ...

Also used by Kerberos, BTW.

The problem I have with this approach is that it only allows one level of
grouping. So if you look at Kerberos .conf files, you'll find that in
some cases then ended up needing an additional level of grouping, and so
you get a hybrid:

| [realms]
| stanford.edu = {
| kdc = krb5auth1.stanford.edu:88
| kdc = krb5auth2.stanford.edu:88
| kdc = krb5auth3.stanford.edu:88
| admin_server = krb5-admin.stanford.edu
| default_domain = stanford.edu
| }

I'm not sure I like what the hybrid looks like; I think I'd almost rather
just have the brace style at all levels.

> If you use a C like free form, do it at least in all consequence and
> make newline equivalent to any other whitespace, eliminating lines as a
> structural element. They confuse more than help, IMHO. But as argued
> above, this syntax isn't exactly the best one anyway.

This is a good point to consider, but I've also found that when
non-programmers try to use those configuration files, they get confused by
the semicolons and keeping the newline is more intuitive for them. But I
don't have a lot of experience here, so I could be drawing incorrect
conclusions.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:12 EST