🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
12 messages
12 total messages Started by Duncan Gibson Thu, 04 Jan 1996 00:00
trn-3.4.1 keeps asking about new groups!
#4042
Author: Duncan Gibson
Date: Thu, 04 Jan 1996 00:00
27 lines
1729 bytes
We are running on HPUX 9.01 with c_news-Nov.94, nntp-1.5.11t5, and trn-3.4.1

Since I came back after the Festive Season, I am asked everytime I start trn
whether I want to subscribe to new newsgroups which have come in since before
the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
next time that I start trn I am asked again. This never used to happen!

I've checked that the system times on the news server and my machine are in
sync (they are) and that there are no obvious problems with the active and
active.times files (I can't see any) so I can't really work it out.

Of course I can always type 'y' or 'Y' and then unsubscribe when I reach the
groups, but I'm intrigued as to why this is happening and I would rather keep
my .newsrc short.

Has anyone else seen this before? Does anyone know how to fix whatever it is?

Cheers
Duncan

This is my article, not my employer's, with my opinions and my disclaimer!
--
Duncan Gibson, ESTEC/YCV, Postbus 299, 2200AG Noordwijk, The Netherlands
Tel: +31 71 5654013   Fax: +31 71 3512142  Email: duncan@yc.estec.esa.nl

Re: trn-3.4.1 keeps asking about new groups!
#4041
Author: Davin Milun
Date: Thu, 04 Jan 1996 00:00
47 lines
2475 bytes
Duncan Gibson <duncan@yc.estec.esa.nl> wrote:
�
�We are running on HPUX 9.01 with c_news-Nov.94, nntp-1.5.11t5, and trn-3.4.1
�
�Since I came back after the Festive Season, I am asked everytime I start trn
�whether I want to subscribe to new newsgroups which have come in since before
�the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
�next time that I start trn I am asked again. This never used to happen!
�
�I've checked that the system times on the news server and my machine are in
�sync (they are) and that there are no obvious problems with the active and
�active.times files (I can't see any) so I can't really work it out.
�
�Of course I can always type 'y' or 'Y' and then unsubscribe when I reach the
�groups, but I'm intrigued as to why this is happening and I would rather keep
�my .newsrc short.
�
�Has anyone else seen this before? Does anyone know how to fix whatever it is?

It's a bug in the way trn counts the number of past leap-years.  Since 1996
is a leap year - it bit us now.

Here is a patch for it.

*** nntp.c_orig	Sat Nov 19 01:01:23 1994
--- nntp.c	Wed Jan  3 01:41:34 1996
***************
*** 320,324 ****
  	day += maxdays[month];
  
!     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
  	  + mm) * 60 + ss;
  
--- 320,324 ----
  	day += maxdays[month];
  
!     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
  	  + mm) * 60 + ss;
  

Davin.
-------------------------------------------------------------------------------
Davin Milun    Internet:  milun@cs.Buffalo.EDU
               Fax:       (716) 645-3464
               WWW:       http://www.cs.buffalo.edu/~milun/

Re: trn-3.4.1 keeps asking about new groups!
#4043
Author: Ollivier Robert
Date: Thu, 04 Jan 1996 00:00
41 lines
2120 bytes
In article <DKnuzI.FsG@yc.estec.esa.nl>,
Duncan Gibson <duncan@yc.estec.esa.nl> wrote:
> Since I came back after the Festive Season, I am asked everytime I start trn
> whether I want to subscribe to new newsgroups which have come in since before
> the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
> next time that I start trn I am asked again. This never used to happen!

This is  a bug in 3.4.1  up  to the 4.0  alpha.  Here is a patch  posted in
news.Software.readers:

It should apply cleanly apart from some line number differences. 

[ cc'ed to Duncan ]

*** nntp.c.orig	Tue Jan  2 15:06:51 1996
--- nntp.c	Tue Jan  2 15:27:43 1996
***************
*** 319,325 ****
      for (month--; month; month--)
  	day += maxdays[month];
  
!     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
  	  + mm) * 60 + ss;
  
      return ss;
--- 319,325 ----
      for (month--; month; month--)
  	day += maxdays[month];
  
!     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
  	  + mm) * 60 + ss;
  
      return ss;

============================================================================== 

-- 
Ollivier ROBERT  -=-=-  FreeBSD 2.x FAQ maintainer -=-=-  roberto@freebsd.org
-=-=-=-=-=- Support The Free UNIX Systems !  FreeBSD Linux NetBSD -=-=-=-=-=-

Re: trn-3.4.1 keeps asking about new groups!
#4045
Author: Rick Murphy
Date: Fri, 05 Jan 1996 00:00
53 lines
2902 bytes
In article <4cgs1u$br6@azure.acsu.buffalo.edu>, Davin Milun (milun@cs.buffalo.edu) wrote:
: Duncan Gibson <duncan@yc.estec.esa.nl> wrote:
: �
: �We are running on HPUX 9.01 with c_news-Nov.94, nntp-1.5.11t5, and trn-3.4.1
: �
: �Since I came back after the Festive Season, I am asked everytime I start trn
: �whether I want to subscribe to new newsgroups which have come in since before
: �the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
: �next time that I start trn I am asked again. This never used to happen!
: �
: �I've checked that the system times on the news server and my machine are in
: �sync (they are) and that there are no obvious problems with the active and
: �active.times files (I can't see any) so I can't really work it out.
: �
: �Of course I can always type 'y' or 'Y' and then unsubscribe when I reach the
: �groups, but I'm intrigued as to why this is happening and I would rather keep
: �my .newsrc short.
: �
: �Has anyone else seen this before? Does anyone know how to fix whatever it is?
: 
: It's a bug in the way trn counts the number of past leap-years.  Since 1996
: is a leap year - it bit us now.
: 
: Here is a patch for it.
: 
: *** nntp.c_orig	Sat Nov 19 01:01:23 1994
: --- nntp.c	Wed Jan  3 01:41:34 1996
: ***************
: *** 320,324 ****
:   	day += maxdays[month];
:   
: !     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
:   	  + mm) * 60 + ss;
:   
: --- 320,324 ----
:   	day += maxdays[month];
:   
: !     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
:   	  + mm) * 60 + ss;
:   
: 
: Davin.
: -------------------------------------------------------------------------------
: Davin Milun    Internet:  milun@cs.Buffalo.EDU
:                Fax:       (716) 645-3464
:                WWW:       http://www.cs.buffalo.edu/~milun/

-- 
Rick Murphy, WA1SPT/4		Trusted Information Systems
rick@tis.com			Glenwood, MD 301-854-6889
This posting expresses MY opinions only - I do not speak for TIS.

Re: trn-3.4.1 keeps asking about new groups!
#4051
Author: Anne Bennett
Date: Sat, 06 Jan 1996 00:00
31 lines
2016 bytes
[Distribution inet removed.]
[This post cancels my previous identical one which did not cover
 all of the original newsgroups (if your news software understands
 "also-control").]

Duncan Gibson <duncan@yc.estec.esa.nl> writes:
>> 
>> Since I came back after the Festive Season, I am asked everytime I start trn
>> whether I want to subscribe to new newsgroups which have come in since before
>> the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
>> next time that I start trn I am asked again. This never used to happen!

milun@cs.buffalo.edu (Davin Milun) writes:
>  
> It's a bug in the way trn counts the number of past leap-years.  Since 1996
> is a leap year - it bit us now.
> 
> Here is a patch for it.

That patch is not correct (nor is the one that I suggested here
yesterday, BTW).  A better patch is being elaborated on the trn
testers' mailing list.  I can post it here when it's done.


Anne.
--
Ms. Anne Bennett          anne@alcor.concordia.ca            (514) 848-7606
Computing Services,   Concordia University,   Montreal QC,   Canada H3G 1M8
(Administrator for Concordia University mail relay and news transfer) 

Re: trn-3.4.1 keeps asking about new groups!
#4052
Author: Anne Bennett
Date: Sat, 06 Jan 1996 00:00
24 lines
1743 bytes
Duncan Gibson <duncan@yc.estec.esa.nl> writes:
>> Since I came back after the Festive Season, I am asked everytime I start trn
>> whether I want to subscribe to new newsgroups which have come in since before
>> the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
>> next time that I start trn I am asked again. This never used to happen!

roberto@hsc.fr.net (Ollivier Robert) writes:
> 
> This is  a bug in 3.4.1  up  to the 4.0  alpha.  Here is a patch  posted in
> news.Software.readers:

That patch is not correct (not is the one that I suggested on
news.software.readers yesterday, BTW).  A better patch is being
elaborated on the trn testers' mailing list.  I can post it here when
it's done.


Anne.
--
Ms. Anne Bennett          anne@alcor.concordia.ca            (514) 848-7606
Computing Services,   Concordia University,   Montreal QC,   Canada H3G 1M8
(Administrator for Concordia University mail relay and news transfer) 

Re: trn-3.4.1 keeps asking about new groups!
#4054
Author: J.D. Falk
Date: Sun, 07 Jan 1996 00:00
17 lines
1451 bytes
In news.software.readers, news.admin.misc, and news.software.nntp,
	Anne Bennett <anne@alcor.concordia.ca> wrote... 

> That patch is not correct (not is the one that I suggested on
> news.software.readers yesterday, BTW).  A better patch is being
> elaborated on the trn testers' mailing list.  I can post it here when
> it's done.

	Please do...I'm sure many of us would appreciate it.

-- 
 ---------========== J.D. Falk <jdfalk@cybernothing.org> =========---------
  |    "It is all a show.  Don't you understand that yet?"               |
  |                           -- John "Manus" Grubor, news.admin.misc    |
 ----========== http://www.cybernothing.org/jdfalk/home.html ==========----

Re: trn-3.4.1 keeps asking about new groups!
#4063
Author: Ian G Batten
Date: Sun, 07 Jan 1996 00:00
13 lines
1230 bytes
In article <DKnuzI.FsG@yc.estec.esa.nl>,
Duncan Gibson <duncan@yc.estec.esa.nl> wrote:
> Since I came back after the Festive Season, I am asked everytime I start trn
> whether I want to subscribe to new newsgroups which have come in since before
> the Christmas break. I don't want to subscribe, so I hit 'n' or 'N' but the
> next time that I start trn I am asked again. This never used to happen!

We're seeing this too.  I guess one newsgroup created recently tickles a
problem.

ian

Re: trn-3.4.1 keeps asking about new groups!
#4059
Author: Wayne Davison
Date: Wed, 10 Jan 1996 00:00
19 lines
1372 bytes
I can see nothing wrong with the already-posted fix that changes the 1968
to 1969 since the code already handles February being 29 days long in a
leap year.  Here's the patch as a unified diff:

Index: nntp.c
@@ -320,5 +320,5 @@
 	day += maxdays[month];
 
-    ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
+    ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
 	  + mm) * 60 + ss;
 

The comment about A.D. 2400 will also eventually be changed to be A.D. 2100,
but this has no affect on the code.  :-)

...wayne..

Re: trn-3.4.1 keeps asking about new groups!
#4061
Author: Anne Bennett
Date: Thu, 11 Jan 1996 00:00
131 lines
4791 bytes
[Drat, I did it again. This post cancels my previous identical one
 which did not cover all of the original newsgroups (if your news
 software understands "also-control").  My apologies to anyone who sees
 this twice.]


I wrote:

> That patch is not correct [...]
> A better patch is being
> elaborated on the trn testers' mailing list.  I can post it here when
> it's done.

1)  I was wrong; the patch was OK, at least until 2100.  I re-append it here
    as the "simple patch".
2)  A more correct but more complicated patch, appended here as "fancy
    patch", was submitted, which will work until 2400.

Wayne Davison, author of trn, writes that he will go with the simple patch
because the resulting calculation is faster, and he hopes no-one will still
be using trn in the year 2100.  :-)   I am using the fancy patch at my site.

Pick your own favourite; either will work.  BTW, you should have no trouble
applying these patches to strn-0.9.2, if that's what you're using, though
the line numbers are for trn-3.6.



Anne.
--
Ms. Anne Bennett          anne@alcor.concordia.ca            (514) 848-7606
Computing Services,   Concordia University,   Montreal QC,   Canada H3G 1M8
(Administrator for Concordia University mail relay and news transfer) 
----------------------------------------------------------------------------
SIMPLE PATCH THAT WORKS UNTIL 2100

Submitted by Miquel van Smoorenburg <miquels@debian.het.net>, reposted
to trn-test list by jml4@cus.cam.ac.uk (John Line)>

===== the patch (to nntp.c, line numbers are for trn 3.6)

------- nntp.c -------
*** /tmp/da005NK	Thu Jan  1 00:00:00 1970
--- nntp.c	Wed Jan  3 20:43:11 1996
***************
*** 319,326 ****
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
! 	  + mm) * 60 + ss;

      return ss;
  }
--- 319,326 ----
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
!         + mm) * 60 + ss;

      return ss;
  }

----------------------------------------------------------------------------
FANCY PATCH THAT WORKS UNTIL 2400


From: pdc@lunch.engr.sgi.com (Paul Close)
Subject: Re: trn (3.6 & 4.0-test38) listing "new groups" that aren't new
To: trn-test@trn.com (TRN mailing list)
Date: Fri, 5 Jan 1996 16:43:27 -0800 (PST)

Okay, here's my fix.  This uses a proper leap year calculation, and should
work for a very long time :-)

--- trn-3.6/nntp.c	Fri Nov 18 22:01:23 1994
+++ nntp.c.leap	Fri Jan  5 16:38:33 1996
@@ -285,12 +285,13 @@
 
 /* This is a 1-relative list */
 static int maxdays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
 time_t
 nntp_time()
 {
     char *s;
-    int year, month, day, hh, mm;
+    int year, month, day, hh, mm, y;
     time_t ss;
 
     nntp_command("XDATE" + (CompliantServer? 0 : 1));
@@ -306,11 +307,11 @@
     s[4] = '\0';
     year = atoi(s);
 
-    /* This simple algorithm will be valid until the year 2400 */
-    if (year % 4)
-	maxdays[2] = 28;
-    else
+    if (isleap(year))
 	maxdays[2] = 29;
+    else
+	maxdays[2] = 28;
+
     if (month < 1 || month > 12 || day < 1 || day > maxdays[month]
      || hh < 0 || hh > 23 || mm < 0 || mm > 59
      || ss < 0 || ss > 59)
@@ -319,8 +320,12 @@
     for (month--; month; month--)
 	day += maxdays[month];
 
-    ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
-	  + mm) * 60 + ss;
+    for (y = 1970; y < year; y++)
+	if (isleap(y))
+	    day += 366;
+	else
+	    day += 365;
+    ss += (((day - 1) * 24L + hh) * 60 + mm) * 60;
 
     return ss;
 }


----------------------------------------------------------------------------



Re: trn-3.4.1 keeps asking about new groups!
#4062
Author: Anne Bennett
Date: Thu, 11 Jan 1996 00:00
126 lines
4508 bytes
I wrote:

> That patch is not correct [...]
> A better patch is being
> elaborated on the trn testers' mailing list.  I can post it here when
> it's done.

1)  I was wrong; the patch was OK, at least until 2100.  I re-append it here
    as the "simple patch".
2)  A more correct but more complicated patch, appended here as "fancy
    patch", was submitted, which will work until 2400.

Wayne Davison, author of trn, writes that he will go with the simple patch
because the resulting calculation is faster, and he hopes no-one will still
be using trn in the year 2100.  :-)   I am using the fancy patch at my site.

Pick your own favourite; either will work.  BTW, you should have no trouble
applying these patches to strn-0.9.2, if that's what you're using, though
the line numbers are for trn-3.6.



Anne.
--
Ms. Anne Bennett          anne@alcor.concordia.ca            (514) 848-7606
Computing Services,   Concordia University,   Montreal QC,   Canada H3G 1M8
(Administrator for Concordia University mail relay and news transfer) 
----------------------------------------------------------------------------
SIMPLE PATCH THAT WORKS UNTIL 2100

Submitted by Miquel van Smoorenburg <miquels@debian.het.net>, reposted
to trn-test list by jml4@cus.cam.ac.uk (John Line)>

===== the patch (to nntp.c, line numbers are for trn 3.6)

------- nntp.c -------
*** /tmp/da005NK	Thu Jan  1 00:00:00 1970
--- nntp.c	Wed Jan  3 20:43:11 1996
***************
*** 319,326 ****
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
! 	  + mm) * 60 + ss;

      return ss;
  }
--- 319,326 ----
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
!         + mm) * 60 + ss;

      return ss;
  }

----------------------------------------------------------------------------
FANCY PATCH THAT WORKS UNTIL 2400


From: pdc@lunch.engr.sgi.com (Paul Close)
Subject: Re: trn (3.6 & 4.0-test38) listing "new groups" that aren't new
To: trn-test@trn.com (TRN mailing list)
Date: Fri, 5 Jan 1996 16:43:27 -0800 (PST)

Okay, here's my fix.  This uses a proper leap year calculation, and should
work for a very long time :-)

--- trn-3.6/nntp.c	Fri Nov 18 22:01:23 1994
+++ nntp.c.leap	Fri Jan  5 16:38:33 1996
@@ -285,12 +285,13 @@
 
 /* This is a 1-relative list */
 static int maxdays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
 time_t
 nntp_time()
 {
     char *s;
-    int year, month, day, hh, mm;
+    int year, month, day, hh, mm, y;
     time_t ss;
 
     nntp_command("XDATE" + (CompliantServer? 0 : 1));
@@ -306,11 +307,11 @@
     s[4] = '\0';
     year = atoi(s);
 
-    /* This simple algorithm will be valid until the year 2400 */
-    if (year % 4)
-	maxdays[2] = 28;
-    else
+    if (isleap(year))
 	maxdays[2] = 29;
+    else
+	maxdays[2] = 28;
+
     if (month < 1 || month > 12 || day < 1 || day > maxdays[month]
      || hh < 0 || hh > 23 || mm < 0 || mm > 59
      || ss < 0 || ss > 59)
@@ -319,8 +320,12 @@
     for (month--; month; month--)
 	day += maxdays[month];
 
-    ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
-	  + mm) * 60 + ss;
+    for (y = 1970; y < year; y++)
+	if (isleap(y))
+	    day += 366;
+	else
+	    day += 365;
+    ss += (((day - 1) * 24L + hh) * 60 + mm) * 60;
 
     return ss;
 }


----------------------------------------------------------------------------



Re: trn-3.4.1 keeps asking about new groups!
#4068
Author: bill davidsen
Date: Fri, 12 Jan 1996 00:00
19 lines
1605 bytes
In article <4d3srl$qb1@newsflash.concordia.ca>,
Anne Bennett  <anne@alcor.concordia.ca> wrote:
| 
| 1)  I was wrong; the patch was OK, at least until 2100.  I re-append it here
|     as the "simple patch".
| 2)  A more correct but more complicated patch, appended here as "fancy
|     patch", was submitted, which will work until 2400.

Actually, everything I wrote in the last decade or so uses a form of
the "fancy" patch, because I knew 2000 was coming to get me. After
looking at the patch (briefly) I have to ask why it will fail in
2400. Is 2400 NOT a leap year for some reason?
--
	-bill davidsen (davidsen@tmr.com)
I will support laws and technology which limit what you are allowed
to hear, if you will oppose laws and technology limiting what I am
allowed to say.

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