🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
3 messages
3 total messages Started by William LeFebvre Fri, 12 Nov 1993 20:32
trn 3.3 (NNTP) triggers SunOS optimizer bug
#2231
Author: William LeFebvre
Date: Fri, 12 Nov 1993 20:32
31 lines
2206 bytes
I just came across this today.  Our configuration is trn 3.3 running
on SunOS 4.1.1 and 4.1.2 clients using an NNTP server running SunOS
4.1.3.  We use Cnews for our NNTP server.

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.

I compiled a version of trn with "CFLAGS=-g -DDEBUG" to help debug it,
but that executable did not exhibit the same symptoms.  Closer
scrutiny reveals that addng.c gets the value via a call to nntp_time,
which is in nntp.c.  I compiled everything with -O optimization, then
recompiled just nntp.c without optimization and the problem went away.

I'm posting this as a warning to others out there in a similar
environment.  We have ben using the same executable successfully since
October 4.  The problem was not seen until today.  This is
understandable since it seems to be related to the decoding of a time
value (i.e.: a value that is never the same).

But in the midst of all this experimentation I saw a value for
lastnewtime that was way way too high as well.  I'm beginning to think
I should compile trn with gcc to see if that works any better......

		William LeFebvre
		Computing Facilities Manager and Analyst
		Department of Electrical Engineering and Computer Science
		Northwestern University
		<phil@eecs.nwu.edu>
Re: trn 3.3 (NNTP) triggers SunOS optimizer bug
#2232
Author: 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!"
Re: trn 3.3 (NNTP) triggers SunOS optimizer bug
#2233
Author: William LeFebvre
Date: Fri, 12 Nov 1993 23:15
21 lines
1589 bytes
In article <2c10qu$saq@umbc7.umbc.edu>, Paul Riddle <paulr@umbc.edu> wrote:
>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;

..

You're absolutely right.  I didn't look at the code very closely 
at first, but upon closer inspection it is clear that the semantic
meaning of the code is undefined.  Thanks for the fix.

		William LeFebvre
		Computing Facilities Manager and Analyst
		Department of Electrical Engineering and Computer Science
		Northwestern University
		<phil@eecs.nwu.edu>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads