[arch-commits] Commit in s-nail/repos (10 files)
Gaetan Bisson
bisson at nymeria.archlinux.org
Tue Feb 11 04:42:52 UTC 2014
Date: Tuesday, February 11, 2014 @ 05:42:52
Author: bisson
Revision: 205832
archrelease: copy trunk to testing-i686, testing-x86_64
Added:
s-nail/repos/testing-i686/
s-nail/repos/testing-i686/PKGBUILD
(from rev 205831, s-nail/trunk/PKGBUILD)
s-nail/repos/testing-i686/maildir.patch
(from rev 205831, s-nail/trunk/maildir.patch)
s-nail/repos/testing-i686/mimeheader.patch
(from rev 205831, s-nail/trunk/mimeheader.patch)
s-nail/repos/testing-i686/sort.patch
(from rev 205831, s-nail/trunk/sort.patch)
s-nail/repos/testing-x86_64/
s-nail/repos/testing-x86_64/PKGBUILD
(from rev 205831, s-nail/trunk/PKGBUILD)
s-nail/repos/testing-x86_64/maildir.patch
(from rev 205831, s-nail/trunk/maildir.patch)
s-nail/repos/testing-x86_64/mimeheader.patch
(from rev 205831, s-nail/trunk/mimeheader.patch)
s-nail/repos/testing-x86_64/sort.patch
(from rev 205831, s-nail/trunk/sort.patch)
---------------------------------+
testing-i686/PKGBUILD | 62 +++++++++
testing-i686/maildir.patch | 253 ++++++++++++++++++++++++++++++++++++++
testing-i686/mimeheader.patch | 147 ++++++++++++++++++++++
testing-i686/sort.patch | 75 +++++++++++
testing-x86_64/PKGBUILD | 62 +++++++++
testing-x86_64/maildir.patch | 253 ++++++++++++++++++++++++++++++++++++++
testing-x86_64/mimeheader.patch | 147 ++++++++++++++++++++++
testing-x86_64/sort.patch | 75 +++++++++++
8 files changed, 1074 insertions(+)
Copied: s-nail/repos/testing-i686/PKGBUILD (from rev 205831, s-nail/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD (rev 0)
+++ testing-i686/PKGBUILD 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,62 @@
+# $Id$
+# Maintainer: Gaetan Bisson <bisson at archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane at archlinux.org>
+# Contributor: Sergej Pupykin <pupykin.s at arch@gmail.com>
+# Contributor: Andreas Wagner <Andreas.Wagner at em.uni-frankfurt.de>
+
+pkgname=s-nail
+pkgver=14.5.2
+pkgrel=4
+pkgdesc='Mail processing system with a command syntax reminiscent of ed'
+url='http://sdaoden.users.sourceforge.net/code.html#s-nail'
+license=('custom:BSD')
+arch=('i686' 'x86_64')
+depends=('openssl')
+optdepends=('smtp-forwarder: for sending mail')
+source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver//./_}.tar.xz"
+ 'mimeheader.patch'
+ 'maildir.patch'
+ 'sort.patch')
+sha1sums=('26ad43f5f41b429d5f13a3ce73a3dff75325950c'
+ 'e72ed84f584ebc50eb9d04779b8b754afa446bf4'
+ '9ba91a0c697c121d9de4ff67766ec90f4ee354b5'
+ '909da731e590d1d2877ed38bed667440a02d1259')
+
+groups=('base')
+backup=('etc/mail.rc')
+replaces=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+provides=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+conflicts=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -p1 -i ../mimeheader.patch
+ patch -p1 -i ../maildir.patch
+ patch -p1 -i ../sort.patch
+}
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make \
+ PREFIX=/usr \
+ SYSCONFDIR=/etc \
+ MANDIR=/usr/share/man \
+ MAILSPOOL=/var/spool/mail \
+ SID= NAIL=mail \
+ config
+
+ make build
+}
+
+check() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make test
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" packager-install
+ ln -sf mail "${pkgdir}"/usr/bin/mailx
+ ln -sf mail.1.gz "${pkgdir}"/usr/share/man/man1/mailx.1.gz
+ install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
+}
Copied: s-nail/repos/testing-i686/maildir.patch (from rev 205831, s-nail/trunk/maildir.patch)
===================================================================
--- testing-i686/maildir.patch (rev 0)
+++ testing-i686/maildir.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,253 @@
+s-nail-14_5_2-maildir.patch, 2014-02-10:
+
+Apply:
+ $ cd s-nail-14.5.2
+ $ patch -bu < s-nail-14_5_2-maildir.patch
+
+Description:
+ To overcome a general design problem of the Berkeley Mail codebase
+ i once added realpath(3) calls to be able to resolve the path of
+ a mailbox file: like that changing a directory wouldn't cause the
+ program to "hang" because the (relatively) opened mailbox became
+ inaccessible. (Again: the real solution will take many years.)
+
+ My first KISS solution to one aspect of the general problem was
+ [3adf33ee] (schdir(): realpath() local files before leaving CWD..,
+ 2013-01-08), and it should possibly have worked with maildir boxes,
+ because we'd only did anything once the user actively used the `chdir'
+ command (and who does), but Christos Zoulas from NetBSD actually forced
+ me to do more (after i've reported the general Berkeley bug), and that
+ led to the current code, which always calls realpath(3).
+ Anyway, i wasn't in the position to reflect the impact of doing so at
+ that time. And the entire codebase needs to be reworked anyway. (:(
+
+ Anyway -- this patch is an adjusted combination of the [1c2563b]
+ (lex.c:_update_mailname(): continue if realname() fails.., 2014-02-10)
+ and [13f325f] (Avoid "cannot canonicalize" maildir warning.., 2014-02-10)
+ changesets that have been pushed to [master], and make maildir mailboxes
+ usable again.
+
+Notes:
+ The patch is so large because it was cherry-picked from [crawl] onto
+ [master] and (thus) includes the very large [nyd] topic branch style-and-
+ much-more changes. Sorry for that.
+
+ lex.c | 11 +++--
+ maildir.c | 152 +++++++++++++++++++++++++++++++++-----------------------------
+ 2 files changed, 87 insertions(+), 76 deletions(-)
+
+diff --git a/lex.c b/lex.c
+index 922faf8..3b3b3cc 100644
+--- a/lex.c
++++ b/lex.c
+@@ -164,7 +164,7 @@ _update_mailname(char const *name)
+ {
+ char tbuf[MAXPATHLEN], *mailp, *dispp;
+ size_t i, j;
+- bool_t rv;
++ bool_t rv = TRU1;
+
+ /* Don't realpath(3) if it's only an update request */
+ if (name != NULL) {
+@@ -174,9 +174,10 @@ _update_mailname(char const *name)
+ if (realpath(name, mailname) == NULL) {
+ fprintf(stderr, tr(151, "Can't canonicalize `%s'\n"), name);
+ rv = FAL0;
+- goto jleave;
++ goto jdocopy;
+ }
+ } else
++jdocopy:
+ #endif
+ n_strlcpy(mailname, name, sizeof(mailname));
+ }
+@@ -197,9 +198,10 @@ _update_mailname(char const *name)
+
+ /* We want to see the name of the folder .. on the screen */
+ i = strlen(mailp);
+- if ((rv = (i < sizeof(displayname) - 1)))
++ if (i < sizeof(displayname) - 1)
+ memcpy(dispp, mailp, i + 1);
+ else {
++ rv = FAL0;
+ /* Avoid disrupting multibyte sequences (if possible) */
+ #ifndef HAVE_C90AMEND1
+ j = sizeof(displayname) / 3 - 1;
+@@ -212,9 +214,6 @@ _update_mailname(char const *name)
+ snprintf(dispp, sizeof(displayname), "%.*s...%s",
+ (int)j, mailp, mailp + i);
+ }
+-#ifdef HAVE_REALPATH
+-jleave:
+-#endif
+ return rv;
+ }
+
+diff --git a/maildir.c b/maildir.c
+index 32180bd..3d45f77 100644
+--- a/maildir.c
++++ b/maildir.c
+@@ -1,5 +1,5 @@
+ /*@ S-nail - a mail user agent derived from Berkeley Mail.
+- *@ Maildir folder support.
++ *@ Maildir folder support. FIXME rewrite - why do we chdir(2)??
+ *
+ * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
+ * Copyright (c) 2012 - 2014 Steffen "Daode" Nurpmeso <sdaoden at users.sf.net>.
+@@ -101,75 +101,87 @@ jleave: ;
+ FL int
+ maildir_setfile(char const * volatile name, int nmail, int isedit)
+ {
+- sighandler_type volatile saveint;
+- struct cw cw;
+- int i = -1, omsgCount;
+-
+- (void)&saveint;
+- (void)&i;
+- omsgCount = msgCount;
+- if (cwget(&cw) == STOP) {
+- fprintf(stderr, "Fatal: Cannot open current directory\n");
+- return -1;
+- }
+- if (!nmail)
+- quit();
+- saveint = safe_signal(SIGINT, SIG_IGN);
+- if (chdir(name) < 0) {
+- fprintf(stderr, "Cannot change directory to \"%s\".\n", name);
+- cwrelse(&cw);
+- return -1;
+- }
+- if (!nmail) {
+- edit = (isedit != 0);
+- if (mb.mb_itf) {
+- fclose(mb.mb_itf);
+- mb.mb_itf = NULL;
+- }
+- if (mb.mb_otf) {
+- fclose(mb.mb_otf);
+- mb.mb_otf = NULL;
+- }
+- initbox(name);
+- mb.mb_type = MB_MAILDIR;
+- }
+- _maildir_table = NULL;
+- if (sigsetjmp(_maildir_jmp, 1) == 0) {
+- if (nmail)
+- mktable();
+- if (saveint != SIG_IGN)
+- safe_signal(SIGINT, maildircatch);
+- i = maildir_setfile1(name, nmail, omsgCount);
+- }
+- if (nmail && _maildir_table != NULL)
+- free(_maildir_table);
+- safe_signal(SIGINT, saveint);
+- if (i < 0) {
+- mb.mb_type = MB_VOID;
+- *mailname = '\0';
+- msgCount = 0;
+- }
+- if (cwret(&cw) == STOP) {
+- fputs("Fatal: Cannot change back to current directory.\n",
+- stderr);
+- abort();
+- }
+- cwrelse(&cw);
+- setmsize(msgCount);
+- if (nmail && mb.mb_sorted && msgCount > omsgCount) {
+- mb.mb_threaded = 0;
+- sort((void *)-1);
+- }
+- if (!nmail)
+- sawcom = FAL0;
+- if (!nmail && !edit && msgCount == 0) {
+- if (mb.mb_type == MB_MAILDIR && !ok_blook(emptystart))
+- fprintf(stderr, "No mail at %s\n", name);
+- return 1;
+- }
+- if (nmail && msgCount > omsgCount)
+- newmailinfo(omsgCount);
+- return 0;
++ sighandler_type volatile saveint;
++ struct cw cw;
++ int i = -1, omsgCount;
++
++ /* TODO ince we have a VOID box... */
++ omsgCount = msgCount;
++ if (cwget(&cw) == STOP) {
++ fprintf(stderr, "Cannot open current directory");
++ goto jleave;
++ }
++
++ if (!nmail)
++ quit();
++
++ saveint = safe_signal(SIGINT, SIG_IGN);
++
++ if (!nmail) {
++ edit = (isedit != 0);
++ if (mb.mb_itf) {
++ fclose(mb.mb_itf);
++ mb.mb_itf = NULL;
++ }
++ if (mb.mb_otf) {
++ fclose(mb.mb_otf);
++ mb.mb_otf = NULL;
++ }
++ initbox(name);
++ mb.mb_type = MB_MAILDIR;
++ }
++
++ if (chdir(name) < 0) {
++ fprintf(stderr, "Cannot change directory to \"%s\".\n", name);/*TODO tr*/
++ mb.mb_type = MB_VOID;
++ *mailname = '\0';
++ msgCount = 0;
++ cwrelse(&cw);
++ safe_signal(SIGINT, saveint);
++ goto jleave;
++ }
++
++ _maildir_table = NULL;
++ if (sigsetjmp(_maildir_jmp, 1) == 0) {
++ if (nmail)
++ mktable();
++ if (saveint != SIG_IGN)
++ safe_signal(SIGINT, &maildircatch);
++ i = maildir_setfile1(name, nmail, omsgCount);
++ }
++ if (nmail && _maildir_table != NULL)
++ free(_maildir_table);
++
++ safe_signal(SIGINT, saveint);
++
++ if (i < 0) {
++ mb.mb_type = MB_VOID;
++ *mailname = '\0';
++ msgCount = 0;
++ }
++
++ if (cwret(&cw) == STOP)
++ panic("Cannot change back to current directory.");/* TODO tr */
++ cwrelse(&cw);
++
++ setmsize(msgCount);
++ if (nmail && mb.mb_sorted && msgCount > omsgCount) {
++ mb.mb_threaded = 0;
++ sort((void*)-1);
++ }
++ if (!nmail)
++ sawcom = FAL0;
++ if (!nmail && !edit && msgCount == 0) {
++ if (mb.mb_type == MB_MAILDIR /* XXX ?? */ && !ok_blook(emptystart))
++ fprintf(stderr, tr(258, "No mail at %s\n"), name);
++ i = 1;
++ goto jleave;
++ }
++ if (nmail && msgCount > omsgCount)
++ newmailinfo(omsgCount);
++ i = 0;
++jleave:
++ return i;
+ }
+
+ static int
Copied: s-nail/repos/testing-i686/mimeheader.patch (from rev 205831, s-nail/trunk/mimeheader.patch)
===================================================================
--- testing-i686/mimeheader.patch (rev 0)
+++ testing-i686/mimeheader.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,147 @@
+s-nail-14_5_2-mimeheader.patch, 2014-02-05:
+
+Apply:
+ $ cd s-nail-14.5.2
+ $ patch -bu < s-nail-14_5_2-mimeheader.patch
+
+Description:
+ mime_fromhdr(): fix my rewrite again..
+
+ My hasty rewrite [0f9ad93] (mime_fromhdr(): partial rewrite using
+ n_iconv_str(), 2013-03-12), just about ninety (90) minutes before
+ the release of S-nail v14.1 already caused the bugfix [b608c6b]
+ (mime_fromhdr(): never return NULL output.., 2013-03-14), which
+ was the sole reason for the release of S-nail v14.2.
+
+ Well, about a year later, after tens of thousands of mails,
+ including multibyte ones, i wrote myself a message that has shown
+ that the rewrite was still buggy -- the header
+
+ Subject: ehm, .getElementById("blink") needs <span
+ =?US-ASCII?Q?id=3D"blink">,?= not =?US-ASCII?Q?class=3D"id"?=
+
+ cannot be viewed correctly, the ", not" will be lost.
+ The reason is now understood and this changeset should fix
+ mime_fromhdr() so that it'll do what it is assumed to do in the
+ current codebase, unless i'm terribly mistaken.
+
+ Because i bickered some time in private, i WANT to add that the
+ real problem is that the codebase is weird INSOFAR as that i still
+ don't really understand the WAY it works, because THAT IS SICK.
+ I.e., in my brain i assume this function effectively is
+ rfc_2047_decode(), meant to decode encoded words as specified in
+ RFC 2047, but that's simply not true, and FOR QUITE SOME TIME,
+ because of the embedded newlines that may be in the data and need
+ to passed through for at least the case that we send data to the
+ display. I slowly get around that schizophrenic codebase while
+ also converting it to a straight one, but that will take years.
+ Until then we need to strip whitespace in between multiple
+ adjacent encoded words, while passing through newlines and
+ whitespace that follows newlines, regardless of whatever.
+ I hope this will do it until we are sane.
+---
+ mime.c | 63 +++++++++++++++++++++++++++++++++++++++------------------------
+ 1 file changed, 39 insertions(+), 24 deletions(-)
+
+diff --git a/mime.c b/mime.c
+index ccb0061..6ee55cc 100644
+--- a/mime.c
++++ b/mime.c
+@@ -863,20 +863,26 @@ jclear:
+ goto jleave;
+ }
+
+-/*
+- * Convert header fields from RFC 1522 format
+- * TODO mime_fromhdr(): NO error handling, fat; REWRITE **ASAP**
+- */
+ FL void
+ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ {
+- /* TODO mime_fromhdr(): is called with strings that contain newlines;
+- * TODO this is the usual newline problem all around the codebase;
+- * TODO i.e., if we strip it, then the display misses it ;} */
++ /* TODO mime_fromhdr(): is called with strings that contain newlines;
++ * TODO this is the usual newline problem all around the codebase;
++ * TODO i.e., if we strip it, then the display misses it ;>
++ * TODO this is why it is so messy and why S-nail v14.2 plus additional
++ * TODO patch for v14.5.2 (and maybe even v14.5.3 subminor) occurred, and
++ * TODO why our display reflects what is contained in the message: the 1:1
++ * TODO relationship of message content and display!
++ * TODO instead a header line should be decoded to what it is (a single
++ * TODO line that is) and it should be objective to the backend wether
++ * TODO it'll be folded to fit onto the display or not, e.g., for search
++ * TODO purposes etc. then the only condition we have to honour in here
++ * TODO is that whitespace in between multiple adjacent MIME encoded words
++ * TODO á la RFC 2047 is discarded; i.e.: this function should deal with
++ * TODO RFC 2047 and be renamed: mime_fromhdr() -> mime_rfc2047_decode() */
+ struct str cin, cout;
+ char *p, *op, *upper, *cs, *cbeg;
+- int convert;
+- size_t lastoutl = (size_t)-1;
++ ui32_t convert, lastenc, lastoutl;
+ #ifdef HAVE_ICONV
+ char const *tcs;
+ iconv_t fhicd = (iconv_t)-1;
+@@ -894,6 +900,7 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ #endif
+ p = in->s;
+ upper = p + in->l;
++ lastenc = lastoutl = 0;
+
+ while (p < upper) {
+ op = p;
+@@ -949,8 +956,7 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ --cout.l;
+ } else
+ (void)qp_decode(&cout, &cin, NULL);
+- if (lastoutl != (size_t)-1)
+- out->l = lastoutl;
++ out->l = lastenc;
+ #ifdef HAVE_ICONV
+ if ((flags & TD_ICONV) && fhicd != (iconv_t)-1) {
+ cin.s = NULL, cin.l = 0; /* XXX string pool ! */
+@@ -966,21 +972,30 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ #ifdef HAVE_ICONV
+ }
+ #endif
+- lastoutl = out->l;
++ lastenc = lastoutl = out->l;
+ free(cout.s);
+- } else {
+-jnotmime:
+- p = op;
+- convert = 1;
+- while ((op = p + convert) < upper &&
+- (op[0] != '=' || op[1] != '?'))
+- ++convert;
+- out = n_str_add_buf(out, p, convert);
+- p += convert;
+- if (! blankchar(p[-1]))
+- lastoutl = (size_t)-1;
+- }
++ } else
++jnotmime: {
++ bool_t onlyws;
++
++ p = op;
++ onlyws = (lastenc > 0);
++ for (;;) {
++ if (++op == upper)
++ break;
++ if (op[0] == '=' && (PTRCMP(op + 1, ==, upper) || op[1] == '?'))
++ break;
++ if (onlyws && !blankchar(*op))
++ onlyws = FAL0;
++ }
++
++ out = n_str_add_buf(out, p, PTR2SIZE(op - p));
++ p = op;
++ if (!onlyws || lastoutl != lastenc)
++ lastenc = out->l;
++ lastoutl = out->l;
+ }
++ }
+ out->s[out->l] = '\0';
+
+ if (flags & TD_ISPR) {
Copied: s-nail/repos/testing-i686/sort.patch (from rev 205831, s-nail/trunk/sort.patch)
===================================================================
--- testing-i686/sort.patch (rev 0)
+++ testing-i686/sort.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -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];
Copied: s-nail/repos/testing-x86_64/PKGBUILD (from rev 205831, s-nail/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,62 @@
+# $Id$
+# Maintainer: Gaetan Bisson <bisson at archlinux.org>
+# Contributor: Stéphane Gaudreault <stephane at archlinux.org>
+# Contributor: Sergej Pupykin <pupykin.s at arch@gmail.com>
+# Contributor: Andreas Wagner <Andreas.Wagner at em.uni-frankfurt.de>
+
+pkgname=s-nail
+pkgver=14.5.2
+pkgrel=4
+pkgdesc='Mail processing system with a command syntax reminiscent of ed'
+url='http://sdaoden.users.sourceforge.net/code.html#s-nail'
+license=('custom:BSD')
+arch=('i686' 'x86_64')
+depends=('openssl')
+optdepends=('smtp-forwarder: for sending mail')
+source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver//./_}.tar.xz"
+ 'mimeheader.patch'
+ 'maildir.patch'
+ 'sort.patch')
+sha1sums=('26ad43f5f41b429d5f13a3ce73a3dff75325950c'
+ 'e72ed84f584ebc50eb9d04779b8b754afa446bf4'
+ '9ba91a0c697c121d9de4ff67766ec90f4ee354b5'
+ '909da731e590d1d2877ed38bed667440a02d1259')
+
+groups=('base')
+backup=('etc/mail.rc')
+replaces=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+provides=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+conflicts=('mailx' 'mailx-heirloom' 'heirloom-mailx')
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -p1 -i ../mimeheader.patch
+ patch -p1 -i ../maildir.patch
+ patch -p1 -i ../sort.patch
+}
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make \
+ PREFIX=/usr \
+ SYSCONFDIR=/etc \
+ MANDIR=/usr/share/man \
+ MAILSPOOL=/var/spool/mail \
+ SID= NAIL=mail \
+ config
+
+ make build
+}
+
+check() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make test
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" packager-install
+ ln -sf mail "${pkgdir}"/usr/bin/mailx
+ ln -sf mail.1.gz "${pkgdir}"/usr/share/man/man1/mailx.1.gz
+ install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
+}
Copied: s-nail/repos/testing-x86_64/maildir.patch (from rev 205831, s-nail/trunk/maildir.patch)
===================================================================
--- testing-x86_64/maildir.patch (rev 0)
+++ testing-x86_64/maildir.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,253 @@
+s-nail-14_5_2-maildir.patch, 2014-02-10:
+
+Apply:
+ $ cd s-nail-14.5.2
+ $ patch -bu < s-nail-14_5_2-maildir.patch
+
+Description:
+ To overcome a general design problem of the Berkeley Mail codebase
+ i once added realpath(3) calls to be able to resolve the path of
+ a mailbox file: like that changing a directory wouldn't cause the
+ program to "hang" because the (relatively) opened mailbox became
+ inaccessible. (Again: the real solution will take many years.)
+
+ My first KISS solution to one aspect of the general problem was
+ [3adf33ee] (schdir(): realpath() local files before leaving CWD..,
+ 2013-01-08), and it should possibly have worked with maildir boxes,
+ because we'd only did anything once the user actively used the `chdir'
+ command (and who does), but Christos Zoulas from NetBSD actually forced
+ me to do more (after i've reported the general Berkeley bug), and that
+ led to the current code, which always calls realpath(3).
+ Anyway, i wasn't in the position to reflect the impact of doing so at
+ that time. And the entire codebase needs to be reworked anyway. (:(
+
+ Anyway -- this patch is an adjusted combination of the [1c2563b]
+ (lex.c:_update_mailname(): continue if realname() fails.., 2014-02-10)
+ and [13f325f] (Avoid "cannot canonicalize" maildir warning.., 2014-02-10)
+ changesets that have been pushed to [master], and make maildir mailboxes
+ usable again.
+
+Notes:
+ The patch is so large because it was cherry-picked from [crawl] onto
+ [master] and (thus) includes the very large [nyd] topic branch style-and-
+ much-more changes. Sorry for that.
+
+ lex.c | 11 +++--
+ maildir.c | 152 +++++++++++++++++++++++++++++++++-----------------------------
+ 2 files changed, 87 insertions(+), 76 deletions(-)
+
+diff --git a/lex.c b/lex.c
+index 922faf8..3b3b3cc 100644
+--- a/lex.c
++++ b/lex.c
+@@ -164,7 +164,7 @@ _update_mailname(char const *name)
+ {
+ char tbuf[MAXPATHLEN], *mailp, *dispp;
+ size_t i, j;
+- bool_t rv;
++ bool_t rv = TRU1;
+
+ /* Don't realpath(3) if it's only an update request */
+ if (name != NULL) {
+@@ -174,9 +174,10 @@ _update_mailname(char const *name)
+ if (realpath(name, mailname) == NULL) {
+ fprintf(stderr, tr(151, "Can't canonicalize `%s'\n"), name);
+ rv = FAL0;
+- goto jleave;
++ goto jdocopy;
+ }
+ } else
++jdocopy:
+ #endif
+ n_strlcpy(mailname, name, sizeof(mailname));
+ }
+@@ -197,9 +198,10 @@ _update_mailname(char const *name)
+
+ /* We want to see the name of the folder .. on the screen */
+ i = strlen(mailp);
+- if ((rv = (i < sizeof(displayname) - 1)))
++ if (i < sizeof(displayname) - 1)
+ memcpy(dispp, mailp, i + 1);
+ else {
++ rv = FAL0;
+ /* Avoid disrupting multibyte sequences (if possible) */
+ #ifndef HAVE_C90AMEND1
+ j = sizeof(displayname) / 3 - 1;
+@@ -212,9 +214,6 @@ _update_mailname(char const *name)
+ snprintf(dispp, sizeof(displayname), "%.*s...%s",
+ (int)j, mailp, mailp + i);
+ }
+-#ifdef HAVE_REALPATH
+-jleave:
+-#endif
+ return rv;
+ }
+
+diff --git a/maildir.c b/maildir.c
+index 32180bd..3d45f77 100644
+--- a/maildir.c
++++ b/maildir.c
+@@ -1,5 +1,5 @@
+ /*@ S-nail - a mail user agent derived from Berkeley Mail.
+- *@ Maildir folder support.
++ *@ Maildir folder support. FIXME rewrite - why do we chdir(2)??
+ *
+ * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
+ * Copyright (c) 2012 - 2014 Steffen "Daode" Nurpmeso <sdaoden at users.sf.net>.
+@@ -101,75 +101,87 @@ jleave: ;
+ FL int
+ maildir_setfile(char const * volatile name, int nmail, int isedit)
+ {
+- sighandler_type volatile saveint;
+- struct cw cw;
+- int i = -1, omsgCount;
+-
+- (void)&saveint;
+- (void)&i;
+- omsgCount = msgCount;
+- if (cwget(&cw) == STOP) {
+- fprintf(stderr, "Fatal: Cannot open current directory\n");
+- return -1;
+- }
+- if (!nmail)
+- quit();
+- saveint = safe_signal(SIGINT, SIG_IGN);
+- if (chdir(name) < 0) {
+- fprintf(stderr, "Cannot change directory to \"%s\".\n", name);
+- cwrelse(&cw);
+- return -1;
+- }
+- if (!nmail) {
+- edit = (isedit != 0);
+- if (mb.mb_itf) {
+- fclose(mb.mb_itf);
+- mb.mb_itf = NULL;
+- }
+- if (mb.mb_otf) {
+- fclose(mb.mb_otf);
+- mb.mb_otf = NULL;
+- }
+- initbox(name);
+- mb.mb_type = MB_MAILDIR;
+- }
+- _maildir_table = NULL;
+- if (sigsetjmp(_maildir_jmp, 1) == 0) {
+- if (nmail)
+- mktable();
+- if (saveint != SIG_IGN)
+- safe_signal(SIGINT, maildircatch);
+- i = maildir_setfile1(name, nmail, omsgCount);
+- }
+- if (nmail && _maildir_table != NULL)
+- free(_maildir_table);
+- safe_signal(SIGINT, saveint);
+- if (i < 0) {
+- mb.mb_type = MB_VOID;
+- *mailname = '\0';
+- msgCount = 0;
+- }
+- if (cwret(&cw) == STOP) {
+- fputs("Fatal: Cannot change back to current directory.\n",
+- stderr);
+- abort();
+- }
+- cwrelse(&cw);
+- setmsize(msgCount);
+- if (nmail && mb.mb_sorted && msgCount > omsgCount) {
+- mb.mb_threaded = 0;
+- sort((void *)-1);
+- }
+- if (!nmail)
+- sawcom = FAL0;
+- if (!nmail && !edit && msgCount == 0) {
+- if (mb.mb_type == MB_MAILDIR && !ok_blook(emptystart))
+- fprintf(stderr, "No mail at %s\n", name);
+- return 1;
+- }
+- if (nmail && msgCount > omsgCount)
+- newmailinfo(omsgCount);
+- return 0;
++ sighandler_type volatile saveint;
++ struct cw cw;
++ int i = -1, omsgCount;
++
++ /* TODO ince we have a VOID box... */
++ omsgCount = msgCount;
++ if (cwget(&cw) == STOP) {
++ fprintf(stderr, "Cannot open current directory");
++ goto jleave;
++ }
++
++ if (!nmail)
++ quit();
++
++ saveint = safe_signal(SIGINT, SIG_IGN);
++
++ if (!nmail) {
++ edit = (isedit != 0);
++ if (mb.mb_itf) {
++ fclose(mb.mb_itf);
++ mb.mb_itf = NULL;
++ }
++ if (mb.mb_otf) {
++ fclose(mb.mb_otf);
++ mb.mb_otf = NULL;
++ }
++ initbox(name);
++ mb.mb_type = MB_MAILDIR;
++ }
++
++ if (chdir(name) < 0) {
++ fprintf(stderr, "Cannot change directory to \"%s\".\n", name);/*TODO tr*/
++ mb.mb_type = MB_VOID;
++ *mailname = '\0';
++ msgCount = 0;
++ cwrelse(&cw);
++ safe_signal(SIGINT, saveint);
++ goto jleave;
++ }
++
++ _maildir_table = NULL;
++ if (sigsetjmp(_maildir_jmp, 1) == 0) {
++ if (nmail)
++ mktable();
++ if (saveint != SIG_IGN)
++ safe_signal(SIGINT, &maildircatch);
++ i = maildir_setfile1(name, nmail, omsgCount);
++ }
++ if (nmail && _maildir_table != NULL)
++ free(_maildir_table);
++
++ safe_signal(SIGINT, saveint);
++
++ if (i < 0) {
++ mb.mb_type = MB_VOID;
++ *mailname = '\0';
++ msgCount = 0;
++ }
++
++ if (cwret(&cw) == STOP)
++ panic("Cannot change back to current directory.");/* TODO tr */
++ cwrelse(&cw);
++
++ setmsize(msgCount);
++ if (nmail && mb.mb_sorted && msgCount > omsgCount) {
++ mb.mb_threaded = 0;
++ sort((void*)-1);
++ }
++ if (!nmail)
++ sawcom = FAL0;
++ if (!nmail && !edit && msgCount == 0) {
++ if (mb.mb_type == MB_MAILDIR /* XXX ?? */ && !ok_blook(emptystart))
++ fprintf(stderr, tr(258, "No mail at %s\n"), name);
++ i = 1;
++ goto jleave;
++ }
++ if (nmail && msgCount > omsgCount)
++ newmailinfo(omsgCount);
++ i = 0;
++jleave:
++ return i;
+ }
+
+ static int
Copied: s-nail/repos/testing-x86_64/mimeheader.patch (from rev 205831, s-nail/trunk/mimeheader.patch)
===================================================================
--- testing-x86_64/mimeheader.patch (rev 0)
+++ testing-x86_64/mimeheader.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -0,0 +1,147 @@
+s-nail-14_5_2-mimeheader.patch, 2014-02-05:
+
+Apply:
+ $ cd s-nail-14.5.2
+ $ patch -bu < s-nail-14_5_2-mimeheader.patch
+
+Description:
+ mime_fromhdr(): fix my rewrite again..
+
+ My hasty rewrite [0f9ad93] (mime_fromhdr(): partial rewrite using
+ n_iconv_str(), 2013-03-12), just about ninety (90) minutes before
+ the release of S-nail v14.1 already caused the bugfix [b608c6b]
+ (mime_fromhdr(): never return NULL output.., 2013-03-14), which
+ was the sole reason for the release of S-nail v14.2.
+
+ Well, about a year later, after tens of thousands of mails,
+ including multibyte ones, i wrote myself a message that has shown
+ that the rewrite was still buggy -- the header
+
+ Subject: ehm, .getElementById("blink") needs <span
+ =?US-ASCII?Q?id=3D"blink">,?= not =?US-ASCII?Q?class=3D"id"?=
+
+ cannot be viewed correctly, the ", not" will be lost.
+ The reason is now understood and this changeset should fix
+ mime_fromhdr() so that it'll do what it is assumed to do in the
+ current codebase, unless i'm terribly mistaken.
+
+ Because i bickered some time in private, i WANT to add that the
+ real problem is that the codebase is weird INSOFAR as that i still
+ don't really understand the WAY it works, because THAT IS SICK.
+ I.e., in my brain i assume this function effectively is
+ rfc_2047_decode(), meant to decode encoded words as specified in
+ RFC 2047, but that's simply not true, and FOR QUITE SOME TIME,
+ because of the embedded newlines that may be in the data and need
+ to passed through for at least the case that we send data to the
+ display. I slowly get around that schizophrenic codebase while
+ also converting it to a straight one, but that will take years.
+ Until then we need to strip whitespace in between multiple
+ adjacent encoded words, while passing through newlines and
+ whitespace that follows newlines, regardless of whatever.
+ I hope this will do it until we are sane.
+---
+ mime.c | 63 +++++++++++++++++++++++++++++++++++++++------------------------
+ 1 file changed, 39 insertions(+), 24 deletions(-)
+
+diff --git a/mime.c b/mime.c
+index ccb0061..6ee55cc 100644
+--- a/mime.c
++++ b/mime.c
+@@ -863,20 +863,26 @@ jclear:
+ goto jleave;
+ }
+
+-/*
+- * Convert header fields from RFC 1522 format
+- * TODO mime_fromhdr(): NO error handling, fat; REWRITE **ASAP**
+- */
+ FL void
+ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ {
+- /* TODO mime_fromhdr(): is called with strings that contain newlines;
+- * TODO this is the usual newline problem all around the codebase;
+- * TODO i.e., if we strip it, then the display misses it ;} */
++ /* TODO mime_fromhdr(): is called with strings that contain newlines;
++ * TODO this is the usual newline problem all around the codebase;
++ * TODO i.e., if we strip it, then the display misses it ;>
++ * TODO this is why it is so messy and why S-nail v14.2 plus additional
++ * TODO patch for v14.5.2 (and maybe even v14.5.3 subminor) occurred, and
++ * TODO why our display reflects what is contained in the message: the 1:1
++ * TODO relationship of message content and display!
++ * TODO instead a header line should be decoded to what it is (a single
++ * TODO line that is) and it should be objective to the backend wether
++ * TODO it'll be folded to fit onto the display or not, e.g., for search
++ * TODO purposes etc. then the only condition we have to honour in here
++ * TODO is that whitespace in between multiple adjacent MIME encoded words
++ * TODO á la RFC 2047 is discarded; i.e.: this function should deal with
++ * TODO RFC 2047 and be renamed: mime_fromhdr() -> mime_rfc2047_decode() */
+ struct str cin, cout;
+ char *p, *op, *upper, *cs, *cbeg;
+- int convert;
+- size_t lastoutl = (size_t)-1;
++ ui32_t convert, lastenc, lastoutl;
+ #ifdef HAVE_ICONV
+ char const *tcs;
+ iconv_t fhicd = (iconv_t)-1;
+@@ -894,6 +900,7 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ #endif
+ p = in->s;
+ upper = p + in->l;
++ lastenc = lastoutl = 0;
+
+ while (p < upper) {
+ op = p;
+@@ -949,8 +956,7 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ --cout.l;
+ } else
+ (void)qp_decode(&cout, &cin, NULL);
+- if (lastoutl != (size_t)-1)
+- out->l = lastoutl;
++ out->l = lastenc;
+ #ifdef HAVE_ICONV
+ if ((flags & TD_ICONV) && fhicd != (iconv_t)-1) {
+ cin.s = NULL, cin.l = 0; /* XXX string pool ! */
+@@ -966,21 +972,30 @@ mime_fromhdr(struct str const *in, struct str *out, enum tdflags flags)
+ #ifdef HAVE_ICONV
+ }
+ #endif
+- lastoutl = out->l;
++ lastenc = lastoutl = out->l;
+ free(cout.s);
+- } else {
+-jnotmime:
+- p = op;
+- convert = 1;
+- while ((op = p + convert) < upper &&
+- (op[0] != '=' || op[1] != '?'))
+- ++convert;
+- out = n_str_add_buf(out, p, convert);
+- p += convert;
+- if (! blankchar(p[-1]))
+- lastoutl = (size_t)-1;
+- }
++ } else
++jnotmime: {
++ bool_t onlyws;
++
++ p = op;
++ onlyws = (lastenc > 0);
++ for (;;) {
++ if (++op == upper)
++ break;
++ if (op[0] == '=' && (PTRCMP(op + 1, ==, upper) || op[1] == '?'))
++ break;
++ if (onlyws && !blankchar(*op))
++ onlyws = FAL0;
++ }
++
++ out = n_str_add_buf(out, p, PTR2SIZE(op - p));
++ p = op;
++ if (!onlyws || lastoutl != lastenc)
++ lastenc = out->l;
++ lastoutl = out->l;
+ }
++ }
+ out->s[out->l] = '\0';
+
+ if (flags & TD_ISPR) {
Copied: s-nail/repos/testing-x86_64/sort.patch (from rev 205831, s-nail/trunk/sort.patch)
===================================================================
--- testing-x86_64/sort.patch (rev 0)
+++ testing-x86_64/sort.patch 2014-02-11 04:42:52 UTC (rev 205832)
@@ -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];
More information about the arch-commits
mailing list