Path: utzoo!mnetor!uunet!husc6!hao!boulder!sunybcs!rutgers!psuvax1!burdvax!wpl From: wpl@burdvax.PRC.Unisys.COM (William P Loftus) Newsgroups: news.software.b Subject: Re: possible vn bug? Message-ID: <5066@burdvax.PRC.Unisys.COM> Date: 24 Dec 87 01:37:40 GMT References: <222@jc3b21.UUCP> Sender: news@burdvax.PRC.Unisys.COM Distribution: na Organization: Unisys/Paoli Research Center, Paoli, PA Lines: 68 From article <222@jc3b21.UUCP>, by jra@jc3b21.UUCP (Jay R. Ashworth): > While bopping along in vn, reading the news, (Thanks, bobm) I occasionally > get shot down by what appears to be a bug in the program. To wit: > If I attempt to read an article with a header line which is continued, > e.g.: > > Keywords: This is a test. > This is only a test. > > the program bombs, after showing all the header lines (I have header > display toggled off), with a floating exception, core dumped. I note > that when this happens, there is evident, intermixed with the headers, > the line > > Lines: 0 > I had fixed this bug in the previous version of vn (not the current release). I guess the fix never made it into the developers codes (although, I did send him a fix for the bug.). The following text describes how the bug was fixed in the previous version of vn NOT the current version. -- I had a problem with vn. Once in a while, vn would crash with a floating point exception (divide by zero). I tracked to bug to the following lines of code in reader.c. /* for conditional is abnormal - expected exit is break */ for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count) { /* reset position and bail out at first non-header line */ if (index(buf,':') == NULL) { pos = ftell(Fpread); pos -= strlen(buf); fseek (Fpread,pos,0); break; } Vn had thought the header ended when there was a line with no ':'. This is a false assumption (I think), a header ends when there is a line that doesn't begin with ' ' or '\t' and has no embedded ':'. Below is the fix to the above code. /* for conditional is abnormal - expected exit is break */ for (count = 0; count < HDR_LINES && fgets(buf,RECLEN-1,Fpread) != NULL; ++count) { /* reset position and bail out at first non-header line */ if (index(buf,':') == NULL) { if ((buf[0] != '\t') && (buf[0] != ' ')) { pos = ftell(Fpread); pos -= strlen(buf); fseek (Fpread,pos,0); break; } } -- William P Loftus UUCP: wpl@burdvax.UUCP Unisys/Paoli Research Center ARPA: wpl@burdvax.prc.unisys.com PO Box 517 BITNET: 202527899@VUVAXCOM Paoli, PA 19301 215-648-7222 (work) 215-354-0614 (home)