pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/mush Avoid crash on negative times



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c855edb3db25
branches:  trunk
changeset: 452959:c855edb3db25
user:      christos <christos%pkgsrc.org@localhost>
date:      Thu May 20 19:21:13 2021 +0000

description:
Avoid crash on negative times
Fix long -> time_t

diffstat:

 mail/mush/Makefile         |    4 +-
 mail/mush/distinfo         |    6 +-
 mail/mush/patches/patch-ak |  164 ++++++++++++++++++++++----------------------
 mail/mush/patches/patch-al |   42 ++++++++++-
 4 files changed, 125 insertions(+), 91 deletions(-)

diffs (270 lines):

diff -r 4e940501e559 -r c855edb3db25 mail/mush/Makefile
--- a/mail/mush/Makefile        Thu May 20 18:56:10 2021 +0000
+++ b/mail/mush/Makefile        Thu May 20 19:21:13 2021 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.33 2020/05/20 06:09:07 rillig Exp $
+# $NetBSD: Makefile,v 1.34 2021/05/20 19:21:13 christos Exp $
 
 DISTNAME=      mush-7.2.5
 PKGNAME=       mush-7.2.6.b4.pl1
-PKGREVISION=   5
+PKGREVISION=   6
 CATEGORIES=    mail
 MASTER_SITES=  # ftp://cse.ogi.edu/pub/mush/
 EXTRACT_SUFX=  .tar.Z
diff -r 4e940501e559 -r c855edb3db25 mail/mush/distinfo
--- a/mail/mush/distinfo        Thu May 20 18:56:10 2021 +0000
+++ b/mail/mush/distinfo        Thu May 20 19:21:13 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.15 2015/11/03 23:27:10 agc Exp $
+$NetBSD: distinfo,v 1.16 2021/05/20 19:21:13 christos Exp $
 
 SHA1 (mush/mush-7.2.5.tar.Z) = 1b9b54b368b9a748401b1baeb3b3eba5a9ed2c03
 RMD160 (mush/mush-7.2.5.tar.Z) = 32e010f544f79cc1a0f899d722d465975d552a4e
@@ -42,8 +42,8 @@
 SHA1 (patch-ah) = ddd684d8de13fd2f338c506254229fa63cca9e94
 SHA1 (patch-ai) = 5659b2d975f86e856d1bf6efb8909bc08ec2acf4
 SHA1 (patch-aj) = fee38b6e855a6494ecef0e41e2602850d1b58746
-SHA1 (patch-ak) = fc25abdf0dfe16020a7ca5e4b284c40367f20f98
-SHA1 (patch-al) = 4d0c9ff2a6a8c3c1d59a81b659ed3599881cc762
+SHA1 (patch-ak) = 66dd2b0edf60e102fa2af390730dfe4f18d27b50
+SHA1 (patch-al) = 8ebb26c2befa4d11505880d81eea2c7f7277f8e6
 SHA1 (patch-am) = 6ce0fd015cb33ada51e086be1131ec0ad94f4169
 SHA1 (patch-an) = 9c7441265ac13e73a4143440b3a1706f81d9d00c
 SHA1 (patch-ao) = e5b28c4a761c1bc1bba195c5dc6ff332cad51f67
diff -r 4e940501e559 -r c855edb3db25 mail/mush/patches/patch-ak
--- a/mail/mush/patches/patch-ak        Thu May 20 18:56:10 2021 +0000
+++ b/mail/mush/patches/patch-ak        Thu May 20 19:21:13 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-ak,v 1.2 2006/01/08 17:04:58 joerg Exp $
+$NetBSD: patch-ak,v 1.3 2021/05/20 19:21:13 christos Exp $
 *** old/folders.c      Sun Oct 25 11:59:14 1998
 --- folders.c  Sun Oct 25 11:58:30 1998
 ***************
@@ -123,85 +123,83 @@
   %i   the message-id (may not be present)
   %n   name of the author
   %s   subject of the message
-*** old/pick.c Sun Oct 25 11:59:14 1998
---- pick.c     Sun Oct 25 11:58:28 1998
-***************
-*** 297,307 ****
-  
-  
-  static int
-! cmplines(m1, m2)
-      struct msg **m1;
-      struct msg **m2;
-  {
-!     int z =  (int) (*m2)->m_lines - (int) (*m1)->m_lines;
-      if (z > 0)
-       return 1;
-      else if (z < 0)
---- 297,308 ----
-  
-  
-  static int
-! cmpreallines(m1, m2)
-      struct msg **m1;
-      struct msg **m2;
-  {
-!     int z =  (int) (((*m2)->m_lines - (*m2)->m_headers) -
-!                  ((*m1)->m_lines - (*m1)->m_headers));
-      if (z > 0)
-       return 1;
-      else if (z < 0)
-***************
-*** 340,356 ****
-       }
-  
-      cnt = i;
-!     qsort((char *) mlist, cnt, sizeof(struct msg *), cmplines);
-  
-      clear_msg_list(ret_list);
-  
-      lcur = -1;
-  
-      for (i = 0; i < cnt - 1; i++) {
-!      lcur = mlist[i]->m_lines;
-       mcur = mlist[i]->m_spare;
-  
-!      if (mlist[i + 1]->m_lines != lcur)
-           /* Next message has not the same number of lines, skip */
-           continue;
-  
---- 341,357 ----
-       }
-  
-      cnt = i;
-!     qsort((char *) mlist, cnt, sizeof(struct msg *), cmpreallines);
-  
-      clear_msg_list(ret_list);
-  
-      lcur = -1;
-  
-      for (i = 0; i < cnt - 1; i++) {
-!      lcur = mlist[i]->m_lines - mlist[i]->m_headers;
-       mcur = mlist[i]->m_spare;
-  
-!      if (mlist[i + 1]->m_lines - mlist[i + 1]->m_headers != lcur)
-           /* Next message has not the same number of lines, skip */
-           continue;
-  
-***************
-*** 374,380 ****
-       }
-       omsize = mlist[i]->m_size - (omsg - otext);
-       for (j = i + 1; j < cnt; j++) {
-!          if (mlist[j]->m_lines != lcur)
-               /* Next message has not the same number of lines, skip */
-               break;
-           mid = mlist[j]->m_spare;
---- 375,381 ----
-       }
-       omsize = mlist[i]->m_size - (omsg - otext);
-       for (j = i + 1; j < cnt; j++) {
-!          if (mlist[j]->m_lines - mlist[j]->m_headers != lcur)
-               /* Next message has not the same number of lines, skip */
-               break;
-           mid = mlist[j]->m_spare;
+--- pick.c.orig        2021-05-20 15:01:53.877747112 -0400
++++ pick.c     2021-05-20 15:15:36.015390640 -0400
+@@ -297,11 +297,12 @@
+ 
+ 
+ static int
+-cmplines(m1, m2)
++cmpreallines(m1, m2)
+     struct msg **m1;
+     struct msg **m2;
+ {
+-    int z =  (int) (*m2)->m_lines - (int) (*m1)->m_lines;
++    int z =  (int) (((*m2)->m_lines - (*m2)->m_headers) -
++                  ((*m1)->m_lines - (*m1)->m_headers));
+     if (z > 0)
+       return 1;
+     else if (z < 0)
+@@ -340,17 +341,17 @@
+       }
+ 
+     cnt = i;
+-    qsort((char *) mlist, cnt, sizeof(struct msg *), cmplines);
++    qsort((char *) mlist, cnt, sizeof(struct msg *), cmpreallines);
+ 
+     clear_msg_list(ret_list);
+ 
+     lcur = -1;
+ 
+     for (i = 0; i < cnt - 1; i++) {
+-      lcur = mlist[i]->m_lines;
++      lcur = mlist[i]->m_lines - mlist[i]->m_headers;
+       mcur = mlist[i]->m_spare;
+ 
+-      if (mlist[i + 1]->m_lines != lcur)
++      if (mlist[i + 1]->m_lines - mlist[i + 1]->m_headers != lcur)
+           /* Next message has not the same number of lines, skip */
+           continue;
+ 
+@@ -374,7 +375,7 @@
+       }
+       omsize = mlist[i]->m_size - (omsg - otext);
+       for (j = i + 1; j < cnt; j++) {
+-          if (mlist[j]->m_lines != lcur)
++          if (mlist[j]->m_lines - mlist[j]->m_headers != lcur)
+               /* Next message has not the same number of lines, skip */
+               break;
+           mid = mlist[j]->m_spare;
+@@ -746,12 +747,14 @@
+ int *month, *day, *year;
+ {
+     long gmt;
++    time_t tgmt;
+     char unused[4], zone[8];
+     struct tm *t;
+     extern long getzoff();
+ 
+     (void) sscanf(date, "%ld%3c%s", &gmt, unused, zone);
+     gmt += getzoff(zone);
++    tgmt = gmt < 0 ? 0 : gmt;
+     t = gmtime(&gmt);
+     *month = t->tm_mon;
+     *day = t->tm_mday;
+@@ -767,7 +770,7 @@
+ register char *p;
+ {
+     register char *p2;
+-    long        t;
++    time_t      t;
+     int         i;
+     struct tm           *today;
+ 
+@@ -833,7 +836,7 @@
+     register char *p;
+     char         buf[256];
+     int                  n = 0, value;
+-    long         t;
++    time_t       t;
+     struct tm           *today;
+ 
+     (void) argv_to_string(buf, argv);
diff -r 4e940501e559 -r c855edb3db25 mail/mush/patches/patch-al
--- a/mail/mush/patches/patch-al        Thu May 20 18:56:10 2021 +0000
+++ b/mail/mush/patches/patch-al        Thu May 20 19:21:13 2021 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-al,v 1.2 2002/03/16 02:07:34 christos Exp $
+$NetBSD: patch-al,v 1.3 2021/05/20 19:21:13 christos Exp $
 
---- dates.c.orig       Fri Mar 15 21:01:54 2002
-+++ dates.c    Fri Mar 15 21:06:33 2002
+--- dates.c.orig       2021-05-20 15:01:53.692058779 -0400
++++ dates.c    2021-05-20 15:14:15.931558100 -0400
 @@ -101,7 +101,7 @@
  {
      long year, julian;
@@ -11,6 +11,24 @@
        year = tym->tm_year + 1900;
      if (year < 69)
        year += 100;
+@@ -123,7 +123,7 @@
+     struct tm *T;
+     char *tz;
+ #if defined(SYSV) || defined(TIMEZONE) || defined(POSIX)
+-    long        x;
++    time_t      x;
+ 
+     (void) time(&x);
+     T = localtime(&x);
+@@ -172,7 +172,7 @@
+     static char time_buf[30];
+     struct tm           *T;
+     register char *p = time_buf;
+-    long        x;
++    time_t      x;
+ 
+     if (!opts)
+       return NULL;
 @@ -375,6 +375,11 @@
      }
      if (Year > 1900)
@@ -23,3 +41,21 @@
      if (!Month && (Month = month_to_n(month)) == -1) {
        print("bad month: %s\n", p);
        return NULL;
+@@ -413,6 +418,7 @@
+ char *Date, *Yr, *Mon, *Day, *Wkday, *Tm, *Zone, *ret_buf;
+ {
+     long gmt;
++    time_t tgmt;
+     struct tm *T;
+     char a_or_p, *p = ret_buf;
+ 
+@@ -420,7 +426,8 @@
+     (void) sscanf(Date, "%ld%3c%s", &gmt, Wkday, Zone);
+     Wkday[3] = 0;
+     gmt += getzoff(Zone);
+-    T = gmtime(&gmt);
++    tgmt = gmt < 0 ? 0 : gmt;
++    T = gmtime(&tgmt);
+     a_or_p = (T->tm_hour < 12)? 'a': 'p';
+ 
+     (void) sprintf(Yr, "%d", T->tm_year + 1900);



Home | Main Index | Thread Index | Old Index