git: 42eb119b4aa4 - main - mail/mailutils: update the port to version 3.15 (and slightly beyond)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sat, 09 Jul 2022 14:49:57 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=42eb119b4aa4f11ca58e7b8c929c2e5fecf84ab4

commit 42eb119b4aa4f11ca58e7b8c929c2e5fecf84ab4
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-07-09 14:49:24 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-07-09 14:49:24 +0000

    mail/mailutils: update the port to version 3.15 (and slightly beyond)
    
    Particularly, pull the necessary parts of three upstream patches to
    fix some annoying regressions discovered after the release went gold.
    While here, chase HTTP/1.1 301 Moved Permanently redirection in the
    WWW line of the port description.
    
    Prodded by:     maintainer
---
 mail/mailutils/Makefile                            |  4 +-
 mail/mailutils/distinfo                            |  6 +--
 .../patch-libmailutils_stream_rdcache__stream.c    | 55 ++++++++++++++++++++++
 .../files/patch-libmailutils_stream_stream.c       | 10 ++++
 .../files/patch-libmailutils_stream_streamcpy.c    | 14 ++++++
 mail/mailutils/files/patch-mh_folder.c             | 17 +++++++
 mail/mailutils/files/patch-mh_msgchk.c             | 24 ++++++++++
 mail/mailutils/pkg-descr                           |  2 +-
 mail/mailutils/pkg-plist                           |  5 +-
 9 files changed, 130 insertions(+), 7 deletions(-)

diff --git a/mail/mailutils/Makefile b/mail/mailutils/Makefile
index b3a61bbeb16e..47c03a722ce3 100644
--- a/mail/mailutils/Makefile
+++ b/mail/mailutils/Makefile
@@ -1,7 +1,7 @@
 # Created by: Attila Nagy <bra@fsn.hu>
 
 PORTNAME=	mailutils
-PORTVERSION=	3.13
+PORTVERSION=	3.15
 CATEGORIES=	mail
 MASTER_SITES=	GNU GNU_ALPHA
 
@@ -25,7 +25,7 @@ TEST_TARGET=	check
 
 CONFLICTS_INSTALL=	avenger elm # bin/dotlock bin/frm
 
-PLIST_SUB+=	LIBVERSION=8.0.0 LIBSUFX=8 VERSION=${PORTVERSION}
+PLIST_SUB+=	LIBVERSION=9.0.0 LIBSUFX=9 VERSION=${PORTVERSION}
 
 INFO=		${PORTNAME}
 PORTDOCS=	AUTHORS ChangeLog NEWS README* THANKS TODO
diff --git a/mail/mailutils/distinfo b/mail/mailutils/distinfo
index 99cbd03b4a1a..d1e10c51e40f 100644
--- a/mail/mailutils/distinfo
+++ b/mail/mailutils/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1628162648
-SHA256 (mailutils-3.13.tar.xz) = d920971dcb49878a009911774fd6404f13d27bd101e2d59b664a28659a4094c7
-SIZE (mailutils-3.13.tar.xz) = 3152892
+TIMESTAMP = 1650221916
+SHA256 (mailutils-3.15.tar.xz) = b7d0c286c352fcc7da7978cfd617cc66736b21fa891aa4f88855f516354f2ddb
+SIZE (mailutils-3.15.tar.xz) = 3112212
diff --git a/mail/mailutils/files/patch-libmailutils_stream_rdcache__stream.c b/mail/mailutils/files/patch-libmailutils_stream_rdcache__stream.c
new file mode 100644
index 000000000000..1f02934ffa53
--- /dev/null
+++ b/mail/mailutils/files/patch-libmailutils_stream_rdcache__stream.c
@@ -0,0 +1,55 @@
+--- libmailutils/stream/rdcache_stream.c.orig	2022-02-12 15:20:43 UTC
++++ libmailutils/stream/rdcache_stream.c
+@@ -21,10 +21,9 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <mailutils/types.h>
++#include <mailutils/errno.h>
+ #include <mailutils/sys/rdcache_stream.h>
+ 
+-size_t mu_rdcache_stream_max_memory_size = 4096;
+-
+ static int
+ rdcache_read (struct _mu_stream *str, char *buf, size_t size, size_t *pnbytes)
+ {
+@@ -38,7 +37,6 @@ rdcache_read (struct _mu_stream *str, char *buf, size_
+       if (status)
+ 	return status;
+       sp->offset += nbytes;
+-      sp->size += nbytes;
+       buf += nbytes;
+       size -= nbytes;
+     }
+@@ -79,11 +77,29 @@ static int
+ }
+ 
+ static int
+-rdcache_size (struct _mu_stream *str, off_t *psize)
++rdcache_size (struct _mu_stream *str, mu_off_t *psize)
+ {
+   struct _mu_rdcache_stream *sp = (struct _mu_rdcache_stream *) str;
+-  *psize = sp->size;
+-  return 0;
++  int rc;
++
++  if (mu_stream_eof (sp->transport))
++    {
++      *psize = sp->size;
++      rc = 0;
++    }
++  else
++    {
++      rc = mu_stream_size (sp->transport, psize);
++      switch (rc)
++	{
++	case EAGAIN:
++	case EINTR:
++	case ENOSYS:
++	case EINPROGRESS:
++	  rc = MU_ERR_INFO_UNAVAILABLE;
++	}
++    }
++  return rc;
+ }
+ 
+ static int
diff --git a/mail/mailutils/files/patch-libmailutils_stream_stream.c b/mail/mailutils/files/patch-libmailutils_stream_stream.c
new file mode 100644
index 000000000000..613b4a46ae51
--- /dev/null
+++ b/mail/mailutils/files/patch-libmailutils_stream_stream.c
@@ -0,0 +1,10 @@
+--- libmailutils/stream/stream.c.orig	2022-02-12 15:20:43 UTC
++++ libmailutils/stream/stream.c
+@@ -132,6 +132,7 @@ mu_stream_seterr (struct _mu_stream *stream, int code,
+     case EINTR:
+     case ENOSYS:
+     case EINPROGRESS:
++    case MU_ERR_INFO_UNAVAILABLE:
+       break;
+ 
+     default:
diff --git a/mail/mailutils/files/patch-libmailutils_stream_streamcpy.c b/mail/mailutils/files/patch-libmailutils_stream_streamcpy.c
new file mode 100644
index 000000000000..526af4f23266
--- /dev/null
+++ b/mail/mailutils/files/patch-libmailutils_stream_streamcpy.c
@@ -0,0 +1,14 @@
+--- libmailutils/stream/streamcpy.c.orig	2022-02-12 15:20:43 UTC
++++ libmailutils/stream/streamcpy.c
+@@ -55,7 +55,11 @@ mu_stream_copy_wcb (mu_stream_t dst, mu_stream_t src, 
+ 	case 0:
+ 	  break;
+ 
++	case EAGAIN:
++	case EINTR:
+ 	case ENOSYS:
++	case EINPROGRESS:
++	case MU_ERR_INFO_UNAVAILABLE:
+ 	  size = 0;
+ 	  break;
+ 
diff --git a/mail/mailutils/files/patch-mh_folder.c b/mail/mailutils/files/patch-mh_folder.c
new file mode 100644
index 000000000000..461e6fdddb08
--- /dev/null
+++ b/mail/mailutils/files/patch-mh_folder.c
@@ -0,0 +1,17 @@
+--- mh/folder.c.orig	2022-02-12 15:20:43 UTC
++++ mh/folder.c
+@@ -806,6 +806,14 @@ action_pack (void)
+       mu_error (_("cannot read input mailbox: %s"), mu_strerror (errno));
+       return 1;
+     }
++
++  if (count == 0)
++    {
++      mu_mailbox_close (mbox);
++      mu_mailbox_destroy (&mbox);
++      return 0;
++    }
++  
+   pack_tab = mu_calloc (count, sizeof pack_tab[0]); /* Never freed. No use to
+ 		 				       try to. */
+ 
diff --git a/mail/mailutils/files/patch-mh_msgchk.c b/mail/mailutils/files/patch-mh_msgchk.c
new file mode 100644
index 000000000000..351be084a9d2
--- /dev/null
+++ b/mail/mailutils/files/patch-mh_msgchk.c
@@ -0,0 +1,24 @@
+--- mh/msgchk.c.orig	2022-02-12 15:20:43 UTC
++++ mh/msgchk.c
+@@ -274,12 +274,18 @@ checkmail (const char *username, int personal)
+ 	      break;
+ 
+ 	    default:
+-	      if (rc != ENOSYS && rc != MU_ERR_INFO_UNAVAILABLE)
+-		mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen",
+-				 mu_url_to_string (url), rc);
++	      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_messages_unseen",
++			       mu_url_to_string (url), rc);
++	      /* FALLTHROUGH */
++	    case EAGAIN:
++	    case EINTR:
++	    case ENOSYS:
++	    case EINPROGRESS:
++	    case MU_ERR_INFO_UNAVAILABLE:
+ 	      rc = mu_mailbox_messages_recent (mbox, &recent);
+ 	      if (rc == 0)
+ 		newmail = recent > 0;
++	      break;
+ 	    }
+ 
+ 	  if (rc)
diff --git a/mail/mailutils/pkg-descr b/mail/mailutils/pkg-descr
index 09eb1baab0ee..a3e276ccb59f 100644
--- a/mail/mailutils/pkg-descr
+++ b/mail/mailutils/pkg-descr
@@ -7,4 +7,4 @@ format, ranging from standard Unix maildrops, through maildir and up to
 remote mailboxes, which are transparently accessed using IMAP4, POP3,
 and SMTP.
 
-WWW: http://mailutils.org/
+WWW: https://mailutils.org/
diff --git a/mail/mailutils/pkg-plist b/mail/mailutils/pkg-plist
index 163f6f9094b2..865dfd51e325 100644
--- a/mail/mailutils/pkg-plist
+++ b/mail/mailutils/pkg-plist
@@ -91,6 +91,7 @@ include/mailutils/md5.h
 include/mailutils/message.h
 include/mailutils/mh.h
 include/mailutils/mime.h
+include/mailutils/mimetypes.h
 include/mailutils/monitor.h
 include/mailutils/msgset.h
 include/mailutils/mu_auth.h
@@ -146,6 +147,7 @@ include/mailutils/sys/memory_stream.h
 include/mailutils/sys/message.h
 include/mailutils/sys/message_stream.h
 include/mailutils/sys/mime.h
+include/mailutils/sys/mimetypes.h
 include/mailutils/sys/monitor.h
 include/mailutils/sys/msgset.h
 include/mailutils/sys/nullstream.h
@@ -164,8 +166,8 @@ include/mailutils/sys/temp_file_stream.h
 include/mailutils/sys/temp_stream.h
 include/mailutils/sys/tls-stream.h
 include/mailutils/sys/url.h
-include/mailutils/sys/xscript-stream.h
 include/mailutils/sys/wordsplit.h
+include/mailutils/sys/xscript-stream.h
 include/mailutils/syslog.h
 include/mailutils/tls.h
 include/mailutils/types.h
@@ -355,6 +357,7 @@ share/aclocal/mailutils.m4
 %%NLS%%share/locale/pt_BR/LC_MESSAGES/mailutils.mo
 %%NLS%%share/locale/ro/LC_MESSAGES/mailutils.mo
 %%NLS%%share/locale/ru/LC_MESSAGES/mailutils.mo
+%%NLS%%share/locale/sr/LC_MESSAGES/mailutils.mo
 %%NLS%%share/locale/sv/LC_MESSAGES/mailutils.mo
 %%NLS%%share/locale/uk/LC_MESSAGES/mailutils.mo
 %%NLS%%share/locale/vi/LC_MESSAGES/mailutils.mo