The "new" (3.0 and above) version of exim_dbmbuild as clearly documented
in the specs and the READMEs behaves differently with respect to duplicate
keys in the records.
I don't want make to Stop on this error, but I do want it to stop on other
errors. I could try to do something clever to look at particular exit
codes (but I saw a lot of exit(1) in the source), or I could have an
option to exim_dbmbuild, -noduperr, which if set will see to it that the
exit status is not set to 1 as a result of a duplication.
Maybe this isn't the best approach, but below my sig is the patch against
exim_dbmbuild.c from 3.12
If others think that this is a good idea, feel free to use it. It's only
three lines of added/modified code, but for all that it's GPLed.
If there are better ways to approach the problem, I'd be happy to hear
about it.
I know that it is reasonable to say that the input should be clean with no
duplicate records, but for some cases checking that is expensive and
collisions aren't such a problem (I have for example a list of "expired
addresses" with things like
address1: :fail: This addresses expired on ...
Because we do resuse aliases (yuck!) there will be duplications. But
there might be other cases where people want a make to continue on
duplicaitons, while stopping on other db errors.
--
Jeffrey Goldberg +44 (0)1234 750 111 x 2826
Cranfield Computer Centre FAX 751 814
J.Goldberg@??? http://WWW.Cranfield.ac.uk/public/cc/cc047/
Relativism is the triumph of authority over truth, convention over justice.
*** exim_dbmbuild.c-orig Wed Jan 12 16:33:04 2000
--- exim_dbmbuild.c Wed Jan 12 16:36:06 2000
***************
*** 43,48 ****
--- 43,49 ----
int add_zero = 1;
BOOL lowercase = TRUE;
BOOL warn = TRUE;
+ BOOL duperr = TRUE;
BOOL lastdup = FALSE;
#ifndef USE_DB
int is_db = 0;
***************
*** 62,67 ****
--- 63,69 ----
{
if (strcmp(argv[arg], "-nolc") == 0) lowercase = FALSE;
else if (strcmp(argv[arg], "-nowarn") == 0) warn = FALSE;
+ else if (strcmp(argv[arg], "-noduperr") == 0) duperr = FALSE;
else if (strcmp(argv[arg], "-lastdup") == 0) lastdup = TRUE;
else if (strcmp(argv[arg], "-nozero") == 0) add_zero = 0;
else break;
***************
*** 180,186 ****
if (warn) fprintf(stderr, "** Duplicate key \"%s\"\n",
keybuffer);
dupcount++;
! yield = 1;
if (lastdup) EXIM_DBPUT(d, key, content);
break;
--- 182,188 ----
if (warn) fprintf(stderr, "** Duplicate key \"%s\"\n",
keybuffer);
dupcount++;
! if(duperr) yield = 1;
if (lastdup) EXIM_DBPUT(d, key, content);
break;