🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #2232

Re: trn 3.3 (NNTP) triggers SunOS optimizer bug

#2232
From: Paul Riddle
Date: Fri, 12 Nov 1993 21:56
77 lines
3640 bytes
In article <2c0sn8$pmr@soc2.pop.psu.edu>, David Barr <barr@pop.psu.edu> wrote:
>In article <CGEBqG.9so@eecs.nwu.edu>,
>William LeFebvre <phil@eecs.nwu.edu> wrote:
>>Every time "trn" was started, it kept asking if I wanted to add the
>>same list of new groups.  Further study discovered that the second
>>time value written to the file .rnlast (the one corresponding to
>>lastnewtime) was way way too low.  It was not getting updated
>>correctly.
>
>Well, sh*t.  I just was noticing the same thing today, too.  I
>have an identical setup to yours.
>
>Thanks for the info.
>

I had exactly the opposite problem on my SGI..  the value in .rnlast
was several weeks in the future, and hence I wasn't getting prompted
for any new groups at all.

I traced it down to this segment of code in "nntp.c":

     ss = (*s - '0') + (*--s - '0') * 10;
     mm = (*--s - '0') + (*--s - '0') * 10;
     hh = (*--s - '0') + (*--s - '0') * 10;
     day = (*--s - '0') + (*--s - '0') * 10;
     month = (*--s - '0') + (*--s - '0') * 10;
     *s = '\0';
     year = atoi(s-4);

I might be wrong, but I wouldn't call it an optimizer bug.  The code
assumes that the left operands get evaulated before the right
operands, which ANSI C doesn't guarantee.

This patch, which basically just removes the decrement operators from
the expressions, fixed the problem for me...  Give it a shot.  (Yes I
did report it).

--------------------------------cut-------------------------------
*** nntp.c	Tue Oct 26 13:11:27 1993
--- nntp.c.orig	Tue Oct 26 12:30:48 1993
***************
*** 132,144 ****
  
      s = ser_line + strlen(ser_line) - 1;
  
!     ss = (*s - '0') + (*(s - 1) - '0') * 10;
!     mm = (*(s - 2) - '0') + (*(s - 3) - '0') * 10;
!     hh = (*(s - 4) - '0') + (*(s - 5) - '0') * 10;
!     day = (*(s - 6) - '0') + (*(s - 7) - '0') * 10;
!     month = (*(s - 8) - '0') + (*(s - 9) - '0') * 10;
!     *(s - 9) = '\0';
!     year = atoi(s-13);
  
      /* This simple algorithm will be valid until the year 2400 */
      if (year % 4)
--- 132,144 ----
  
      s = ser_line + strlen(ser_line) - 1;
  
!     ss = (*s - '0') + (*--s - '0') * 10;
!     mm = (*--s - '0') + (*--s - '0') * 10;
!     hh = (*--s - '0') + (*--s - '0') * 10;
!     day = (*--s - '0') + (*--s - '0') * 10;
!     month = (*--s - '0') + (*--s - '0') * 10;
!     *s = '\0';
!     year = atoi(s-4);
  
      /* This simple algorithm will be valid until the year 2400 */
      if (year % 4)
---------------------------cut----------------------------------


-- 
Paul Riddle                         | Internet:  paulr@umbc.edu        |
UMBC, Academic Computing Services   | Phone:  (410) 455-3860 FAX -1065 |
Baltimore, MD 21228                 +----------------------------------+
"SPARCClassic....  The Sun 3/50 of the 90's!"
Technical Details
Message-ID: <2c10qu$saq@umbc7.umbc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!not-for-mail
References: <CGEBqG.9so@eecs.nwu.edu> <2c0sn8$pmr@soc2.pop.psu.edu>

Show Full Headers
Complete Article Headers
Message-ID: <2c10qu$saq@umbc7.umbc.edu>
Subject: Re: trn 3.3 (NNTP) triggers SunOS optimizer bug
Date: Fri, 12 Nov 1993 21:56:46 +0000
From: paulr@umbc.edu (Paul Riddle)
References: <CGEBqG.9so@eecs.nwu.edu> <2c0sn8$pmr@soc2.pop.psu.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!not-for-mail
Newsgroups: news.software.readers,news.software.nntp
Organization: University of Maryland, Baltimore County
Lines: 77
Distribution: inet
NNTP-Posting-Host: umbc7.umbc.edu