[news.software.nntp] Cnews and nntp 1.5.7 gotchas under SysV

tar@sirius.cis.ksu.edu (Tim Ramsey) (12/23/89)

Hi all.  Recently, I changed my news transport from B 2.11.17 / nntp 1.5.3
to C news (14-Sep-1989) / nntp 1.5.7.  My OS is sysV 2.1.2, and I've #defined
DBM, CNEWS, and BATCHED_INPUT in ./nntp/common/conf.h.  I ran into some
gotchas, most of which I managed to get around.  I'm curious if others with
similar setups have had the same problems, and if so, how they handled them.

First, ./nntp/server/spawn.c assumes that the spawnee is execl'able.  If the
spawnee is a shell script and your kernel doesn't understand the "#!" magic
number, this isn't true.  I found this when I tried to post an article and
the NNTP server attempted to spawn inews.  With B news, this works since
inews is object code.  With C news, it's a shell script.

My fix was to check if errno == ENOEXEC (exec format error).  If so, I spawn
/bin/sh with argv[1] set to the pathname of the spawnee.  I had to make this
change in batch.c since newsrun is a shell script too.

Unfortunately, this fix caused the fake inews to block for a long time
waiting for the server to respond to the POST command.  The server seemed
to be blocked waiting for input from the spawned process.  I was too frazzled
from the fight with C news to track this down, so I just ifdef'd out the code
that reads stdout from the spawned process.  As a result, posting no longer
causes the fake inews to block, but the user does not get to see any errors
returned by inews on the server.

Second, Cnews allows a "x" or "=news.group" in the active file.  I attempted
to use the "x" flag to block some unwanted groups (like alt.sex.bestiality).
When I started up rn, it asked me if I wanted to add the new group
"alt.sex.bestiality" to my .newsrc.  This is not what I had intended.

I haven't gotten around to fixing this yet.  When I do, I'll probably have
to hunt around the server code for things that deal with the active file
and make them ignore lines that have the "x" or "=" flags (if CNEWS is
#defined).

Has anyone else run into these problems?  Are there patches that I've
missed that deal with them?  Any wisdom?

Thanks,

Tim

--
"Desperately trying..." -- Edie    Dept. of Computing and Information Sciences
BITNET:   tar@KSUVAX1              Kansas State University, Manhattan KS 66506
Internet: tar@ksuvax1.cis.ksu.edu             Voice: (913) 532-6350
UUCP:  ...!{rutgers,texbell}!ksuvax1!tar        Fax: (913) 532-7114

tale@cs.rpi.edu (David C Lawrence) (12/28/89)

<1989Dec23.035953.21905@deimos.cis.ksu.edu> tar@sirius.cis.ksu.edu (Tim Ramsey)
> Second, Cnews allows a "x" or "=news.group" in the active file.  I attempted
> to use the "x" flag to block some unwanted groups (like alt.sex.bestiality).
> When I started up rn, it asked me if I wanted to add the new group
> "alt.sex.bestiality" to my .newsrc.  This is not what I had intended.

Nor I, and I really disliked it because users would be wondering how
come rn let them know about these groups but they couldn't post to
them and no articles ever appeared.  So I worked up a patch for rn last
week and sent it to Stan.  It is appended; it is unofficial but
hopefully it or something much like it will be appearing in the next
set of patches.

It basically attacks the problem at two places; one is in adding
groups.  This is so it won't ask to add groups such as you've
indicated.  The other thing it does is anytime it comes across an x or
= group and attempts to summarize it (ie, at the newsgroup selection
level) then it will declare the group as bogus.  This is for such
times as when alt.sex.carasso.snuggles [1] gets automatically
newgroup'ed but I don't get around to delgroup/addgroup x until a
couple of hours later.[2]  In addition, 'n' groups are recognized in
the article header line as "no local posting", though no attempt is
made by rn to prevent it if F/f is pressed.  The other problem is that
if you ask to subscribe to an x/= group rn will cheerfully go through
the motions to do so ("Not in .newsrc, add?") but immediately declare
it as bogus and go about asking whether to remove it again. :-)  I
didn't cover either of these situations yet; perhaps I will hack on it
later this week.

[1] FoO!  Now that this in Spaf's list of alternate hierarchies it
seems to be blessed into existence at many sites.  Sigh.  (I don't
really care much though; we all make these choices.  Just seems that
things like that are what perpetuate the bad-mouthing of alt.)

[2] Unfortunately unlike the newgroup control command, which can
change the moderated flag of a group, addgroup as distributed will not
twiddle the flag of a group.  Something else to hack on later, I suppose.

Dave

The patch, unofficial [and I clearly faked revision control headers]:

*** ngdata.c.dist	Mon Dec 18 01:44:23 1989
--- ngdata.c	Wed Dec 20 02:20:19 1989
***************
*** 1,6 ****
! /* $Header: ngdata.c,v 4.3.2.6 89/12/08 22:42:04 sob Exp $
   *
   * $Log:	ngdata.c,v $
   * Revision 4.3.2.6  89/12/08  22:42:04  sob
   * Corrected typo in an #ifdef statement pointed out by
   * jik@pit-manager.mit.edu
--- 1,9 ----
! /* $Header: ngdata.c,v 4.3.2.7 89/12/20 00:45:00 tale Exp $
   *
   * $Log:	ngdata.c,v $
+  * Revision 4.3.2.7  89/12/20  00:45:00  tale
+  * Added support for C News active file flags.
+  *
   * Revision 4.3.2.6  89/12/08  22:42:04  sob
   * Corrected typo in an #ifdef statement pointed out by
   * jik@pit-manager.mit.edu
***************
*** 150,158 ****
  	if (!in_ng) {
  	    for (s++; isdigit(*s); s++) ;
  	    while (isspace(*s)) s++;
! 	    moderated = (!*s || *s == 'y'
! 		? nullstr
! 		: getval("MODSTRING"," (moderated)") );
  	}
      }
  #endif
--- 153,170 ----
  	if (!in_ng) {
  	    for (s++; isdigit(*s); s++) ;
  	    while (isspace(*s)) s++;
! 	    switch (*s) {
! 	    case 'n': moderated = getval("NOPOSTRING"," (no posting)"); break;
! 	    case 'm': moderated = getval("MODSTRING", " (moderated)"); break;
! 	    /* This shouldn't even occur.  What are we doing in a non-existent
! 	       group?  Disallow it. */
! 	    case 'x': return TR_BOGUS;
! 	    /* what should be done about refiled groups?  rn shouldn't even
! 	       be in them (ie, if sci.aquaria is refiled to rec.aquaria, then
! 	       get the news there) */
! 	    case '=': return TR_BOGUS;
! 	    default: moderated = nullstr;
! 	    }
  	}
      }
  #endif
*** addng.c.dist	Mon Dec 18 01:44:20 1989
--- addng.c	Wed Dec 20 02:21:32 1989
***************
*** 1,6 ****
! /* $Header: addng.c,v 4.3.2.3 89/11/08 02:33:28 sob Locked $
   *
   * $Log:	addng.c,v $
   * Revision 4.3.2.3  89/11/08  02:33:28  sob
   * Added include for server.h
   * 
--- 1,9 ----
! /* $Header: addng.c,v 4.3.2.4 89/12/20 00:30:00 tale Locked $
   *
   * $Log:	addng.c,v $
+  * Revision 4.3.2.4  89/12/20  00:30:00  tale
+  * Added support for C News active file flags.
+  *
   * Revision 4.3.2.3  89/11/08  02:33:28  sob
   * Added include for server.h
   * 
***************
*** 51,57 ****
  bool checkinlist;
  {
      char *tmpname;
!     register char *s;
      long birthof();
  
      tmpname = savestr(filexp("/tmp/rnew.%$"));
--- 54,60 ----
  bool checkinlist;
  {
      char *tmpname;
!     register char *s, *status;
      long birthof();
  
      tmpname = savestr(filexp("/tmp/rnew.%$"));
***************
*** 62,69 ****
      }
      while (fgets(buf,LBUFLEN,actfp) != Nullch) {
  	if (s = index(buf,' ')) {
  	    *s++ = '\0';
! 	    if (strnEQ(buf,"to.",3))
  		continue;
  	    if (find_ng(buf) == nextrcline &&
  		    (checkinlist ?
--- 65,76 ----
      }
      while (fgets(buf,LBUFLEN,actfp) != Nullch) {
  	if (s = index(buf,' ')) {
+ 	    status=s;
+ 	    while (isdigit(*status) || isspace(*status)) status++;
  	    *s++ = '\0';
! 	    if (strnEQ(buf,"to.",3) || *status == 'x' || *status == '=')
! 	        /* since = groups are refiling to another group, just
! 		   ignore their existence */
  		continue;
  	    if (find_ng(buf) == nextrcline &&
  		    (checkinlist ?
*** rn.1.dist	Mon Dec 18 01:43:56 1989
--- rn.1	Wed Dec 20 02:16:23 1989
***************
*** 1,6 ****
! ''' $Header: rn.1,v 4.3.1.7 89/11/28 00:28:10 sob Locked $
  ''' 
  ''' $Log:	rn.1,v $
  ''' Revision 4.3.1.7  89/11/28  00:28:10  sob
  ''' Changed some usages of "say" and "saying" to "type" and "typing"
  ''' 
--- 1,9 ----
! ''' $Header: rn.1,v 4.3.1.8 89/12/20 01:58:10 tale Locked $
  ''' 
  ''' $Log:	rn.1,v $
+ ''' Revision 4.3.1.8  89/12/20  01:58:10 tale
+ ''' Added documentation for MODSTRING and new NOPOSTRING
+ '''
  ''' Revision 4.3.1.7  89/11/28  00:28:10  sob
  ''' Changed some usages of "say" and "saying" to "type" and "typing"
  ''' 
***************
*** 1411,1416 ****
--- 1414,1424 ----
  derived either directly from the Posted: line, or not-so-directly from
  the Date: line.
  Header munging at its finest.
+ .Ip MODSTRING 8
+ The string to insert in the group summary line, which heads each article,
+ for a moderated group.  See also NOPOSTRING.
+ .Sp
+ Default: " (moderated)"
  .Ip NAME 8
  Your full name.
  May be interpolated using \*(L"%N\*(R".
***************
*** 1453,1458 ****
--- 1461,1471 ----
  See also NEWSHEADER.
  .Sp
  Default: Pnews \-h %h
+ .Ip NOPOSTRING 8
+ The string to insert in the group summary line, which heads each article,
+ for a group to which local posting is not allowed.  See also MODSTRING.
+ .Sp
+ Default: " (no posting)"
  .Ip "NORMSAVER (~)" 8
  The shell command to save an article in the normal (non-mailbox) format.
  .Sp
--end-of-patch--
-- 
   (setq mail '("tale@cs.rpi.edu" "tale@ai.mit.edu" "tale@rpitsmts.bitnet"))