Date: Thursday, January 30, 2014 @ 18:24:04
  Author: bisson
Revision: 204884

fix bug

Added:
  s-nail/trunk/sort.patch
Modified:
  s-nail/trunk/PKGBUILD

------------+
 PKGBUILD   |   13 +++++++---
 sort.patch |   75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2014-01-30 17:15:00 UTC (rev 204883)
+++ PKGBUILD    2014-01-30 17:24:04 UTC (rev 204884)
@@ -6,7 +6,7 @@
 
 pkgname=s-nail
 pkgver=14.5.2
-pkgrel=1
+pkgrel=2
 pkgdesc='Mail processing system with a command syntax reminiscent of ed'
 url='http://sdaoden.users.sourceforge.net/code.html#s-nail'
 license=('custom:BSD')
@@ -13,8 +13,10 @@
 arch=('i686' 'x86_64')
 depends=('openssl')
 optdepends=('smtp-forwarder: for sending mail')
-source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver//./_}.tar.xz";)
-sha1sums=('26ad43f5f41b429d5f13a3ce73a3dff75325950c')
+source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver//./_}.tar.xz";
+        'sort.patch')
+sha1sums=('26ad43f5f41b429d5f13a3ce73a3dff75325950c'
+          '909da731e590d1d2877ed38bed667440a02d1259')
 
 groups=('base')
 backup=('etc/mail.rc')
@@ -22,6 +24,11 @@
 provides=('mailx' 'mailx-heirloom' 'heirloom-mailx')
 conflicts=('mailx' 'mailx-heirloom' 'heirloom-mailx')
 
+prepare() {
+       cd "${srcdir}/${pkgname}-${pkgver}"
+       patch -p1 -i ../sort.patch # 
http://sourceforge.net/mailarchive/message.php?msg_id=31906477
+}
+
 build() {
        cd "${srcdir}/${pkgname}-${pkgver}"
        make \

Added: sort.patch
===================================================================
--- sort.patch                          (rev 0)
+++ sort.patch  2014-01-30 17:24:04 UTC (rev 204884)
@@ -0,0 +1,75 @@
+s-nail-14_5_2-sort.patch, 2014-01-30:
+
+Apply:
+  $ cd s-nail-14.5.2
+  $ patch -bu < s-nail-14_5_2-sort.patch
+
+Description:
+Reverses (sort(),thread(): use srelax()!, 2014-01-18, [a9b67e9]), which
+was a hasty commit of an untested diff that i've added few minutes
+beforehand.
+It was of course wrong.
+The problem (no memory relaxation during entire sort operation) requires
+a different approach (either only relax when we don't need to hold
+dope storage (as for SORT_TO/SORT_FROM/SORT_SUBJECT/+) or use heap
+memory for those allocations, then).
+
+s-nail-14_5_2-sort-alt.patch is an alternative working thesis that uses
+heap allocations, thus continues to relax the dope storage.
+This version has been pushed to [master].
+
+diff --git a/thread.c b/thread.c
+index 3ac5966..9ec1ac9 100644
+--- a/thread.c
++++ b/thread.c
+@@ -361,8 +361,6 @@ makethreads(struct message *m, long cnt, int nmail)
+               return;
+       mprime = nextprime(cnt);
+       mt = scalloc(mprime, sizeof *mt);
+-
+-      srelax_hold();
+       for (i = 0; i < cnt; i++) {
+               if ((m[i].m_flag&MHIDDEN) == 0) {
+                       mlook(NULL, mt, &m[i], mprime);
+@@ -376,7 +374,6 @@ makethreads(struct message *m, long cnt, int nmail)
+               m[i].m_level = 0;
+               if (!nmail && !(inhook&2))
+                       m[i].m_collapsed = 0;
+-              srelax();
+       }
+       /*
+        * Most folders contain the eldest messages first. Traversing
+@@ -387,12 +384,8 @@ makethreads(struct message *m, long cnt, int nmail)
+        * are replies to the one message, and are sorted such that
+        * youngest messages occur first.
+        */
+-      for (i = cnt-1; i >= 0; i--) {
++      for (i = cnt-1; i >= 0; i--)
+               lookup(&m[i], mt, mprime);
+-              srelax();
+-      }
+-      srelax_rele();
+-
+       threadroot = interlink(m, cnt, nmail);
+       finalize(threadroot);
+       free(mt);
+@@ -572,8 +565,6 @@ sort(void *vp)
+       default:
+               break;
+       }
+-
+-      srelax_hold();
+       for (n = 0, i = 0; i < msgCount; i++) {
+               mp = &message[i];
+               if ((mp->m_flag&MHIDDEN) == 0) {
+@@ -637,10 +628,7 @@ sort(void *vp)
+               mp->m_child = mp->m_younger = mp->m_elder = mp->m_parent = NULL;
+               mp->m_level = 0;
+               mp->m_collapsed = 0;
+-              srelax();
+       }
+-      srelax_rele();
+-
+       if (n > 0) {
+               qsort(ms, n, sizeof *ms, func);
+               threadroot = &message[ms[0].ms_n];

Reply via email to