makehistory(1) puts duplicated Xref: headers in overview

WATANABE Katsuhiro katsu at watanabe.name
Mon Oct 25 11:39:23 UTC 2004


I've found makehistory puts duplicated "Xref: " strings
in overview data in some special cases. It happens for
articles that have no Xref: header. Recent INN always put
Xref: when it stores articles in storage, but some old
versions of INN(1.x?) may store articles without Xref:.

Following is an concrete symptom of this problem.
==== quote from ~news/spool/overview/.../NEWSGROUPNAME.DAT =====
1	status "D" of process runnability (In Romaji)	futagami at nttspl.ntt.junet (Toshitsugu Futagami)	7 Mar 86 20:40:38 GMT	<138 at nttspl.ntt.junet>			17	Xref: Xref: katsu.watanabe.name fj.unix:1
==== end of quote ====

Now let me explain why this happens.

In DoArt() of inn-2.4.1/expire/makehistory.c, if there
is no valid Xref: header in the article header for some
reason(at line 563), it tries to put "Xref: " string
explicitly (at 576) in the overview data:

    563     if (DoOverview && Xrefp->HeaderLength == 0) {

    576             snprintf(overdata, sizeof(overdata), "%s: %s %s:%lu", XREF,
    577                      innconf->pathhost, ann.groupname, ann.artnum);
    578             Xrefp->Header = overdata;
    579             Xrefp->HeaderLength = strlen(overdata);

(I presume this code portion is inherited from old legacy
version of INN that could store articles without Xref:.)

In turn, db/overview.fmt of inn-2.4.1 indicates that the
overview data should always have "full" description for
Xref: header. This means "Xref: " string should always
appear in the overview data. The "full" behaviour is
accomplished by the code portion at around line 641-642.

    634     if (DoOverview && Xrefp->HeaderLength > 0) {
    635         for (fp = ARTfields, j = 0; j < ARTfieldsize; j++, fp++) {
    636             if (fp == ARTfields)
    637                 buffer_set(&buffer, "", 0);
    638             else
    639                 buffer_append(&buffer, SEP, strlen(SEP));
    640             if (fp->NeedHeadername) {
    641                 buffer_append(&buffer, fp->Headername, fp->HeadernameLen
gth);
    642                 buffer_append(&buffer, COLONSPACE, strlen(COLONSPACE));

Please note, this if-clause must always be executed even
if there is no Xref: in the article, because
Xrefp->HeaderLength has been reset to positive value
before this point (at 579 above).

Consequently, "Xref: " string will appear two times in the
overview data, one by explicit handling for no-Xref: special
case, another by "full" keyword in overview.fmt.


I'd propose to solve this problem by omitting XREF keyword
and surrounding colon, space, etc. in snprintf() call at
line 576. It is natural for me that only overview.fmt should
specify the format of overview data.

-- 
WATANABE Katsuhiro



More information about the inn-bugs mailing list