Subject: bug#4139: 23.1; rmailmm fails on multi-part messages (path)

From: "David J. Biesack" <[email-masked]>
Date: Thu, 13 Aug 2009 12:43:08 -0400

I found that the bug is easier to reproduce with sending
plain text (no HTML) and simply 2 or 3 attachements.

I debugged and found that the original code
was deleting the delimiter of the next attachment
so it was skipping it.

below is a patch

-- 
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com    (919) 531-7771

$ diff -csw rmailmm.el.orig rmailmm.el
*** rmailmm.el.orig     Thu Aug 13 11:54:46 2009
--- rmailmm.el  Thu Aug 13 12:26:22 2009
***************
*** 194,200 ****
    ;;    of the preceding part.
    ;; We currently don't handle that.
    (let ((boundary (cdr (assq 'boundary content-type)))
!       beg end next)
      (unless boundary
        (rmail-mm-get-boundary-error-message
         "No boundary defined" content-type content-disposition
--- 194,200 ----
    ;;    of the preceding part.
    ;; We currently don't handle that.
    (let ((boundary (cdr (assq 'boundary content-type)))
!       beg end end-delim next)
      (unless boundary
        (rmail-mm-get-boundary-error-message
         "No boundary defined" content-type content-disposition
***************
*** 212,218 ****
      ;; the beginning of the next part.
      (setq beg (point-min))
      (while (search-forward boundary nil t)
!       (setq end (match-beginning 0))
        ;; If this is the last boundary according to RFC 2046, hide the
        ;; epilogue, else hide the boundary only.  Use a marker for
        ;; `next' because `rmail-mime-show' may change the buffer.
--- 212,219 ----
      ;; the beginning of the next part.
      (setq beg (point-min))
      (while (search-forward boundary nil t)
!       (setq end (match-beginning 0)
!             end-delim (match-end 0))
        ;; If this is the last boundary according to RFC 2046, hide the
        ;; epilogue, else hide the boundary only.  Use a marker for
        ;; `next' because `rmail-mime-show' may change the buffer.
***************
*** 224,230 ****
             (rmail-mm-get-boundary-error-message
              "Malformed boundary" content-type content-disposition
              content-transfer-encoding)))
!       (delete-region end next)
        ;; Handle the part.
        (save-match-data
        (save-excursion
--- 225,231 ----
             (rmail-mm-get-boundary-error-message
              "Malformed boundary" content-type content-disposition
              content-transfer-encoding)))
!       (delete-region end-delim next)
        ;; Handle the part.
        (save-match-data
        (save-excursion
***************
*** 232,238 ****
            (narrow-to-region beg end)
            (rmail-mime-show))))
        (setq beg next)
!       (goto-char beg))))
  
  (defun test-rmail-mime-multipart-handler ()
    "Test of a mail used as an example in RFC 2046."
--- 233,242 ----
            (narrow-to-region beg end)
            (rmail-mime-show))))
        (setq beg next)
!       (goto-char beg)
!       (beginning-of-line 1)
!       (delete-region (point) beg)
!       (setq beg (point)))))
  
  (defun test-rmail-mime-multipart-handler ()
    "Test of a mail used as an example in RFC 2046."