The majority of server programs with config files in /etc/ are protected by portage from overwriting custom configurations, because the new file is created initially as a dot-file, and is detected by programs such as dispatch-conf. This is so work is not lost. There is an additional benefit, though, and this may be an unintended side effect, but the configs are usually protected from being changed to a broken configuration, through the same mechanism.
However, If a program, such as apache or dovecot gets a new file in a conf.d/ directory where the program has a wildcard match on config files, the new file is just entered into the mix with the rest, regardless of how it may interact with the existing configuration files, and regardless of any dependencies between content in new and changed config files - changes to existing files which have not been saved to the real config file. So it doesn't always enjoy the same benefit of a non-broken configuration.
Could it be possible for a package to establish a wildcard pattern similar to what these conf.d directories match on, so that portage can use that to create new files as dot-files that do not match the pattern?
e.g. on the upgrade to dovecot 2.1, instead of creating /etc/dovecot/conf.d/15-mail.conf as a new config file, create /etc/dovecot/conf.d/._cfg0000_15-mail.conf?
This should only be relevant to an upgrade or the initial install of these programs would be broken, or perhaps, if any file is detected, the others could be written as dot files for dispatch-conf to integrate.
(In reply to comment #0)
> Could it be possible for a package to establish a wildcard pattern similar
> to what these conf.d directories match on, so that portage can use that to
> create new files as dot-files that do not match the pattern?
You want the package to configure this for you automatically, by installing a configuration file containing patterns for the package manager to use?
> This should only be relevant to an upgrade or the initial install of these
> programs would be broken, or perhaps, if any file is detected, the others
> could be written as dot files for dispatch-conf to integrate.
For the initial install, the mentioned "configuration file containing patterns" would not be installed yet, so maybe that would be enough to prevent it from breaking the initial install.
Well, I don't really know a lot technically about how ebuilds, dispatch-conf, etc-update and all of the interrelated apps work, and the more my suggestion leans into implementation details, the less likely my input will be useful. That being said, I think what you said sounds good.
At my level, as a gentoo admin and someone who has written & compiled software but never written an ebuild or explored the portage code, I guess I was thinking it would be some kind of magic that could come out of a new ebuild option, and I might not ever know exactly how it figured it out.
I thought of another hitch, by the way, which is that I'm not actually positive that dovecot or apache's wildcard will not match dot-files, assuming they end with ".conf"
If this is something that ebuilds will need to be aware of, then it should go in PMS.