Subject: bug#9862: 23.3; [Gnus/EasyPG] Mixing PGP/MIME signature with RFC822 forwarded multipart message results in an invalid MIME message

From: "S\=e9bastien Villemot" <[email-masked]>
Date: Mon, 24 Oct 2011 22:36:13 +0200

Dear Emacs maintainers,

This is Debian bug #608279 (http://bugs.debian.org/608279).

If I try to send the following e-mail with Gnus (using MML syntax):

 <#secure method=pgpmime mode=sign>

-

Then the message generated by Gnus does not respect MIME
conventions. The boundary string used for the top-level multipart is the
same than the boundary string used for the innermost multipart (see
below for the generated message).

In real life, this problem pops up when I forward multipart messages and
that at the same time I sign my forwarded message.

This is quite annoying since recipients either cannot decode the message
or do not see all the MIME parts, depending on how their mail reader
deals with invalid messages.

Here is the message generated by the above MML syntax (look at the 1st
and 3rd MIME boundaries, they are identical):

------------------------->8----------------------------

From: [email-masked]
To: [email-masked]
Subject: Test
Date: Wed, 29 Dec 2010 17:14:59 +0100
Message-ID: <[email-masked]>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="====-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"

--====-=-=
Content-Type: multipart/mixed; boundary="==-=-="

--==-=-=
Content-Type: message/rfc822
Content-Disposition: inline

--====-=-=
Content-Disposition: inline
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="====-=-="

Foo

--====-=-=--

--==-=-=--

--====-=-=
Content-Type: application/pgp-signature

--====-=-=--

------------------------->8----------------------------

Thanks,

In GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.6)
 of 2011-09-09 on spike.0x539.de, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11101000
configured using `configure  '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.3/leim' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

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: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Article

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

Recent input:
C-p C-p <return> h <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <next> n q <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <up> M-g <return> 
q m C-n C-n C-n C-n C-n C-y C-p C-p C-p C-p C-p C-p 
C-p C-a C-k C-k C-p C-p C-p C-p C-e s e b a s t i e 
n @ i <backspace> v i l l e m o t . n a m e C-n o n 
x C-c C-c L <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <next> <down> <down> <down> <prior> 
<up> <prior> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <return> 5 <return> <C-end> C-p <return> 
C-u <down> <up> C-u g h <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <next> <up> <up> 
<up> <up> <up> <down> <down> <down> <down> <down> <down> 
<prior> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <down> M-x r e p <tab> o <tab> <tab> r t <tab> 
<tab> <tab> e m <tab> b u <tab> <return>

Recent messages:
nnrss: Requesting Plone News...done
nnrss: Requesting PhpBB announcements...done
nnrss: Requesting GANDI News...done
nnrss: Requesting Radio-Canada | Qu=e9bec...done
nnrss: Requesting Radio-Canada | National...done
nnrss: Requesting A la une =2013 le fil d'actualit=e9 de service-public.fr...done
nnrss: Requesting Le blog de Jean-Luc M=e9lenchon...done
nnrss: Requesting Le blog de Martine Billard...done
Checking new news...done
Making completion list... [3 times]

Load-path shadows:
/usr/share/emacs/23.3/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
/usr/share/emacs/23.3/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/usr/share/emacs/23.3/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik
/usr/share/emacs/23.3/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold
/usr/share/emacs/23.3/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/usr/share/emacs/23.3/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex
/usr/share/emacs/23.3/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/usr/share/emacs/23.3/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font
/usr/share/emacs/23.3/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style
/usr/share/emacs/23.3/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/usr/share/emacs/23.3/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite
/usr/share/emacs/23.3/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar
/usr/share/emacs/23.3/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp
/usr/share/emacs/23.3/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/usr/share/emacs/23.3/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/usr/share/emacs/23.3/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex
/usr/share/emacs/23.3/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context
/usr/share/emacs/23.3/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex
/usr/share/emacs/23.3/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/usr/share/emacs/23.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/autoconf/autotest-mode hides /usr/share/emacs/site-lisp/autotest-mode
/usr/share/emacs/23.3/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.3/lisp/md4
/usr/share/emacs23/site-lisp/flim/hex-util hides /usr/share/emacs/23.3/lisp/hex-util
/usr/share/emacs23/site-lisp/flim/sha1 hides /usr/share/emacs/23.3/lisp/sha1
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.3/lisp/textmodes/flyspell
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.3/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/org-mode/org-mac-message hides /usr/share/emacs/23.3/lisp/org/org-mac-message
/usr/share/emacs23/site-lisp/org-mode/org-publish hides /usr/share/emacs/23.3/lisp/org/org-publish
/usr/share/emacs23/site-lisp/org-mode/org-datetree hides /usr/share/emacs/23.3/lisp/org/org-datetree
/usr/share/emacs23/site-lisp/org-mode/org-remember hides /usr/share/emacs/23.3/lisp/org/org-remember
/usr/share/emacs23/site-lisp/org-mode/org-html hides /usr/share/emacs/23.3/lisp/org/org-html
/usr/share/emacs23/site-lisp/org-mode/org-bbdb hides /usr/share/emacs/23.3/lisp/org/org-bbdb
/usr/share/emacs23/site-lisp/org-mode/org-latex hides /usr/share/emacs/23.3/lisp/org/org-latex
/usr/share/emacs23/site-lisp/org-mode/org-exp hides /usr/share/emacs/23.3/lisp/org/org-exp
/usr/share/emacs23/site-lisp/org-mode/org-clock hides /usr/share/emacs/23.3/lisp/org/org-clock
/usr/share/emacs23/site-lisp/org-mode/org-protocol hides /usr/share/emacs/23.3/lisp/org/org-protocol
/usr/share/emacs23/site-lisp/org-mode/org-bibtex hides /usr/share/emacs/23.3/lisp/org/org-bibtex
/usr/share/emacs23/site-lisp/org-mode/org-src hides /usr/share/emacs/23.3/lisp/org/org-src
/usr/share/emacs23/site-lisp/org-mode/org-agenda hides /usr/share/emacs/23.3/lisp/org/org-agenda
/usr/share/emacs23/site-lisp/org-mode/org-colview hides /usr/share/emacs/23.3/lisp/org/org-colview
/usr/share/emacs23/site-lisp/org-mode/org-irc hides /usr/share/emacs/23.3/lisp/org/org-irc
/usr/share/emacs23/site-lisp/org-mode/org-faces hides /usr/share/emacs/23.3/lisp/org/org-faces
/usr/share/emacs23/site-lisp/org-mode/org-indent hides /usr/share/emacs/23.3/lisp/org/org-indent
/usr/share/emacs23/site-lisp/org-mode/org-w3m hides /usr/share/emacs/23.3/lisp/org/org-w3m
/usr/share/emacs23/site-lisp/org-mode/org-ascii hides /usr/share/emacs/23.3/lisp/org/org-ascii
/usr/share/emacs23/site-lisp/org-mode/org hides /usr/share/emacs/23.3/lisp/org/org
/usr/share/emacs23/site-lisp/org-mode/org-jsinfo hides /usr/share/emacs/23.3/lisp/org/org-jsinfo
/usr/share/emacs23/site-lisp/org-mode/org-icalendar hides /usr/share/emacs/23.3/lisp/org/org-icalendar
/usr/share/emacs23/site-lisp/org-mode/org-table hides /usr/share/emacs/23.3/lisp/org/org-table
/usr/share/emacs23/site-lisp/org-mode/org-inlinetask hides /usr/share/emacs/23.3/lisp/org/org-inlinetask
/usr/share/emacs23/site-lisp/org-mode/org-mew hides /usr/share/emacs/23.3/lisp/org/org-mew
/usr/share/emacs23/site-lisp/org-mode/org-gnus hides /usr/share/emacs/23.3/lisp/org/org-gnus
/usr/share/emacs23/site-lisp/org-mode/org-wl hides /usr/share/emacs/23.3/lisp/org/org-wl
/usr/share/emacs23/site-lisp/org-mode/org-rmail hides /usr/share/emacs/23.3/lisp/org/org-rmail
/usr/share/emacs23/site-lisp/org-mode/org-habit hides /usr/share/emacs/23.3/lisp/org/org-habit
/usr/share/emacs23/site-lisp/org-mode/org-install hides /usr/share/emacs/23.3/lisp/org/org-install
/usr/share/emacs23/site-lisp/org-mode/org-mobile hides /usr/share/emacs/23.3/lisp/org/org-mobile
/usr/share/emacs23/site-lisp/org-mode/org-list hides /usr/share/emacs/23.3/lisp/org/org-list
/usr/share/emacs23/site-lisp/org-mode/org-timer hides /usr/share/emacs/23.3/lisp/org/org-timer
/usr/share/emacs23/site-lisp/org-mode/org-compat hides /usr/share/emacs/23.3/lisp/org/org-compat
/usr/share/emacs23/site-lisp/org-mode/org-mhe hides /usr/share/emacs/23.3/lisp/org/org-mhe
/usr/share/emacs23/site-lisp/org-mode/org-footnote hides /usr/share/emacs/23.3/lisp/org/org-footnote
/usr/share/emacs23/site-lisp/org-mode/org-plot hides /usr/share/emacs/23.3/lisp/org/org-plot
/usr/share/emacs23/site-lisp/org-mode/org-macs hides /usr/share/emacs/23.3/lisp/org/org-macs
/usr/share/emacs23/site-lisp/org-mode/org-archive hides /usr/share/emacs/23.3/lisp/org/org-archive
/usr/share/emacs23/site-lisp/org-mode/org-vm hides /usr/share/emacs/23.3/lisp/org/org-vm
/usr/share/emacs23/site-lisp/org-mode/org-info hides /usr/share/emacs/23.3/lisp/org/org-info
/usr/share/emacs23/site-lisp/org-mode/org-exp-blocks hides /usr/share/emacs/23.3/lisp/org/org-exp-blocks
/usr/share/emacs23/site-lisp/org-mode/org-xoxo hides /usr/share/emacs/23.3/lisp/org/org-xoxo
/usr/share/emacs23/site-lisp/org-mode/org-crypt hides /usr/share/emacs/23.3/lisp/org/org-crypt
/usr/share/emacs23/site-lisp/org-mode/org-mouse hides /usr/share/emacs/23.3/lisp/org/org-mouse
/usr/share/emacs23/site-lisp/org-mode/org-attach hides /usr/share/emacs/23.3/lisp/org/org-attach
/usr/share/emacs23/site-lisp/org-mode/org-id hides /usr/share/emacs/23.3/lisp/org/org-id
/usr/share/emacs23/site-lisp/org-mode/org-docbook hides /usr/share/emacs/23.3/lisp/org/org-docbook
/usr/share/emacs23/site-lisp/org-mode/org-feed hides /usr/share/emacs/23.3/lisp/org/org-feed
/usr/share/emacs23/site-lisp/org-mode/org-freemind hides /usr/share/emacs/23.3/lisp/org/org-freemind
/usr/share/emacs23/site-lisp/flim/sasl hides /usr/share/emacs/23.3/lisp/net/sasl
/usr/share/emacs23/site-lisp/flim/ntlm hides /usr/share/emacs/23.3/lisp/net/ntlm
/usr/share/emacs23/site-lisp/flim/hmac-def hides /usr/share/emacs/23.3/lisp/net/hmac-def
/usr/share/emacs23/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.3/lisp/net/hmac-md5
/usr/share/emacs23/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.3/lisp/net/sasl-ntlm
/usr/share/emacs23/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.3/lisp/net/sasl-digest
/usr/share/emacs23/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.3/lisp/net/sasl-cram
/usr/share/emacs23/site-lisp/emms/tq hides /usr/share/emacs/23.3/lisp/emacs-lisp/tq

Features:
(shadow emacsbug reporter rmailmm rmail debian-bug help-mode view
w3m-form w3m-symbol w3m w3m-hist w3m-e23 w3m-ccl ccl w3m-fsf w3m-favicon
w3m-image w3m-proc w3m-util org-table org-wl org-w3m org-vm org-rmail
org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-agenda org-info org-gnus org-docview org-bibtex
bibtex org-bbdb org warnings ob-R ob-octave ob-emacs-lisp ob-tangle
ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys ob ob-eval
org-pcomplete pcomplete org-list org-faces org-compat org-entities
org-macs noutline outline easy-mmode cal-menu calendar cal-loaddefs
vc-git make-mode tramp-imap tramp-gw tramp-fish tramp-smb tramp-cache
tramp-ftp tramp-cmds tramp advice advice-preload tramp-compat trampver
newcomment tabify man gnus-cite smiley ansi-color mail-extr gnus-async
gnus-bcklg sort byte-opt bytecomp byte-compile gnus-ml disp-table
gnus-demon gnus-topic nnrss mm-url parse-time timezone utf-7 utf7
starttls nnimap imap nndraft nnmh epa-file epa epg auth-source
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums mailabbrev gmm-utils mailheader canlock sha1
sha1-el hex-util hashcash gnus-win xml-weather help-fns edmacro kmacro
derived xml cl cl-19 gnus-BTS windmove winner server ido gnus gnus-ems
nnheader gnus-util netrc time-date mail-utils wid-edit cus-start
cus-load debian-el debian-el-loaddefs w3m-load slime-autoloads
org-install ess-toolbar ess-mouse mouseme thingatpt browse-url ess-menu
ess-swv ess-noweb noweb-font-lock-mode ess-bugs-l essd-els ess-sas-d
ess-sas-l ess-sas-a executable shell ess-arc-d ess-vst-d ess-xls-d
ess-lsp-l ess-sta-d ess-sta-l cc-vars cc-defs make-regexp ess-sp6-d
ess-sp5-d ess-sp3-d ess-r-d ess-r-args assoc ess-s-l ess-inf ess-utils
comint ring ess-mode noweb-mode ess ess-custom regexp-opt easymenu
ess-compat ess-site emms-auto dpkg-dev-el dpkg-dev-el-loaddefs tempo url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-util url-parse url-vars mm-util mail-prsvr mailcap xml-parse
doxymacs bbdb-autoloads preview-latex tex-site auto-loads tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind system-font-setting
font-render-setting gtk x-toolkit x multi-tty emacs)