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

From: "David J. Biesack" <[email-masked]>
Date: Thu, 13 Aug 2009 11:52:00 -0400

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

rmail-view and rmail mime support (on an mbox mail file) does
not properly decode multi-part mime attachments.

I composed mail to myself from MS Outlook in HTML format (with an embedded image) and attached three .doc attachments (plain text files with .doc extension, not MS Word docs, so that the file and attachments would be smaller).

In RMAIL, I fetched mail then used v to view/decode the mime.
The *RMAIL* buffer shows incomplete processing of the attachments.

* the "Attached " buttons do not have actions on them
* the buttons also do not have newlines after them; they "run into" the next attachment
* two of the attachments were not processed at all.

It looks like it is not finding the attachment boundaries correctly
or deleting too much whitespace when decoding an attachment.

I started Emacs with the -q option so my .emacs is not affecting this.

Below, I include the raw mail text with all headers and the *RMAIL* buffer,
separated by "8<------8<------8<------8<------8<------8<------8<------8<------"
markers.

In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-30 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t

Recent input:
C-x C-f <backspace> <backspace> <backspace> u : / r 
m a i l / R M A I L <return> M-x r m a i l - m o d 
e <return> v M-x r e p p o r t <backspace> <backspace> 
<backspace> <backspace> SPC o SPC r t - e SPC b SPC 
<return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Counting messages...done
View mode: type C-h for help, h for commands, q to quit.
Making completion list... [2 times]

8<------8<------8<------8<------8<------8<------8<------8<------

below is the RMAIL buffer with headers

8<------8<------8<------8<------8<------8<------8<------8<------
>From [email-masked] Thu Aug 13 11:35:28 2009
From: David Biesack <[email-masked]>
To: David Biesack <[email-masked]>
Date: Thu, 13 Aug 2009 11:35:24 -0400
Subject: test rmail
Accept-Language: en-US
acceptlanguage: en-US

--_008_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: multipart/related;
        boundary="_007_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_";
        type="multipart/alternative"

--_007_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: multipart/alternative;
        boundary="_000_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_"

--_000_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

This is an HTML mail message with attachments. It also contains an inline i=
mage

It also contains an inline image

--_000_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"=
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"2050" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoPlainText><i><span style=3D'font-family:"Arial","sans-serif"'=
>This is
an <b>HTML</b> mail message with attachments. It also contains an inline im=
age<o:p></o:p></span></i></p>

<p class=3DMsoPlainText><span style=3D'font-family:"Arial","sans-serif"'><i=
mg
width=3D64 height=3D64 id=3D"Picture_x0020_0" src=3D"cid:image001.png@01CA1=
C0A.26098810"
alt=3D"user_female.png"></span><span style=3D'font-family:"Arial","sans-ser=
if"'><o:p></o:p></span></p>

<p class=3DMsoPlainText><i><span style=3D'font-family:"Arial","sans-serif"'=
>It also
contains an inline image<o:p></o:p></span></i></p>

<p class=3DMsoPlainText><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

--_000_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_--

--_007_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: image/png; name="image001.png"
Content-Description: image001.png
Content-Disposition: inline; filename="image001.png"; size=4099;
        creation-date="Thu, 13 Aug 2009 11:35:26 GMT";
        modification-date="Thu, 13 Aug 2009 11:35:26 GMT"
Content-ID: <[email-masked]>
Content-Transfer-Encoding: base64

--_007_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_--

--_008_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: application/msword; name="Attachment 1.doc"
Content-Description: Attachment 1.doc
Content-Disposition: attachment; filename="Attachment 1.doc"; size=294;
        creation-date="Thu, 13 Aug 2009 11:10:03 GMT";
        modification-date="Thu, 13 Aug 2009 11:34:56 GMT"
Content-Transfer-Encoding: base64

QXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpB
dHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0
dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0
YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRh
Y2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFj
aG1lbnQgMQ0K

--_008_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: application/msword; name="Attachment 2.doc"
Content-Description: Attachment 2.doc
Content-Disposition: attachment; filename="Attachment 2.doc"; size=336;
        creation-date="Thu, 13 Aug 2009 11:10:16 GMT";
        modification-date="Thu, 13 Aug 2009 11:34:51 GMT"
Content-Transfer-Encoding: base64

QXR0YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0dGFjaG1lbnQgMg0KQXR0YWNobWVudCAyDQpB
dHRhY2htZW50IDINCkF0dGFjaG1lbnQgMg0KQXR0YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0
dGFjaG1lbnQgMg0KQXR0YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0dGFjaG1lbnQgMg0KQXR0
YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0dGFjaG1lbnQgMg0KQXR0YWNobWVudCAyDQpBdHRh
Y2htZW50IDINCkF0dGFjaG1lbnQgMg0KQXR0YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0dGFj
aG1lbnQgMg0KQXR0YWNobWVudCAyDQpBdHRhY2htZW50IDINCkF0dGFjaG1lbnQgMg0K

--_008_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_
Content-Type: application/msword; name="Attachment 3.doc"
Content-Description: Attachment 3.doc
Content-Disposition: attachment; filename="Attachment 3.doc"; size=476;
        creation-date="Thu, 13 Aug 2009 11:10:44 GMT";
        modification-date="Thu, 13 Aug 2009 11:34:45 GMT"
Content-Transfer-Encoding: base64

--_008_BBA15439DC467648BBAB71E6BA4D990038F3B122E6MERCMBX12nasa_--

8<------8<------8<------8<------8<------8<------8<------8<------

Below is the resulting *RMAIL* buffer after using rmail-view

8<------8<------8<------8<------8<------8<------8<------8<------

Attached image/png file: image001.pngContent-Type: application/msword; name="Attachment 1.doc"
Content-Description: Attachment 1.doc
Content-Disposition: attachment; filename="Attachment 1.doc"; size=294;
        creation-date="Thu, 13 Aug 2009 11:10:03 GMT";
        modification-date="Thu, 13 Aug 2009 11:34:56 GMT"
Content-Transfer-Encoding: base64

QXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpB
dHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0
dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0
YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRh
Y2htZW50IDENCkF0dGFjaG1lbnQgMQ0KQXR0YWNobWVudCAxDQpBdHRhY2htZW50IDENCkF0dGFj
aG1lbnQgMQ0K
Attached application/msword file: Attachment 2.docContent-Type: application/msword; name="Attachment 3.doc"
Content-Description: Attachment 3.doc
Content-Disposition: attachment; filename="Attachment 3.doc"; size=476;
        creation-date="Thu, 13 Aug 2009 11:10:44 GMT";
        modification-date="Thu, 13 Aug 2009 11:34:45 GMT"
Content-Transfer-Encoding: base64

8<------8<------8<------8<------8<------8<------8<------8<------

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