🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #20213

Cancel Patch 1.51sec2

#20213
From: System Administrator
Date: Tue, 05 Aug 1997 00:00
194 lines
7243 bytes
cancel.151sec2.patch  

     ftp://ftp.lightlink.com/pub/homer/innd/cancel.151sec2.patch
 
     Thanks to Joe Greco, jgreco@ns.sol.net for the original work on
1.5.1 which can be found at

     http://www.nntp.sol.net/patches

     Here is Joe's patch to art.c that allows control.cancel to be
split into different directories.

     The diffs are against my own original 1.5sec2 and the now running
version.  I had to hand edit art.c from the diffs for 1.5.1 at the web
site as the patch bombed out on hunks 3 and 4.

     It seems to be working on my system.

     After patching, compiling, and installing the new innd, I did a
simple

     cd /var/spool/news/control
     mv cancel cancelold

     And restarted innd let it rip.

     Now getting rid of cancelold is going to be a bear, as it has
107000 files in it and the directory size is 1.7 MEG!

     The fastfs.c program seems to make a marked improvement on rm's
of these directory's, maybe 299 percent or more improvement in speed.
For SunOS and Solaris only.

     http://www.cis.ohio-state.edu/~barr/INN.html

     Homer 8/3/1997

========================================================================

This patch, I just revived.  It forces the control/cancel newsgroup to
be processed "differently" by creating subdirectories.

A few notes..  

1) you will need to add a "control.cancel" newsgroup, as the code is
   hard wired to look for that.
2) you will need to modify your expire.ctl to expire "control.cancel*"
   instead of "control.cancel" if you want a custom expire time for
   cancels.
3) quite obviously, this breaks nnrp, which tries to scan the
   /news/control/cancel directory for its articles.  small price to
   pay.

4) ********************************************************************
   * READ READ READ READ READ READ READ READ READ READ READ READ READ *
   ********************************************************************
   * I have not used this patch in several years.  The comments and   *
   * notes, not to mention the patch itself, are not guaranteed to be *
   * entirely correct.  If you do not understand the code, and you    *
   * don't have any friends that can help you, I CAN NOT PROVIDE YOU  *
   * WITH ASSISTANCE.  This code is provided as a courtesy only, and  *
   * did work at one time.  Let me know if it works for you though.   * 
   ********************************************************************
   * READ READ READ READ READ READ READ READ READ READ READ READ READ *
   ********************************************************************

5) I do not have an inn-1.5.1 box that uses the old spool format.
   Untested.

JG19970627





*** art.c.safe	Sun Aug  3 16:48:21 1997
--- art.c	Sun Aug  3 17:14:40 1997
***************
*** 2,7 ****
--- 2,13 ----
  **
  **  Article-processing.
  */
+ 
+ /*    
+  * 930721JG Modify control newsgroup handling to not write such big
+  * directories.
+  */
+ 
  #include <stdio.h>
  #include <sys/types.h>
  #include "configdata.h"
***************
*** 1759,1764 ****
--- 1765,1771 ----
  {
      static BUFFER	Files;
      static BUFFER	Header;
+     static char		ngpDir[SPOOLNAMEBUFF];
      static char		buff[SPOOLNAMEBUFF];
      register char	*p;
      register int	i;
***************
*** 2199,2210 ****
  	    continue;
  	ngp->PostCount = 0;
  
  	if (Data.Name[0] == '\0') {
  	    /* Write the article the first time. */
  	    (void)snprintf(Data.Name, sizeof(Data.Name),
! 			"%s/%lu", ngp->Dir, ngp->Filenum);
  	    if (ARTwrite(Data.Name, article, &Data) < 0
! 	     && (!MakeSpoolDirectory(ngp->Dir)
  	      || ARTwrite(Data.Name, article, &Data) < 0)) {
  		i = errno;
  		syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
--- 2206,2232 ----
  	    continue;
  	ngp->PostCount = 0;
  
+ /* Start of patch */
+ 
+  	if (! strcmp(ngp->Dir, "control/cancel")) {
+  		/* Use modified directory format - breaks nnrpd, etc.,
+  		   but we don't give a rip */
+  		snprintf(ngpDir, sizeof(ngpDir), "%s/%02d/%02d", ngp->Dir, (ngp->Filenum / 10000) % 100, (ngp->Filenum / 100) % 100);
+  	} else {
+  		/* Use standard directory format */
+  		snprintf(ngpDir, sizeof(ngpDir), "%s", ngp->Dir);
+  	}
+ 
+ /* End of patch */
+  
  	if (Data.Name[0] == '\0') {
  	    /* Write the article the first time. */
  	    (void)snprintf(Data.Name, sizeof(Data.Name),
! /* 			"%s/%lu", ngp->Dir, ngp->Filenum); */
! 			"%s/%lu", ngpDir, ngp->Filenum);
  	    if (ARTwrite(Data.Name, article, &Data) < 0
! /* 	     && (!MakeSpoolDirectory(ngp->Dir) */
! 	     && (!MakeSpoolDirectory(ngpDir)
  	      || ARTwrite(Data.Name, article, &Data) < 0)) {
  		i = errno;
  		syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name);
***************
*** 2230,2238 ****
  	else {
  	    /* Link to the main article. */
  	    (void)snprintf(linkname, sizeof(linkname),
! 			"%s/%lu", ngp->Dir, ngp->Filenum);
  	    if (DoLinks && link(Data.Name, linkname) < 0
! 	     && (!MakeSpoolDirectory(ngp->Dir)
  	      || link(Data.Name, linkname) < 0)) {
  #if	defined(DONT_HAVE_SYMLINK)
  		oerrno = errno;
--- 2252,2262 ----
  	else {
  	    /* Link to the main article. */
  	    (void)snprintf(linkname, sizeof(linkname),
! /* 			"%s/%lu", ngp->Dir, ngp->Filenum); */
! 			"%s/%lu", ngpDir, ngp->Filenum);
  	    if (DoLinks && link(Data.Name, linkname) < 0
! /* 	     && (!MakeSpoolDirectory(ngp->Dir) */
! 	     && (!MakeSpoolDirectory(ngpDir)
  	      || link(Data.Name, linkname) < 0)) {
  #if	defined(DONT_HAVE_SYMLINK)
  		oerrno = errno;
***************
*** 2244,2250 ****
  		/* Try to make a symbolic link to the full pathname. */
  		FileGlue(buff, SPOOL, '/', Data.Name, sizeof(buff));
  		if (symlink(buff, linkname) < 0
! 		 && (!MakeSpoolDirectory(ngp->Dir)
  		  || symlink(buff, linkname) < 0)) {
  		    oerrno = errno;
  		    syslog(L_ERROR, "%s cant symlink %s and %s %m",
--- 2268,2274 ----
  		/* Try to make a symbolic link to the full pathname. */
  		FileGlue(buff, SPOOL, '/', Data.Name, sizeof(buff));
  		if (symlink(buff, linkname) < 0
! 		 && (!MakeSpoolDirectory(ngpDir)
  		  || symlink(buff, linkname) < 0)) {
  		    oerrno = errno;
  		    syslog(L_ERROR, "%s cant symlink %s and %s %m",


------------------------------------------------------------------------
Homer Wilson Smith     News, Web, Telnet      Art Matrix - Lightlink
(607) 277-0959         E-mail, FTP, Shell     Internet Access, Ithaca NY
homer@lightlink.com    info@lightlink.com     http://www.lightlink.com


Technical Details
Message-ID: <Pine.SUN.3.95.970805150059.5706A-100000@light.lightlink.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.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <Pine.SUN.3.95.970805150059.5706A-100000@light.lightlink.com>
Subject: Cancel Patch 1.51sec2
Date: Tue, 05 Aug 1997 00:00:00 +0000
From: System Administrator <root@light.lightlink.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.mbox.zip!not-for-mail
X-Deja-AN: 262529031
Distribution: inet
Organization: Art Matrix - Lightlink Electra Gateway v2.4
Newsgroups: news.software.nntp