tags 569279 - moreinfo + patch
thanks

This crash is caused by debian patch 228671-pipe-mime.patch, cited below:

,----[ 228671-pipe-mime.patch ]
| Don't draw imap fetch progress if we aren't in visual mode.
| Drawing progress leaves terminal in confusing state when piping a message
| from pager to less(1). See http://bugs.mutt.org/1771
|
| --- a/imap/message.c
| +++ b/imap/message.c
| @@ -489,8 +489,9 @@
|           imap_error ("imap_fetch_message()", buf);
|           goto bail;
|         }
| -       mutt_progress_init (&progressbar, _("Fetching message..."),
| -                           M_PROGRESS_SIZE, NetInc, bytes);
| +          if (!isendwin())
| +         mutt_progress_init (&progressbar, _("Fetching message..."),
| +                           M_PROGRESS_SIZE, NetInc, bytes);
|         if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0)
|           goto bail;
|         /* pick up trailing line */
`----

When piping messages, isendwin() is true; with the above patch, the
progressbar struct is not initialized, but subsequently used by
imap_read_literal(), causing the crash.

I am attaching a fixed version of this debian patch file, preserving the
indented behaviour.  It is equivalent to applying the following patch to
the current, fully patched source:

Index: mutt-1.5.20/imap/message.c
===================================================================
--- mutt-1.5.20.orig/imap/message.c     2010-03-23 19:30:03.000000000 +0100
+++ mutt-1.5.20/imap/message.c  2010-03-23 19:35:28.000000000 +0100
@@ -392,7 +392,7 @@
   char path[_POSIX_PATH_MAX];
   char *pc;
   long bytes;
-  progress_t progressbar;
+  progress_t progressbar, *pbar;
   int uid;
   int cacheno;
   IMAP_CACHE *cache;
@@ -489,10 +489,15 @@
            imap_error ("imap_fetch_message()", buf);
            goto bail;
          }
-          if (!isendwin())
+         if (!isendwin())
+         {
            mutt_progress_init (&progressbar, _("Fetching message..."),
                              M_PROGRESS_SIZE, NetInc, bytes);
-         if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0)
+           pbar = &progressbar;
+         }
+         else
+           pbar = NULL;
+         if (imap_read_literal (msg->fp, idata, bytes, pbar) < 0)
            goto bail;
          /* pick up trailing line */
          if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE)


Nikolaus
Don't draw imap fetch progress if we aren't in visual mode.
Drawing progress leaves terminal in confusing state when piping a message
from pager to less(1). See http://bugs.mutt.org/1771

Index: mutt-1.5.20/imap/message.c
===================================================================
--- mutt-1.5.20.orig/imap/message.c	2010-03-23 17:46:39.000000000 +0100
+++ mutt-1.5.20/imap/message.c	2010-03-23 18:30:19.000000000 +0100
@@ -392,7 +392,7 @@
   char path[_POSIX_PATH_MAX];
   char *pc;
   long bytes;
-  progress_t progressbar;
+  progress_t progressbar, *pbar;
   int uid;
   int cacheno;
   IMAP_CACHE *cache;
@@ -489,9 +489,15 @@
 	    imap_error ("imap_fetch_message()", buf);
 	    goto bail;
 	  }
-	  mutt_progress_init (&progressbar, _("Fetching message..."),
-			      M_PROGRESS_SIZE, NetInc, bytes);
-	  if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0)
+	  if (!isendwin())
+	  {
+	    mutt_progress_init (&progressbar, _("Fetching message..."),
+	   		      M_PROGRESS_SIZE, NetInc, bytes);
+	    pbar = &progressbar;
+	  }
+	  else
+	    pbar = NULL;
+	  if (imap_read_literal (msg->fp, idata, bytes, pbar) < 0)
 	    goto bail;
 	  /* pick up trailing line */
 	  if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE)

Reply via email to