Convert configuration file parsing to use flex

Previously, repmgr was using a very simple ad-hoc string-based parser,
which had various limitations and allowed configuration files to be
created in a way which could cause confusion and/or unexpected
behaviour.

For example, it accepted strings enclosed in single quotes, but treated
strings enclosed in double quotes literally. A node_name defined thusly:

    node_name="somenode"

would result in the literal value '"somenode"' being used, which could
lead to unobvious errors along the lines of:

    no record found for ""somenode""

The configuration file parser has been adapted from the one used by
PostgreSQL itself, so behaves more-or-less identically (though some
functions such as file inclusion are not supported in repmgr).

This makes configuration parsing more robust and consistent;
additionally, error reporting will be more precise.

Note this does mean that some repmgr.conf items previously accepted
as valid by repmgr will now be rejected; in particular this includes
strings containing spaces which are not enclosed in single quotes.
This commit is contained in:
Ian Barwick
2019-07-03 12:18:01 +09:00
parent b125628f7b
commit c6ca183247
8 changed files with 753 additions and 363 deletions

3
.gitignore vendored
View File

@@ -53,3 +53,6 @@ repmgr
repmgrd
repmgr4
repmgrd4
# generated files
configfile-scan.c