david@ukma.UUCP (David Herron, NPR Lover) (01/20/86)
Version: news 2.10.3, alpha 4/3/85 [Yes, some of these may already be fixed in the beta test version and later -- however, just in case....] Problem: Running checkgroups message that spaf posts results in mail telling me to delete all the newsgroups. Obviously incorrect. Diagnosis: First notice that in the log file, when it's handling the ctl message, there is a '\n' in the string passed to system(). (Hint, $LIBDIR/notify contains a '\n') This causes there to be no input for checkgroups.sh. Second, capture the input to checkgroups.sh to see what it's being given and find that the sed at the beginning of checkgroups actually deletes ALL of the input. Fixes: *** pathinit.c.orig Fri May 3 14:20:59 1985 --- pathinit.c Sun Jan 19 15:15:41 1986 *************** *** 166,171 (void) sprintf(bfr, "%s/notify", LIB); nfd = fopen(bfr, "r"); if (nfd != NULL) { bfr[0] = '\0'; (void) fgets(bfr, BUFLEN, nfd); TELLME = AllocCpy(bfr); --- 166,172 ----- (void) sprintf(bfr, "%s/notify", LIB); nfd = fopen(bfr, "r"); if (nfd != NULL) { + char *p; bfr[0] = '\0'; (void) fgets(bfr, BUFLEN, nfd); /* *************** *** 168,173 if (nfd != NULL) { bfr[0] = '\0'; (void) fgets(bfr, BUFLEN, nfd); TELLME = AllocCpy(bfr); (void) fclose(nfd); } else --- 169,184 ----- char *p; bfr[0] = '\0'; (void) fgets(bfr, BUFLEN, nfd); + /* + * CHANGE [19-Jan-86, ukma!david] -- + * "...fgets() keeps the '\n' all for the sake + * of compatibility...." + * -- fgets(3) + * + * This caused a problem for the checkgroups control msg + */ + if ((p=index(bfr, '\n')) != (char *)0) + *p = '\0'; TELLME = AllocCpy(bfr); (void) fclose(nfd); } else *** checkgroups.sh.orig Sun Nov 24 18:40:02 1985 --- checkgroups.sh Sun Jan 19 15:50:49 1986 *************** *** 4,10 # Read first line of stdin. If of the form "-n group", then only check # for the specified group. Otherwise, assume doing net and fa. ! sed -e '1,/^$/d' -e '/^[#:]/d' | ( read line case "${line}" in -n*) --- 4,13 ----- # Read first line of stdin. If of the form "-n group", then only check # for the specified group. Otherwise, assume doing net and fa. ! # ! # CHANGE [29-Jan-1985, ukma!david] -- The sed deletes the whole ! # file as it comes into this script out of inews. ! # sed -e '1,/^$/d' -e '/^[#:]/d' | ( read line case "${line}" in -n*) *************** *** 71,76 cat fi fi ! ) rm -f /tmp/$$* --- 74,79 ----- cat fi fi ! # ) rm -f /tmp/$$* Problem: This patch applies the Ln patch correctly for 2.10.3. In broadcast() there is piece of code which munges the Path: header so that all NETCHARS are '\0', this allows one to use strcmp() to see if the site to broadcast() to is not in the Path:. The code as I recieved it only munged the first NETCHAR. (There's still a problem here because, if an upstream site does HOST.DOMAIN in the Path: the '.' gets munged, but I'm not going to worry about it right now). There *is* a problem with MULTICAST here. If you define MULTICAST, then for F feeds, all that's written to the batch file is blank lines. (I didn't catch this one, a dounstream neighbor did....) Anyway, in transmit() I've marked a place where obviously an appropriate printf() needs to be inserted. But I need to check some specifics before I'll do it. The last thing is an heuristic for handling a strange batching format I'm getting from one feed. (This one's via BITNET folks, from an IBM machine even!) Fixes: *** ifuncs.c.orig Sun Nov 24 18:02:46 1985 --- ifuncs.c Sun Jan 19 12:56:16 1986 *************** *** 55,60 nsent = 0; /* break path into list of systems. */ hptr = h.path; while ((hptr=strpbrk(hptr, NETCHRS)) != NULL) *hptr = '\0'; --- 55,66 ----- nsent = 0; /* break path into list of systems. */ hptr = h.path; + /* + * CHANGE -- in the loop, hptr had NOT been incremented in + * the past. The effect being that the SECOND time strpbrk + * was called, it was pointing at the null. But that + * isn't what is wanted. + */ while ((hptr=strpbrk(hptr, NETCHRS)) != NULL) *hptr++ = '\0'; *************** *** 56,62 /* break path into list of systems. */ hptr = h.path; while ((hptr=strpbrk(hptr, NETCHRS)) != NULL) ! *hptr = '\0'; /* loop once per system. */ s_openr(); --- 62,68 ----- * isn't what is wanted. */ while ((hptr=strpbrk(hptr, NETCHRS)) != NULL) ! *hptr++ = '\0'; /* loop once per system. */ s_openr(); *************** *** 152,158 /* F: append name to file */ int appfile = (index(sp->s_flags, 'F') != NULL); /* L: local: don't send the article unless it was generated locally */ ! int local = (index(sp->s_flags, 'L') != NULL); /* M: multi-cast: this is taken care of above, but don't reuse flag */ #ifdef MULTICAST /* O: multi-cast only, don't send article if not multicast hosts */ --- 158,164 ----- /* F: append name to file */ int appfile = (index(sp->s_flags, 'F') != NULL); /* L: local: don't send the article unless it was generated locally */ ! int local = ((ptr = index(sp->s_flags, 'L')) != NULL); /* M: multi-cast: this is taken care of above, but don't reuse flag */ #ifdef MULTICAST /* O: multi-cast only, don't send article if not multicast hosts */ *************** *** 165,173 /* U: useexist: use the -c option to uux to use the existing copy */ int useexist = (index(sp->s_flags, 'U') != NULL); ! if (local && mode == PROC) { ! (void) fclose(ifp); ! return FALSE; } #ifdef DEBUG --- 171,214 ----- /* U: useexist: use the -c option to uux to use the existing copy */ int useexist = (index(sp->s_flags, 'U') != NULL); ! /* ! * CHANGE [16-Jan-86, ukma!david] -- Applied Ln patch from ! * harvard!adelie!barry in message <547@adelie.UUCP>. ! */ ! if (local) { ! char buf[300], bf2[10], *s, *ss; ! int flag = (1==0); ! ++ptr; ! s = h.path; ! ss = buf; ! do { ! if (*s < ' ' || *s > '\177') { ! nullit: /* GRUNT! -- debugging */ ! sprintf(bf2, "\\%o", (int)*s); ! strcat(ss, bf2); ! while (*ss != '\0') ! ss++; ! s++; ! } ! else { ! *ss++ = *s++; ! if (*s == '\0') ! goto nullit; ! } ! } while (*s != '\0'); ! log("L%c for: %s\n", *ptr, buf); ! if (isdigit(*ptr)) ! local = *ptr - '0'; ! else ! local = 0; ! for (ptr = h.path; *ptr != '\0'; local--, ptr++) ! while (*ptr != '\0') ! ptr++; ! if (local < 0) { ! log("Too far away to transmit %s\n", buf); ! (void) fclose(ifp); ! return FALSE; ! } } #ifdef DEBUG *************** *** 224,229 if (ofp == NULL) xerror("Cannot append to %s", sp->s_xmit); #ifdef MULTICAST while (--mc >= 0) fprintf(ofp, " %s", *sysnames++); fprintf(ofp, "\n"); --- 265,271 ----- if (ofp == NULL) xerror("Cannot append to %s", sp->s_xmit); #ifdef MULTICAST + /* BUG? Shouldn't it printf firstbufname somewhere? */ while (--mc >= 0) fprintf(ofp, " %s", *sysnames++); fprintf(ofp, "\n"); *************** *** 866,872 * In other words, it's the standard format plus some blank lines and * without the \n seperating the #! rnews line from the article. */ ! while ((c=getc(stdin)) == '\n' || iswhite(c)) ; if (c != EOF) (void) ungetc(c, stdin); --- 908,914 ----- * In other words, it's the standard format plus some blank lines and * without the \n seperating the #! rnews line from the article. */ ! while ((c=getc(stdin)) == '\n' || isspace(c)) ; if (c != EOF) (void) ungetc(c, stdin);