On Thu, Jan 27, 2022 at 05:09:38PM -0500, Wietse Venema <wie...@porcupine.org> wrote:
> Viktor Dukhovni: > > It is unfortunate that Postfix does not support "+=" main.cf settings > > that augment the default value of a given parameter. In the case > > The semantics have not been worked out. Below is an attempt. > > Here, the parameter value should be 'whatever bar'. > > main.cf > # Assume foo has a default value of 'whatever'. > foo += bar > > That adds complexity, because the Postfix main.cf reader does not > know parameter default values at the time that it reads parameter > settings. Postfix looks up parameter default values after reading > the entire main.cf file (some default values are determined > dynamically, and that should happen only if really necessary). Only > after that can Postfix append the '+= bar' value to 'whatever'. > The complexity is that the main.cf reader will have to store the > '=' and '+=' inputs differently, perhaps under 'foo' and '+foo'. > > Below, the second line overrides all earlier foo settings, so the > value is 'whatever', not 'whatever bar': > > main.cf > foo += bar > foo = whatever > > This adds no significant complexity. > > The -o options in master.cf should behave like they do in main.cf, > and the same holds for -o options on the postconf and other command > lines. > > For consistency, settings in other config files (ldap, *sql, etc.) > should also support +=. Hopefully, cfg_parser can handle that (it > uses the same configuration file reader as is used for main.cf). > > I would advise against faking += in the postconf command, where > > postconf foo+=bar > > is fakeds by doing the equivalent of > > postconf foo="`postconf -h foo` bar" > > This would not work as expected: it would not follow changes in the > default value, like the real += would. > > Wietse And if += is added, people will expect -= as well. And it suddenly makes the order of parameter settings significant. When I first thought += would be good, it didn't last long. I assumed it was kept simple for a reason (e.g., minimising complexity and risk of configuration errors). I concluded that knowing that, when you find a parameter in main.cf, it is the complete definition, and there are no other bits elsewhere to modify it, was of great benefit in reading and analysing main.cf files (especially those written by other people). cheers, raf