πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #81975

Re: REVISED PATCH - was Re: A couple of suggestions for INN 2.5.1

#81975
From: D. Stussy
Date: Sat, 10 Oct 2009 01:03
83 lines
4455 bytes
"Julien Γ‰LIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hanqri$pm1$1@news.trigofacile.com...
> Hi D. Stussy,
> > I found one side effect with my changes to the traditional overview:
Some
> > lowmarks are not being set properly.  Apparently, the routine which
> > generates the lowmark output in expireover doesn't initialize the
actual
> > variables it passes back if the opening of the overview file fails.
> > Someone forgot to set a high=0, low=1 somewhere....
> >
> > In the very last section, added one line to initialize the lowmark
variable
> > to 0, so that a group that has no index file gets no entry into the
> > "expireover -Z file" parameter.  Without this line, the variable is
never
> > set and thus picks up garbage off the stack.
> >
> > @@ -919,6 +925,11 @@
> >         tdx_index_close(index);
> >         return false;
> >     }
> > +
> > +    if (low != NULL) *low = 0;
> > +    if (!entry->indexinode) return true;
> > +    /* Since there was no inode for this group, there was nothing to
do! */
> > +
> >     tdx_index_rebuild_start(index, entry);
>
> Yet, we have just before:
>
>     index = tdx_index_open(true);
>     if (index == NULL)
>         return false;
>
> When the opening of the index file fails, "false" is returned; and
expireover has:
>
>         if (!OVexpiregroup(line, &low, history))
>             warn("can't expire %s", line);
>         else if (lowmark != NULL && low != 0)
>             fprintf(lowmark, "%s %u\n", line, low);
>
> Where in the code is used the uninitialized "low" when the index cannot
be opened?

In expireover.c, as it writes out to the lowmark file, as you quoted it
above.

The problem is that the variable "low" is never set to anything, and
therefore has a 1 - (2^-32) probability of writing a garbage value to the
lowmark file.

Note that when there's no overview file (because we skipped its
initialization due to the group being marked with 'j', 'x', or '='), we
return TRUE, not FALSE.  TRUE is returned because a [pseudo] zero entry
overview is already optimal - and not FALSE as when happens when we fail to
optimize a non-empty overview.  We know it's a zero entry overview because
its inode is zero - the whole point of the modification (to skip allocation
of empty files [or file inodes] for always-empty group types).  Since some
'x' groups (e.g. "control(\..+)?", "junk", and "to") can have data, we
don't use its flag type, but check for an actual inode allocation.

As for your specific question, are you certain that it's the group's
individual index file you're opening, or the "<pathover> /groups.index"
file?

It seems to me that "tdx_index_open()" is opening "<pathover>
/groups.index", and tdx_index_entry() is extracting a single group's
structure from that file.  As the group exists, "entry" will be NOT NULL,
so the "return FALSE" won't be taken.  "entry->indexinode" is a pointer to
the group's individual overview "*.IDX" file, which when zero, we know
doesn't exist and the group is empty.

The "*low = 0;" in the patch could be "*low = entry->high + 1;", but I
chose zero so as to exclude empty groups from the lowmark file.

Without that one line, I got a lowmark file that had garbage lowmarks for
groups that had no overview files.  I hadn't previously tested for that as
I do not regularly use the lowmark feature.

Technical Details
Message-ID: <haomhr$e9t$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!not-for-mail
References: <hag2i3$5id$4@snarked.org> <hald3h$9sl$1@snarked.org> <hanqri$pm1$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <haomhr$e9t$1@snarked.org>
Subject: Re: REVISED PATCH - was Re: A couple of suggestions for INN 2.5.1
Date: Fri, 9 Oct 2009 18:03:49 -0700
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org>
References: <hag2i3$5id$4@snarked.org> <hald3h$9sl$1@snarked.org> <hanqri$pm1$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!not-for-mail
Newsgroups: news.software.nntp
Lines: 83
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-160-18-32.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1255136635 14653 71.160.18.32 (10 Oct 2009 01:03:55 GMT)
X-Complaints-To: newsmaster@snarked.org
NNTP-Posting-Date: Sat, 10 Oct 2009 01:03:55 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478