🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #81960

A couple of suggestions for INN 2.5.1 (with patch)

#81960
From: D. Stussy
Date: Tue, 06 Oct 2009 01:45
176 lines
8207 bytes
Changes proposed:

1)  NNRPD program:
 a)  I found some inconsistencies when one converts a group flag to 'n' (as
RFC 3977 suggests that 'y', 'm', and 'n' are the only universally known
flags).  INN appeared to do this for "LIST ACTIVE" but NOT in "NEWGROUPS"
or "LIST ACTIVE no-wildcard-group" commands.  Any unknown flag, not just
'j' or 'x', will now be converted to 'n' for all three commands.
 b)  In some places, alias groups would be emitted into the output and
others, they would not be.  Alias groups are not really carried; their
articles being filed under the main group's name (which is typically a
y/m/n group); similarly with groups marked by 'j' which are filed in the
"junk" group (if none of the groups are otherwise fileable).  Therefore, it
made sense to consistently exclude 'j' and '=' groups from the output of
the three commands above.
 c)  'x' groups and any group with an unknown status flag will continue to
be issued to these lists (using 'n').  This was necessary as the
pseudogroups "junk", "control", and "control.*" should not permit posts to
propagate server to server under these names and therefore need the 'x'
status flag.  Administrators should have read access to these pseudogroups.
As some client readers won't access groups that aren't listed, 'x' groups
cannot be excluded from the above commands.

Reason for change:  Consistency of output.

PS:  Marking the junk and control groups with 'x' does not hamper their use
at all for filing control messages or 'j'-marked groups.  Perhaps the INN
distribution default for these (and "to") could be changed from 'y' to 'x'?

2)  Traditional overview:
The modifications below change the behavior of creating empty overview
files for groups marked with 'j', 'x', or '='.  Groups so marked will never
have any postings directly to them (except for the control, junk, and to
pseudogroups) and will therefore always remain empty.  Therefore, the
changes avoid creating overview files for them.  However, should any such
group have existing overview files, they will be used.  Typically, only the
internal pseudogroups will have overview files.

I have run the modification to the traditional overview method for 3 months
without any problems.

Reason for change:  Prevention of the reservation of file system resources
that likely won't be used.

Comments?

The patch - against INN 2.5.0 source:

diff -urN nnrpd/commands.c nnrpd/commands.c
--- nnrpd/commands.c 2009-05-21 20:08:33.000000000 +0000
+++ nnrpd/commands.c 2009-10-06 00:00:00.000000000 +0000
@@ -559,8 +559,10 @@
      continue;
  q++;
  key.name = p;
+ if (strchr("=j", *q) != NULL) continue;
  if ((gd = bsearch(&key, grouplist, numgroups, sizeof(GROUPDATA),
GroupCompare)) == NULL)
      continue;
+ if (strchr("ymn", *q) == NULL) *q = 'n';
  Printf("%s %lu %lu %s\r\n", p, gd->high, gd->low, q);
  numfound--;
     }
diff -urN nnrpd/list.c nnrpd/list.c
--- nnrpd/list.c 2009-05-21 20:08:33.000000000 +0000
+++ nnrpd/list.c 2009-10-06 00:00:00.000000000 +0000
@@ -144,9 +144,9 @@
         if (!PERMmatch(PERMreadlist, grplist))
             return false;
     }
-    if (OVgroupstats(group, &lo, &hi, &count, &flag) && flag != '=') {
+    if (OVgroupstats(group, &lo, &hi, &count, &flag) && strchr("=j", flag)
!= NULL) {
         /* Convert flags to standardized ones, if possible. */
-        if (flag == 'j' || flag == 'x')
+        if (strchr("ymn", flag) == NULL)
             flag = 'n';
         /* When a newsgroup is empty, the high water mark should be one
less
          * than the low water mark according to RFC 3977. */
@@ -315,7 +315,9 @@
             /* Convert flags to standardized ones, if possible. */
             if ((q = strrchr(p, ' ')) != NULL) {
                 q++;
-                if (*q == 'j' || *q == 'x')
+  if (strchr("=j", *q) != NULL)
+      continue;
+  if (strchr("ymn", *q) == NULL)
                     *q = 'n';
             }
         }
diff -urN storage/tradindexed/tdx-data.c storage/tradindexed/tdx-data.c
--- storage/tradindexed/tdx-data.c 2009-05-21 20:08:33.000000000 +0000
+++ storage/tradindexed/tdx-data.c 2009-10-06 00:00:00.000000000 +0000
@@ -1055,10 +1055,12 @@

     /* Check the inode of the index. */
     if (data->indexinode != index->indexinode) {
-        warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
-             (unsigned long) data->indexinode,
-             (unsigned long) index->indexinode);
-        if (fix) {
+        if (index->indexinode) {
+            warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
+                 (unsigned long) data->indexinode,
+                 (unsigned long) index->indexinode);
+        }
+        if (fix || !index->indexinode) {
             index->indexinode = data->indexinode;
             changed = true;
         }
diff -urN storage/tradindexed/tdx-group.c storage/tradindexed/tdx-group.c
--- storage/tradindexed/tdx-group.c 2009-05-21 20:08:33.000000000 +0000
+++ storage/tradindexed/tdx-group.c 2009-10-06 00:00:00.000000000 +0000
@@ -658,10 +658,12 @@
     entry->count = 0;
     entry->flag = *flag;
     data = tdx_data_new(group, index->writable);
-    if (!tdx_data_open_files(data))
-        warn("tradindexed: unable to create data files for %s", group);
-    entry->indexinode = data->indexinode;
-    tdx_data_close(data);
+    if (strchr("=jx",*flag) == NULL) {
+        if (!tdx_data_open_files(data))
+            warn("tradindexed: unable to create data files for %s",
group);
+        entry->indexinode = data->indexinode;
+        tdx_data_close(data);
+    }
     index_add(index, entry);

     index_lock(index->fd, INN_LOCK_UNLOCK);
@@ -765,8 +767,10 @@
             index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
             goto fail;
         }
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s", group);
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s", group);
+        }
         high = entry->high;
         base = entry->base;
         index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
@@ -805,9 +809,11 @@
     if (entry->indexinode != data->indexinode) {
         if (!tdx_data_open_files(data))
             goto fail;
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s",
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s",
                  HashToText(entry->hash));
+        }
         data->base = entry->base;
     }

@@ -919,6 +925,10 @@
         tdx_index_close(index);
         return false;
     }
+
+    if (!entry->indexinode) return true;
+    /* Since there was no inode for this group, there was nothing to do!
*/
+
     tdx_index_rebuild_start(index, entry);

     /* tdx_data_expire_start builds the new IDX and DAT files and fills in
the

Technical Details
Message-ID: <hag2i3$5id$4@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

Show Full Headers
Complete Article Headers
Message-ID: <hag2i3$5id$4@snarked.org>
Subject: A couple of suggestions for INN 2.5.1 (with patch)
Date: Mon, 5 Oct 2009 18:45:24 -0700
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.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
Newsgroups: news.software.nntp
Lines: 176
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 1254854019 5709 71.160.18.32 (6 Oct 2009 18:33:39 GMT)
X-Complaints-To: newsmaster@snarked.org
NNTP-Posting-Date: Tue, 6 Oct 2009 18:33:39 +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