INN commit: trunk (7 files)

INN Commit Russ_Allbery at isc.org
Sun Dec 21 10:29:55 UTC 2008


    Date: Sunday, December 21, 2008 @ 02:29:55
  Author: iulius
Revision: 8242

Remove the crosspost backend program (broken since INN 2.3.0,
and not much useful nowadays).
Update documentation and innreport.

close #96

Modified:
  trunk/MANIFEST
  trunk/doc/man/innreport.8
  trunk/doc/pod/install.pod
  trunk/samples/innreport.conf.in
  trunk/scripts/innreport_inn.pm
  trunk/storage/tradspool/README.tradspool
Deleted:
  trunk/backends/crosspost.c

------------------------------------+
 MANIFEST                           |    1 
 backends/crosspost.c               |  338 -----------------------------------
 doc/man/innreport.8                |    3 
 doc/pod/install.pod                |    4 
 samples/innreport.conf.in          |   24 --
 scripts/innreport_inn.pm           |   38 ---
 storage/tradspool/README.tradspool |    6 
 7 files changed, 3 insertions(+), 411 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2008-12-17 18:26:44 UTC (rev 8241)
+++ MANIFEST	2008-12-21 10:29:55 UTC (rev 8242)
@@ -50,7 +50,6 @@
 backends/archive.c                    Simple article archiver
 backends/batcher.c                    Make news batches
 backends/buffchan.c                   Buffered funnel to file splitter
-backends/crosspost.c                  Create links for crossposts (obsolete)
 backends/cvtbatch.c                   Add fields to simple batchfile
 backends/filechan.c                   Split a funnel into separate files
 backends/innbind.c                    Bind to low-numbered network ports

Deleted: backends/crosspost.c
===================================================================
--- backends/crosspost.c	2008-12-17 18:26:44 UTC (rev 8241)
+++ backends/crosspost.c	2008-12-21 10:29:55 UTC (rev 8242)
@@ -1,338 +0,0 @@
-/*  $Id$
-**
-**  Parse input to add links for cross posted articles.  Input format is one
-**  line per article.  Dots '.' are changed to '/'.  Commas ',' or blanks
-**  ' ' separate entries.  Typically this is via a channel feed from innd
-**  though an edit of the history file can also be used for recovery
-**  purposes.  Sample newsfeeds entry:
-**
-**	# Create the links for cross posted articles
-**	crosspost:*:Tc,Ap,WR:/usr/local/newsbin/crosspost
-**
-**  WARNING: This no longer works with the current INN; don't use it
-**  currently.  It still exists in the source tree in case someone will
-**  want to clean it up and make it useable again.
-*/
-
-#include "config.h"
-#include "clibrary.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <sys/stat.h>
-
-#include "inn/qio.h"
-#include "inn/libinn.h"
-#include "inn/paths.h"
-
-
-static char	*Dir;
-
-static int	debug = false;
-static int	syncfiles = true;
-
-static unsigned long STATTime    = 0;
-static unsigned long STATMissing = 0; /* Source file missing */
-static unsigned long STATTooLong = 0; /* Name Too Long (src or dest) */
-static unsigned long STATLink    = 0; /* Link done */
-static unsigned long STATLError  = 0; /* Link problem */
-static unsigned long STATSymlink = 0; /* Symlink done */
-static unsigned long STATSLError = 0; /* Symlink problem */
-static unsigned long STATMkdir   = 0; /* Mkdir done */
-static unsigned long STATMdError = 0; /* Mkdir problem */
-static unsigned long STATOError  = 0; /* Other errors */
-
-#define MAXXPOST 256
-#define STATREFRESH 10800   /* 3 hours */
-
-/*
-**  Write some statistics and reset all counters.
-*/
-void
-ProcessStats()
-{
-  time_t Time;
-
-  Time = time (NULL);
-  syslog(LOG_NOTICE,
-	"seconds %lu links %lu %lu symlinks %lu %lu mkdirs %lu %lu missing %lu toolong %lu other %lu",
-	Time - STATTime, STATLink, STATLError, STATSymlink, STATSLError,
-	STATMkdir, STATMdError, STATMissing, STATTooLong, STATOError);
-
-  STATMissing = STATTooLong = STATLink = STATLError = 0;
-  STATSymlink = STATSLError = STATMkdir = STATMdError = STATOError = 0;
-  STATTime = Time;
-}
-
-/*
-**  Try to make one directory.  Return false on error.
-*/
-static bool
-MakeDir(Name)
-    char		*Name;
-{
-    struct stat		Sb;
-
-    if (mkdir(Name, GROUPDIR_MODE) >= 0) {
-        STATMkdir++;
-	return true;
-    }
-
-    /* See if it failed because it already exists. */
-    return stat(Name, &Sb) >= 0 && S_ISDIR(Sb.st_mode);
-}
-
-
-/*
-**  Make spool directory.  Return false on error.
-*/
-static bool
-MakeSpoolDir(Name)
-    char	*Name;
-{
-    char	*p;
-    bool		made;
-
-    /* Optimize common case -- parent almost always exists. */
-    if (MakeDir(Name))
-	return true;
-
-    /* Try to make each of comp and comp/foo in turn. */
-    for (p = Name; *p; p++)
-	if (*p == '/') {
-	    *p = '\0';
-	    made = MakeDir(Name);
-	    *p = '/';
-	    if (!made) {
-	        STATMdError++;
-	        return false;
-	    }
-	}
-
-    return MakeDir(Name);
-}
-
-
-/*
-**  Process the input.  Data can come from innd:
-**	news/group/name/<number> [space news/group/<number>]...
-**  or
-**	news.group.name/<number>,[news.group.name/<number>]...
-*/
-static void
-ProcessIncoming(qp)
-    QIOSTATE		*qp;
-{
-    char	*p;
-    int	i;
-    int			nxp;
-    int			fd;
-    int			lnval ;
-    char	*names[MAXXPOST];
-
-
-    for ( ; ; ) {
-
-        if (time(NULL) - STATTime > STATREFRESH)
-	  ProcessStats();
-
-	/* Read the first line of data. */
-	if ((p = QIOread(qp)) == NULL) {
-	    if (QIOtoolong(qp)) {
-		fprintf(stderr, "crosspost line too long\n");
-		STATTooLong++;
-		continue;
-	    }
-	    break;
-	}
-
-	for (i = 0; *p && (i < MAXXPOST); i++) { /* parse input into array */
-	    names[i] = p;
-	    for ( ; *p; p++) {
-		if (*p == '.') *p++ = '/'; /* dot to slash translation */
-		else if ((*p == ',')	   /* name separators */
-		  ||     (*p == ' ')
-		  ||     (*p == '\t')
-		  ||     (*p == '\n')) {
-		    *p++ = '\0';
-		    break;
-		}
-	    }
-	}
-	nxp = i;
-	if (debug) {
-	    for (i = 0; i < nxp; i++)
-		fprintf(stderr, "crosspost: debug %d %s\n",
-		    i, names[i]);
-	}
-
-	if(syncfiles) fd = open(names[0], O_RDWR);
-
-	for (i = 1; i < nxp; i++) {
-            lnval = link(names[0], names[i]) ;
-	    if (lnval == 0) STATLink++;
-	    if (lnval < 0 && errno != EXDEV) { /* first try to link */
-		int j;
-		char path[SPOOLNAMEBUFF+2];
-
-		for (j = 0; (path[j] = names[i][j]) != '\0' ; j++) ;
-		for (j--; (j > 0) && (path[j] != '/'); j--) ;
-		if (path[j] == '/') {
-		    path[j] = '\0';
-		    /* try making parent dir */
-		    if (MakeSpoolDir(path) == false) {
-			fprintf(stderr, "crosspost cant mkdir %s\n",
-				path);
-		    }
-		    else {
-			/* 2nd try to link */
-			lnval = link(names[0], names[i]) ;
-			if (lnval == 0) STATLink++;
-			if (lnval < 0 && errno == EXDEV) {
-#if !defined(HAVE_SYMLINK)
-			    fprintf(stderr, "crosspost cant link %s %s",
-				names[0], names[i]);
-			    perror(" ");
-#else
-			    /* Try to make a symbolic link
-			    ** to the full pathname.
-			    */
-			    for (j = 0, p = Dir; (j < SPOOLNAMEBUFF) && *p; )
-				path[j++] = *p++; /* copy spool dir */
-			    if (j < SPOOLNAMEBUFF) path[j++] = '/';
-			    for (p = names[0]; (j < SPOOLNAMEBUFF) && *p; )
-				path[j++] = *p++;	/* append path */
-			    path[j++] = '\0';
-			    if (symlink(path, names[i]) < 0) {
-				fprintf(stderr,
-				    "crosspost cant symlink %s %s",
-				    path, names[i]);
-				perror(" ");
-				STATSLError++;
-			    }
-			    else
-			      STATSymlink++;
-#endif	/* !defined(HAVE_SYMLINK) */
-			} else if (lnval < 0) {
-			    if (lnval == ENOENT)
-			      STATMissing++;
-			    else {
-			      fprintf(stderr, "crosspost cant link %s %s",
-					    names[0], names[i]);
-			      perror(" ");
-			      STATLError++;
-			    }
-                        }
-		    }
-		} else {
-		    fprintf(stderr, "crosspost bad path %s\n",
-			    names[i]);
-		    STATOError++;
-		}
-	    } else if (lnval < 0) {
-		int j;
-		char path[SPOOLNAMEBUFF+2];
-
-#if !defined(HAVE_SYMLINK)
-                fprintf(stderr, "crosspost cant link %s %s",
-                              names[0], names[i]);
-                perror(" ");
-#else
-                /* Try to make a symbolic link
-                ** to the full pathname.
-                */
-                for (j = 0, p = Dir; (j < SPOOLNAMEBUFF) && *p; )
-                    path[j++] = *p++; /* copy spool dir */
-                if (j < SPOOLNAMEBUFF) path[j++] = '/';
-                for (p = names[0]; (j < SPOOLNAMEBUFF) && *p; )
-                    path[j++] = *p++;	/* append path */
-                path[j++] = '\0';
-                if (symlink(path, names[i]) < 0) {
-                    fprintf(stderr,
-                                  "crosspost cant symlink %s %s",
-                                  path, names[i]);
-                    perror(" ");
-		    STATSLError++;
-                }
-		else
-		  STATSymlink++;
-#endif	/* !defined(HAVE_SYMLINK) */
-            }
-	}
-
-	if (syncfiles && (fd >= 0)) {
-	    fsync(fd);
-	    close(fd);
-	}
-    }
-
-    if (QIOerror(qp))
-	fprintf(stderr, "crosspost cant read %s\n", strerror(errno));
-    QIOclose(qp);
-}
-
-
-static void
-Usage(void)
-{
-    fprintf(stderr, "usage:  crosspost [-D dir] [files...]\n");
-    exit(1);
-}
-
-
-int
-main(ac, av)
-    int			ac;
-    char		*av[];
-{
-    int	i;
-    QIOSTATE		*qp;
-
-    /* Set defaults. */
-    if (ReadInnConf() < 0) exit(1);
-    Dir = innconf->patharticles;
-    umask(NEWSUMASK);
-
-    /* Parse JCL. */
-    while ((i = getopt(ac, av, "D:ds")) != EOF)
-	switch (i) {
-	default:
-	    Usage();
-	    /* NOTREACHED */
-	case 'D':
-	    Dir = optarg;	/* specify spool path */
-	    break;
-	case 'd':
-	    debug = true;
-	    break;
-	case 's':
-	    syncfiles = false;	/* do not fsync articles */
-	    break;
-	}
-    ac -= optind;
-    av += optind;
-
-    if (chdir(Dir) < 0) {
-	fprintf(stderr, "crosspost cant chdir %s %s\n",
-		Dir, strerror(errno));
-	exit(1);
-    }
-    openlog("crosspost", L_OPENLOG_FLAGS | LOG_PID, LOG_INN_PROG);
-    STATTime = time (NULL);
-    if (ac == 0)
-	ProcessIncoming(QIOfdopen(STDIN_FILENO));
-    else {
-	for ( ; *av; av++)
-	    if (strcmp(*av, "-") == 0)
-		ProcessIncoming(QIOfdopen(STDIN_FILENO));
-	    else if ((qp = QIOopen(*av)) == NULL)
-		fprintf(stderr, "crosspost cant open %s %s\n",
-			*av, strerror(errno));
-	    else
-		ProcessIncoming(qp);
-    }
-
-    ProcessStats();
-    exit(0);
-    /* NOTREACHED */
-}

Modified: doc/man/innreport.8
===================================================================
--- doc/man/innreport.8	2008-12-17 18:26:44 UTC (rev 8241)
+++ doc/man/innreport.8	2008-12-21 10:29:55 UTC (rev 8242)
@@ -16,8 +16,7 @@
 .I nntplink, 
 .IR nnrpd (8), 
 .IR batcher (8), 
-.IR rnews (1), 
-.IR crosspost (8)
+.IR rnews (1) 
 and a few others.
 .SH OPTIONS
 There are lots of 'em. Run innreport with ``\-h'' or ``\-help'' to get full

Modified: doc/pod/install.pod
===================================================================
--- doc/pod/install.pod	2008-12-17 18:26:44 UTC (rev 8241)
+++ doc/pod/install.pod	2008-12-21 10:29:55 UTC (rev 8242)
@@ -955,8 +955,8 @@
 
 For those of you upgrading from earlier versions of INN, note that the
 functionality of overchan(8) and B<crosspost> is now incorporated into INN
-and neither of those programs is necessary.  Unfortunately, B<crosspost>
-currently will not work even with the tradspool storage method.  You can
+and neither of those programs is necessary.  Although B<crosspost> is no
+longer shipped with INN (and will not be working if used), you can
 still use B<overchan> if you make sure to set I<useoverchan> to true in
 F<inn.conf> so that B<innd> doesn't write overview data itself, but be
 careful:  B<innd> may accept articles faster than B<overchan> can process the

Modified: samples/innreport.conf.in
===================================================================
--- samples/innreport.conf.in	2008-12-17 18:26:44 UTC (rev 8241)
+++ samples/innreport.conf.in	2008-12-21 10:29:55 UTC (rev 8242)
@@ -1963,30 +1963,6 @@
         };
 };
 
-section crosspost {
-        title   "Crosspost stats:";
-	data    "%crosspost";
-        column {
-                name          "Events";
-                format        "%-63.63s";
-		value         "$key";
-		format_total  "TOTAL: %-56.56s";
-		total         "$num";
-        };
-        column {
-                name          "Number";
-		value         "$crosspost{$key}";
-		format        "%7s";
-		total         "total(%crosspost)";
-        };
-        column {
-                name          "Num/min";
-		value         "$crosspost_times{$key}";
-		format        "%7s";
-		total         "total(%crosspost_times)";
-        };
-};
-
 section batcher_elapsed {
         title   "UUCP batches created:";
 	data    "%batcher_elapsed";

Modified: scripts/innreport_inn.pm
===================================================================
--- scripts/innreport_inn.pm	2008-12-17 18:26:44 UTC (rev 8241)
+++ scripts/innreport_inn.pm	2008-12-21 10:29:55 UTC (rev 8242)
@@ -91,9 +91,6 @@
 our %controlchan_sendme_site;
 our %controlchan_skippgp;
 our %controlchan_who;
-our %crosspost;
-our $crosspost_time;
-our %crosspost_times;
 our %inn_badart;
 our %innd_accepted;
 our %innd_accepted_sum;
@@ -2038,33 +2035,6 @@
   }
 
   ###########
-  ## crosspost
-  if ($prog eq "crosspost") {
-    # seconds 1001 links 3182 0 symlinks 0 0 mkdirs 0 0
-    # missing 13 toolong 0 other 0
-    if ($left =~ /^seconds\ (\d+)
-	           \ links\ (\d+)\ (\d+)
-	           \ symlinks\ (\d+)\ (\d+)
-	           \ mkdirs\ (\d+)\ (\d+)
-	           \ missing\ (\d+)
-	           \ toolong\ (\d+)
-	           \ other\ (\d+)
-	         $/ox) {
-      $crosspost_time += $1;
-      $crosspost{'Links made'} += $2;
-      $crosspost{'Links failed'} += $3;
-      $crosspost{'Symlinks made'} += $4;
-      $crosspost{'Symlinks failed'} += $5;
-      $crosspost{'Mkdirs made'} += $6;
-      $crosspost{'Mkdirs failed'} += $7;
-      $crosspost{'Files missing'} += $8;
-      $crosspost{'Paths too long'} += $9;
-      $crosspost{'Others'} += $10;
-      return 1;
-    }
-  }
-
-  ###########
   ## cnfsstat
   if ($prog eq "cnfsstat") {
     # Class ALT for groups matching "alt.*" article size min/max: 0/1048576
@@ -2274,14 +2244,6 @@
       undef %nnrpd_time_num;
       undef %nnrpd_time_time;
     }
-
-    # adjust the crosspost stats.
-    if (%crosspost) {
-      foreach $key (keys (%crosspost)) {
-	$crosspost_times{$key} = $crosspost_time ?
-	  sprintf "%.2f", $crosspost{$key} / $crosspost_time * 60 : "?";
-      }
-    }
   }
 
   if (%inn_flow) {

Modified: storage/tradspool/README.tradspool
===================================================================
--- storage/tradspool/README.tradspool	2008-12-17 18:26:44 UTC (rev 8241)
+++ storage/tradspool/README.tradspool	2008-12-21 10:29:55 UTC (rev 8242)
@@ -35,9 +35,3 @@
 to find out what other newsgroups the article is posted to.  Eurggh. 
 Suggestions for a better scheme are welcome. 
 
-Other problems of note: the storage manager code has no way to get to the 
-'DoLinks' (-L) flag setting of innd, so currently you can't use the
-"crosspost" program with tradspool.  I guess the proper thing to do would be
-to make DoLinks a config option in storage.conf instead, but I haven't
-done that yet. 
-




More information about the inn-committers mailing list