Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!linus!philabs!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.news.b Subject: Article truncation bug - everybody please fix Message-ID: <1527@rlgvax.UUCP> Date: Sun, 8-Jan-84 02:06:37 EST Article-I.D.: rlgvax.1527 Posted: Sun Jan 8 02:06:37 1984 Date-Received: Sun, 8-Jan-84 04:49:25 EST Organization: CCI Office Systems Group, Reston, VA Lines: 105 Here is a description of the "article truncation bug", which is still around, and the fix. The great "article truncation" bug: If the first text line of an article began with a space or tab, the first block or so of the article was thrown away by news 2.10.1 (and possibly 2.10). The fix: The bug is in "header.c"; the fix appears below. A kludge in "inews.c" is also shown, which will take any outgoing articles whose first line begins with space or tab and stick a blank line before them, so that sites downstream which haven't yet installed the fix won't destory your article. Note that the line numbers in this diff may not be exactly the same as the ones in your version. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy header.c: This was changed to keep "news" from truncating articles if the first line of article text was indented. *************** *** 550,556 /* Line too long - part read didn't fit into a newline */ while ((c = getc(fp)) != '\n' && c != EOF) ; ! } else *--tp = '\0'; /* clobber newline */ while ((c = getc(fp)) == ' ' || c == '\t') { /* for each cont line */ --- 550,558 ----- /* Line too long - part read didn't fit into a newline */ while ((c = getc(fp)) != '\n' && c != EOF) ; ! } else if(tp == (cp+1)) ! return(cp); /* Don't look for continuation of blank lines */ ! else *--tp = '\0'; /* clobber newline */ while ((c = getc(fp)) == ' ' || c == '\t') { /* for each cont line */ inews.c: This was changed so that if the first line of text is indented, it is made the second line, so that other sites downstream don't truncate it if they haven't installed the above fix to "header.c". *************** *** 557,562 { register char *ptr; register FILE *tfp; int badgroup = 0, goodgroup = 0; /* Fill up the rest of header. */ --- 557,563 ----- { register char *ptr; register FILE *tfp; + char c; int badgroup = 0, goodgroup = 0; /* Fill up the rest of header. */ *************** *** 572,577 /* Write article to temp file. */ tfp = xfopen(mktemp(ARTICLE), "w"); lhwrite(&header, tfp); while (fgets(bfr, BUFLEN, infp) != NULL) { /* --- 573,582 ----- /* Write article to temp file. */ tfp = xfopen(mktemp(ARTICLE), "w"); + if ( (c=getc(infp)) == ' ' || c == '\t' ) { + header.intnumlines++; + sprintf(header.numlines,"%d",header.intnumlines); + } lhwrite(&header, tfp); /* Kludge to get around article truncation problem */ if (c == ' ' || c == '\t' ) *************** *** 573,578 /* Write article to temp file. */ tfp = xfopen(mktemp(ARTICLE), "w"); lhwrite(&header, tfp); while (fgets(bfr, BUFLEN, infp) != NULL) { /* if (!strncmp(bfr, "From ", 5)) --- 578,587 ----- sprintf(header.numlines,"%d",header.intnumlines); } lhwrite(&header, tfp); + /* Kludge to get around article truncation problem */ + if (c == ' ' || c == '\t' ) + putc('\n', tfp); + putc(c,tfp); while (fgets(bfr, BUFLEN, infp) != NULL) { /* if (!strncmp(bfr, "From ", 5))