Discussion:
Overriding earlier entry...
(too old to reply)
Bostjan Skufca
2014-09-11 00:20:41 UTC
Permalink
Hi,

recently I noticed this warning about "overriding earlier entry". At
first I did not pay it much attention, but it became enough annoying
to look at it recently.

I am sending this email because I think that we need to do something
about it, and hope that this will help communicate valid ideas around.

Situation is a bit quirky, because of the following facts:
1. postfix manual clearly states: "When the same parameter is defined
multiple times, only the last instance is remembered."
2. Postfix uses almost no command line arguments
3. There is no option to include config files and/or directories we
have to work around that

How do we work around it?
As having and maintaining multiple copies of main.cf is cumbersome,
the pragmatic solution was to have one common configuration template
with sensible details and then -site and -local changes, for whatever
particular site needed adjusted.
When postfix is about to start, a startup script cats those files in
correct order into single main.cf file and proceeds to start postfix
itself.

Looking at the code it seems that these warnings are emited during
parse-time, before configuration is evaluated and used. Which means
there is currently no way to introduce another configuration flag
which would suppress this warning. (I may very well be wrong on this
point.) Postfix also uses almost no arguments when starting up, only
-c, -D and -v.

Here is my dilemma:
- there is no way to disable this behaviour by config directive in main.cf
- putting this to command line is not fitting at all (this is a nifty
feature compared to i.e. -c flag)
- I don't think I will be able to convince anyone (especially Vietse:)
about changing this from msg_warn to msg_debug
- I would still like those messages to go away without patching
postfix (which is what I currently do)

Does anyone else think this "issue" needs attention?

Best regards,
b.
Viktor Dukhovni
2014-09-11 03:10:43 UTC
Permalink
Post by Bostjan Skufca
I am sending this email because I think that we need to do something
about it, and hope that this will help communicate valid ideas around.
It is not difficult to merge main.cf fragments without creating
duplicate definitions of parameters. The warnings are useful for
users who accidentally define the same setting twice.
Post by Bostjan Skufca
Does anyone else think this "issue" needs attention?
A simple merge script will suffice:
--
Viktor.

#! /usr/pkg/bin/perl -w

sub parse {
my ($s, $l) = @_;
if ($s =~ m{^(\S+?)\s*=\s*(.*?)\s*$}) {
$dict{$1} = $2;
} else {
print STDERR $s, "\n";
die sprintf("%s: malformed setting at line %d\n", $ARGV, $l);
}
}
while (<>) {
chomp;
next if (/^\s*(#|$)/);
if (m{^\s}) { $buf .= $_; next }
parse($buf, $line) if defined($buf);
$buf = $_; $line = $.;
} continue {
if (eof) {
parse($buf, $line) if defined($buf);
close ARGV;
undef $buf;
}
}
foreach $k (sort keys %dict) {
printf "%s = %s\n", $k, $dict{$k};
}
Wietse Venema
2014-09-11 11:38:04 UTC
Permalink
Post by Viktor Dukhovni
Post by Bostjan Skufca
I am sending this email because I think that we need to do something
about it, and hope that this will help communicate valid ideas around.
It is not difficult to merge main.cf fragments without creating
duplicate definitions of parameters. The warnings are useful for
users who accidentally define the same setting twice.
Post by Bostjan Skufca
Does anyone else think this "issue" needs attention?
I sent a solution that uses "postconf -n >file" to produce a file
without duplicates.

Wietse
Post by Viktor Dukhovni
--
Viktor.
#! /usr/pkg/bin/perl -w
sub parse {
if ($s =~ m{^(\S+?)\s*=\s*(.*?)\s*$}) {
$dict{$1} = $2;
} else {
print STDERR $s, "\n";
die sprintf("%s: malformed setting at line %d\n", $ARGV, $l);
}
}
while (<>) {
chomp;
next if (/^\s*(#|$)/);
if (m{^\s}) { $buf .= $_; next }
parse($buf, $line) if defined($buf);
$buf = $_; $line = $.;
} continue {
if (eof) {
parse($buf, $line) if defined($buf);
close ARGV;
undef $buf;
}
}
foreach $k (sort keys %dict) {
printf "%s = %s\n", $k, $dict{$k};
}
Wietse Venema
2014-09-11 11:51:59 UTC
Permalink
Maybe this should be mentioned in the docs, probably next to explanation
that includes are not supported. My 2 c.
Postfix documentation describes the supported features. The universe
of not supported features is too large,

What you need is a "merge" option in the postconf command.

Wietse
Bostjan Skufca
2014-09-11 12:02:07 UTC
Permalink
True.
Post by Wietse Venema
Maybe this should be mentioned in the docs, probably next to explanation
that includes are not supported. My 2 c.
Postfix documentation describes the supported features. The universe
of not supported features is too large,
What you need is a "merge" option in the postconf command.
Wietse
Loading...