[net.sources.bugs] Why are distributions mandatory in 2.10.2?

kre@munnari.OZ (Robert Elz) (12/14/84)

> I just got bitten by the distribution feature.
> 
> For various historical reasons, our sys line at our feed site (ukc)
> specified a number of net.* groups explicitly (with the intention of
> reducing the phone bill!).  
> 
> Consider now what happens to an incoming article to ukc destined for
> one of the groups to which we subscribe.  If it doesn't have a Distribution
> line, all is well.  If it does have a Distribution line of 'net',
> for example, 2.10.1 inews uses this in preference to the newsgroup
> name, and WE DON'T GET THE ARTICLE because there's no 'net' entry
> in our sys line.
> 
> I've had our sys line changed so that we get all net groups now, but
> it's a bit of a heavy hammer to solve the problem.  Any suggestions??
> 
> -- 
> Adrian Pell		({mcvax,edcaad}!ukc!ru-cs44!adrian)
> Computer Science Dept.
> University of Reading
> UK

It too me a while, but I have just realized that Australia has
been suffering from this problem too.  Decvax sends us news,
but only a few groups.  In this case, changing our subscription
so that we get everything is not a viable alternative.

So, here are two patches, one for 2.10.2 to omit distribution
lines when they say nothing new to a 2.10.2 system (that is,
when 2.10.2 would ALWAYS ignore the distribution anyway),
and one for 2.10.1 to make it handle disributions rationally,
as 2.10.2 does.

Please - if you are running 2.10.2 do install this fix, its
very simple, and will not harm anything at all.

If you are running 2.10.1, please install the 2nd fix, but
here you might want to exercise a little caution.  I am no
longer running 2.10.1 so I cannot absolutely promise that
it will work, however I am reasonably sure that it will.

Note: Don't use Larry Wall's patch utility on this article,
it will probably destroy your news system, as only one of
the following patches should be applied.  There's no way
that "patch" can possibly know that!

First, the 2.10.2 patch.  This is to "postnews.c".  The
line numbers won't necessarily correspond, so I've made
this an 8 line context diff.

------------------------------------------------------------- 2.10.2 B news fix
*** postnews.c.was	Thu Sep 20 01:30:48 1984
--- postnews.c	Thu Dec 13 20:41:27 1984
***************
*** 188,203
  				printf("%s\t%s\n", distr[i].abbr, distr[i].descr);
  			continue;
  		}
  
  		/* Check that it's a proper distribution */
  		for (i=0; distr[i].abbr[0]; i++) {
  			if (strncmp(distr[i].abbr, distribution, sizeof(distr[0].abbr)) == 0) {
  				/* Found a match. Do any special rewriting. */
  				if (strcmp(distribution, "world") == 0)
  					strcpy(distribution, "net");
  				return;
  			}
  		}
  
  		printf("Type ? for help.\n");
  	}

--- 188,205 -----
  				printf("%s\t%s\n", distr[i].abbr, distr[i].descr);
  			continue;
  		}
  
  		/* Check that it's a proper distribution */
  		for (i=0; distr[i].abbr[0]; i++) {
  			if (strncmp(distr[i].abbr, distribution, sizeof(distr[0].abbr)) == 0) {
  				/* Found a match. Do any special rewriting. */
+ 				if (strcmp(distribution, def) == 0)
+ 					strcpy(distribution, "");
  				if (strcmp(distribution, "world") == 0)
  					strcpy(distribution, "net");
  				return;
  			}
  		}
  
  		printf("Type ? for help.\n");
  	}
------------------------------------------------------------ end 2.10.2 B fix


Next, here is the fix for 2.10.1, this time to ifuncs.c.  Again the
line numbers are not likely to match, so again I have used 8 line
context diffs ...

Something similar to this would probably also help earlier versions
of B news.  I have no idea about A news (is there really anyone still
running that???)

------------------------------------------------------------ 2.10.1 B news fix
*** ifuncs.c.was	Wed Aug 24 09:14:28 1983
--- ifuncs.c	Thu Dec 13 21:11:38 1984
***************
*** 24,41
  	struct hbuf h;
  #endif
  
  	/* h is a local copy of the header we can scribble on */
  	fp = xfopen(ARTICLE, "r");
  	if (hread(&h, fp, TRUE) == NULL)
  		xerror("Cannot reread article");
  	fclose(fp);
! 	if (h.distribution[0])
! 		strcpy(h.nbuf, h.distribution);
  	ngcat(h.nbuf);
  
  	 /* break path into list of systems. */
  	hptr = nptr = h.path;
  	while (*hptr != '\0') {
  		if (index(NETCHRS, *hptr)) {
  			*hptr++ = '\0';
  			nptr = hptr;

--- 24,41 -----
  	struct hbuf h;
  #endif
  
  	/* h is a local copy of the header we can scribble on */
  	fp = xfopen(ARTICLE, "r");
  	if (hread(&h, fp, TRUE) == NULL)
  		xerror("Cannot reread article");
  	fclose(fp);
! 	if (h.distribution)
! 		ngcat(h.distribution);
  	ngcat(h.nbuf);
  
  	 /* break path into list of systems. */
  	hptr = nptr = h.path;
  	while (*hptr != '\0') {
  		if (index(NETCHRS, *hptr)) {
  			*hptr++ = '\0';
  			nptr = hptr;
***************
*** 52,68
  			continue;
  		hptr = h.path;
  		while (*hptr != '\0') {
  			if (strncmp(srec.s_name, hptr, SNLN) == 0)
  				goto contin;
  			while (*hptr++ != '\0')
  				;
  		}
! 		if (ngmatch(h.nbuf, srec.s_nbuf)) {
  			transmit(&srec, xfopen(ARTICLE, "r"), 1);
  		}
  	contin:;
  	}
  	s_close();
  	unlock();
  }
  

--- 52,71 -----
  			continue;
  		hptr = h.path;
  		while (*hptr != '\0') {
  			if (strncmp(srec.s_name, hptr, SNLN) == 0)
  				goto contin;
  			while (*hptr++ != '\0')
  				;
  		}
! 		if (ngmatch(h.nbuf, srec.s_nbuf) &&
! 		    (h.distribution[0] == '\0' ||
! 		    ngmatch(h.distribution, srec.s_nbuf) ||
! 		    ngmatch(h.nbuf, h.distribution))) {
  			transmit(&srec, xfopen(ARTICLE, "r"), 1);
  		}
  	contin:;
  	}
  	s_close();
  	unlock();
  }
  
--------------------------------------------------------------- end 2.10.1 B fix


Again, please, do insert whichever of these fixes is appropriate for
your site.  For 2.10.2 sites, omitting the fix means that articles
your users post may not get seen by some parts of the net.
For 2.10.1 sites, you may be (unwittingly) failing to forward articles that
other sites have posted, and which should be forwarded.

Robert Elz					decvax!mulga!kre