[mutt] 01/01: upstream/569038-interrupt-socket-read-write.patch: allow the interruption of operations which can be long-running (Closes: 569038, 774746, 423931, 599136, 618425).

Antonio Radici antonio at moszumanska.debian.org
Tue Sep 6 20:51:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

antonio pushed a commit to branch master
in repository mutt.

commit ece2b56e937ec1328703b1054413412c15358305
Author: Antonio Radici <antonio at debian.org>
Date:   Mon Sep 5 21:17:08 2016 +0100

    upstream/569038-interrupt-socket-read-write.patch: allow the interruption of operations which can be long-running (Closes: 569038, 774746, 423931, 599136, 618425).
---
 debian/changelog                                   |   3 +
 debian/patches/series                              |   1 +
 .../569038-interrupt-socket-read-write.patch       | 116 +++++++++++----------
 3 files changed, 66 insertions(+), 54 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9e0357b..287d4d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,9 @@ mutt (1.7.0-2) UNRELEASED; urgency=medium
       flag on readonly IMAP mailboxes (Closes: 549204).
     + neomutt-devel/832971-reset-xlabel.patch to reset X-Label properly for
       newer versions of mutt (Closes: 832971).
+    + upstream/569038-interrupt-socket-read-write.patch: allow the interruption
+      of operations which can be long-running
+      (Closes: 569038, 774746, 423931, 599136, 618425).
   * debian/extra/rc/notmuch.rc: restored the notmuch keybindings
     (Closes: 836148).
 
diff --git a/debian/patches/series b/debian/patches/series
index 4a21d5a..4466cb6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -14,6 +14,7 @@ misc/smime.rc.patch
 upstream/528233-readonly-open.patch
 upstream/228671-pipe-mime.patch
 upstream/383769-score-match.patch
+upstream/569038-interrupt-socket-read-write.patch
 upstream/771125-CVE-2014-9116-jessie.patch
 upstream/611410-no-implicit_autoview-for-text-html.patch
 upstream/835421-pop-digest-md5.patch
diff --git a/debian/patches/upstream/569038-interrupt-socket-read-write.patch b/debian/patches/upstream/569038-interrupt-socket-read-write.patch
index 7fecf28..8a81a9d 100644
--- a/debian/patches/upstream/569038-interrupt-socket-read-write.patch
+++ b/debian/patches/upstream/569038-interrupt-socket-read-write.patch
@@ -1,6 +1,3 @@
-Note: this patch is still a WIP, it is not enabled yet, for info contact
-antonio at debian.org
-
 Prevent mutt from hanging on some I/O calls which are blocking, this should
 solve the following Debian bugs:
       
@@ -54,17 +51,33 @@ http://bugs.debian.org/774746
  }
 --- a/sendlib.c
 +++ b/sendlib.c
-@@ -274,6 +274,9 @@
+@@ -274,6 +274,10 @@
  
    while ((ch = fgetconv (fc)) != EOF)
    {
 +    if (SigInt == 1) {
++      SigInt = 0;
 +      return;
 +    }
      if (istext && ch == '\n' && ch1 != '\r')
        b64_putc('\r', fout);
      b64_putc(ch, fout);
-@@ -465,6 +468,7 @@
+@@ -287,8 +291,13 @@
+ {
+   int ch;
+ 
+-  while ((ch = fgetconv (fc)) != EOF)
++  while ((ch = fgetconv (fc)) != EOF) {
++    if (SigInt == 1) {
++      SigInt = 0;
++      return;
++    }
+     fputc (ch, fout);
++  }
+ }
+ 
+ 
+@@ -465,6 +474,7 @@
    else
      fc = fgetconv_open (fpin, 0, 0, 0);
  
@@ -72,7 +85,7 @@ http://bugs.debian.org/774746
    if (a->encoding == ENCQUOTEDPRINTABLE)
      encode_quoted (fc, f, write_as_text_part (a));
    else if (a->encoding == ENCBASE64)
-@@ -473,10 +477,15 @@
+@@ -473,10 +483,15 @@
      encode_8bit (fc, f, write_as_text_part (a));
    else
      mutt_copy_stream (fpin, f);
@@ -121,68 +134,37 @@ http://bugs.debian.org/774746
  }
 --- a/mutt_ssl_gnutls.c
 +++ b/mutt_ssl_gnutls.c
-@@ -20,6 +20,7 @@
- # include "config.h"
- #endif
- 
-+#include <fcntl.h>
- #include <gnutls/gnutls.h>
- #include <gnutls/x509.h>
- #ifdef HAVE_GNUTLS_OPENSSL_H
-@@ -92,7 +93,6 @@
- static int tls_negotiate (CONNECTION* conn);
- static int tls_check_certificate (CONNECTION* conn);
- 
--
- static int tls_init (void)
- {
-   static unsigned char init_complete = 0;
-@@ -139,16 +139,17 @@
-     return -1;
-   }
+@@ -141,14 +141,16 @@
  
--  do {
--    ret = gnutls_record_recv (data->state, buf, len);
+   do {
+     ret = gnutls_record_recv (data->state, buf, len);
 -    if (ret < 0 && gnutls_error_is_fatal(ret) == 1)
--    {
--      mutt_error ("tls_socket_read (%s)", gnutls_strerror (ret));
++    if ((ret < 0 &&
++         gnutls_error_is_fatal(ret) == 1) ||
++        ret == GNUTLS_E_INTERRUPTED
++       )
+     {
+       mutt_error ("tls_socket_read (%s)", gnutls_strerror (ret));
 -      mutt_sleep (4);
--      return -1;
--    }
-+  ret = gnutls_record_recv (data->state, buf, len);
-+  if (ret < 0 &&
-+      (gnutls_error_is_fatal(ret) == 1 ||
-+       ret == GNUTLS_E_AGAIN ||
-+       ret == GNUTLS_E_INTERRUPTED)
-+     )
-+  {
-+    mutt_error ("tls_socket_read (%s)", gnutls_strerror (ret));
-+    mutt_sleep (4);
-+    return -1;
-   }
++      mutt_sleep (2);
+       return -1;
+     }
+-  }
 -  while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
++  } while (ret == GNUTLS_E_AGAIN);
  
    return ret;
  }
-@@ -171,7 +172,7 @@
+@@ -171,7 +173,7 @@
      ret = gnutls_record_send (data->state, buf + sent, len - sent);
      if (ret < 0)
      {
 -      if (gnutls_error_is_fatal(ret) == 1)
-+      if (gnutls_error_is_fatal(ret) == 1 || ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN)
++      if (gnutls_error_is_fatal(ret) == 1 || ret == GNUTLS_E_INTERRUPTED)
        {
  	mutt_error ("tls_socket_write (%s)", gnutls_strerror (ret));
  	mutt_sleep (4);
-@@ -407,7 +408,7 @@
-   gnutls_certificate_set_verify_flags(data->xcred, GNUTLS_VERIFY_DISABLE_TIME_CHECKS);
- #endif
- 
--  if ((err = gnutls_init(&data->state, GNUTLS_CLIENT)))
-+  if ((err = gnutls_init(&data->state, GNUTLS_CLIENT|GNUTLS_NONBLOCK)))
-   {
-     mutt_error ("gnutls_handshake: %s", gnutls_strerror(err));
-     mutt_sleep (2);
-@@ -434,7 +435,7 @@
+@@ -434,7 +436,7 @@
  
    err = gnutls_handshake(data->state);
  
@@ -191,3 +173,29 @@ http://bugs.debian.org/774746
    {
      err = gnutls_handshake(data->state);
    }
+--- a/imap/command.c
++++ b/imap/command.c
+@@ -242,9 +242,12 @@
+   if (flags & IMAP_CMD_QUEUE)
+     return 0;
+ 
++  // Allow interruptions, particularly useful if there are network problems.
++  mutt_allow_interrupt (1);
+   do
+     rc = imap_cmd_step (idata);
+   while (rc == IMAP_CMD_CONTINUE);
++  mutt_allow_interrupt (0);
+ 
+   if (rc == IMAP_CMD_NO && (flags & IMAP_CMD_FAIL_OK))
+     return -2;
+--- a/mx.c
++++ b/mx.c
+@@ -1423,7 +1423,7 @@
+ /* check for new mail */
+ int mx_check_mailbox (CONTEXT *ctx, int *index_hint)
+ {
+-  if (!ctx)
++  if (!ctx || ctx->magic == 0)
+   {
+     dprint (1, (debugfile, "mx_check_mailbox: null or invalid context.\n"));
+     return -1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mutt/mutt.git



More information about the pkg-mutt-commits mailing list