We sell a medium to largish software product written in C++ with Qt. Or to be more honest we sell computers with our software product manually configured by the software developers on it. The computers run a fairly old version of Debian Linux.
One of the reasons why developers need to manually configure it is that our software does not have an installer and finding out what libraries need to be installed is currently a process of trial and error. I've been pushing for a sane solution for over a year now, but this always gets pushed behind the next deadline because so much else is also wrong with the software.
The other reason is our configuration files. While running our product, depending on configuration, consists of 10-25 processes that communicate via DBUS. For each of those processes there is an executable and a configuration file. So if you for example need to set an IP address for something you get to search the configuration files to find the right one. I'll now list some of the things about this that made me go WTF:
- Some of the values are duplicated in multiple files.
- The configuration files live in their own folder and for legacy reasons their filenames start with a dot, which means that linux treats them as hidden files.
- They use a home-grown format implemented in extremely ugly code and with some odd features (see below)
- We have a "configuration tool" that just shows the contents of each file in a tab with a text input field for each possible value.
- Some executables read from other executables' configuration files instead of just their own.
- Naming of the configuration files is inconsistent with the naming of the executables.
- One of the executables has recently been renamed. It's configuration was half-renamed for a while. That is, some keys were in the old config file, some in the new one.
Now some details about the implementation of the home-grown format:
Config files are parsed by a class called Ccontrolfile (capitalization like in our code, name anonymized). The constructor for Ccontrolfile takes a filename string but also does something else: If that string starts with the user's home directory that part of the path is replaced by the contents of the environment variable CONTROLFILE_PATH. It does not use the environment variable when the user's home directory is not in the filename string.
An example for the control file format:
KEY1 = foo
# This line is a comment
KEY2 = bar # this is not a comment even though it looks like one
# There is one level of nesting permitted. Not more than that.
A.FOO = true
A.BAR = false
# Repeating keys means you are creating a list.
A.baz = 1
A.baz = 2
A.baz = 3
The control file library prints an error message to standard error whenever code tries to access a key that does not exist. This is especially unfortunate because the interface contains no method to query if a key is in the file.
That's about what I remember while not staring at the code in horror. To clarify the title, I would have preferred XML configuration files that for some inexplicable reason needed to be passed through XSLT before being used.