all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 23.0.60; [gnus] incorrect Content-Transfer-Encoding for inline message/rfc822 entities
@ 2008-04-23 20:18 Luca Capello
  2008-04-24 21:58 ` Reiner Steib
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Capello @ 2008-04-23 20:18 UTC (permalink / raw)
  To: emacs-pretest-bug; +Cc: rfrancoise


[-- Attachment #1.1: Type: text/plain, Size: 6968 bytes --]


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.

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

Hello,

I'm a Gnus user and my forward settings are the following:

  (setq
   message-forward-as-mime t
   message-forward-before-signature nil
   message-forward-show-mml nil
   message-make-forward-subject-function 'message-forward-subject-fwd)

Today I forwarded the attached mail to the Debian development mailing
list [1], but the mail was rejected by Postfix with error:

  Diagnostic code: smtp;550 5.6.0 invalid message/* or multipart/*
                   encoding domain

The problem seems to be in the headers of the "message/rfc822" entity:

  Content-Type: message/rfc822
  Content-Disposition: inline
  Content-Transfer-Encoding: quoted-printable

In fact, according to RFC2046, § 5.2.1, RFC822 Subtype [2],
"quoted-printable" is not a valid encoding:

  No encoding other than "7bit", "8bit", or "binary" is permitted for
  the body of a "message/rfc822" entity.

The error is in lisp/gnus/mm-encode.el:mm-safer-encoding, which returns
quoted-printable if the entity encoding is either 8bit or
quoted-printable.  If I correctly read RFC2046 this is plainly wrong for
the specific "message/rfc822" entity, as it should return 8bit instead,
and as well as for base64 (it should return binary).  I tested the
following patch for "message/rfc822" and "text/plain" entities:

--8<---------------cut here---------------start------------->8---
--- mm-encode.el.~1~	2008-04-23 19:37:22.000000000 +0200
+++ mm-encode.el	2008-04-23 20:00:32.000000000 +0200
@@ -96,14 +96,15 @@
       "application/octet-stream"
     (mailcap-extension-to-mime (match-string 0 file))))
 
-(defun mm-safer-encoding (encoding)
+(defun mm-safer-encoding (encoding &optional type)
   "Return an encoding similar to ENCODING but safer than it."
   (cond
    ((eq encoding '7bit) '7bit) ;; 7bit is considered safe.
-   ((memq encoding '(8bit quoted-printable)) 'quoted-printable)
+   ((memq encoding '(8bit quoted-printable))
+    (if (string= type "message/rfc822") '8bit 'quoted-printable))
    ;; The remaining encodings are binary and base64 (and perhaps some
    ;; non-standard ones), which are both turned into base64.
-   (t 'base64)))
+   (t (if (string= type "message/rfc822") 'binary 'base64))))
 
 (defun mm-encode-content-transfer-encoding (encoding &optional type)
   "Encode the current buffer with ENCODING for MIME type TYPE.
@@ -178,7 +179,7 @@
 			    (mm-qp-or-base64)
 			  (cadr (car rules)))))
 		   (if mm-use-ultra-safe-encoding
-		       (mm-safer-encoding encoding)
+		       (mm-safer-encoding encoding type)
 		     encoding))))
 	(pop rules)))))
 
--8<---------------cut here---------------end--------------->8---

BTW, I found this bug because I use `mml-secure-message-sign-pgpmime` to
sign my mails.

Thx, bye,
Gismo / Luca

Footnotes: 
[1] http://lists.debian.org/debian-devel/
[2] http://tools.ietf.org/html/rfc2046#section-5.2.1

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.0.60/etc/DEBUG for instructions.


In GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu)
 of 2008-04-16 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20080416-1)
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.0.60/leim' '--with-x=no' '--without-dbus' '--without-sound' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' '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: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  erc-truncate-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-ring-mode: t
  erc-netsplit-mode: t
  erc-match-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-autojoin-mode: t
  erc-autoaway-mode: t
  gnus-topic-mode: t
  gnus-undo-mode: t
  shell-dirtrack-mode: t
  gpm-mouse-mode: t
  display-battery-mode: t
  display-time-mode: t
  show-paren-mode: t
  erc-stamp-mode: t
  erc-log-mode: t
  erc-scrolltobottom-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
[ A ESC [ A ESC [ A ESC [ A ESC [ A ESC [ A ESC [ B 
ESC [ B ESC [ A ESC [ A ESC [ A ESC [ A ESC [ A ESC 
[ A RET RET q l ESC [ A RET ESC [ B q ESC [ B ESC [ 
B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC [ B ESC 
[ B RET RET C-c ESC f i C-x o C-x o C-x o C-x o ESC 
v C-v C-v ESC > C-c ESC f g ESC C-v q l J j C-c ESC 
f i ESC v ESC v C-v ESC > ESC [ B C-c ESC f g g J j 
g C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p RET # # C-n C-n # C-n # # # 
C-n # C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
B DEL y x ESC < B m C-a C-k n n m l TAB b o TAB RET 
x q RET RET B r RET x q l C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p RET RET B m p e TAB S a n d 
r TAB TAB o TAB RET x q l C-p C-p C-p C-p C-p C-p C-p 
C-p C-p RET RET B DEL y x q ESC x d e DEL DEL e DEL 
r e p o r t TAB e m TAB b TAB RET

Recent messages:
Wrote /home/luca/Mail/people/SandroMangia/4
Generating summary...done
Exiting summary buffer and applying spam rules
Retrieving newsgroup: nndraft:drafts...
Fetching headers for nndraft:drafts...done
Generating summary...done
Do you really want to delete this article forever? (y or n) 
Deleting article /home/luca/Mail/drafts/drafts/349 in drafts...
Generating summary...done
Exiting summary buffer and applying spam rules


[-- Attachment #1.2: mail rejected by postfix/listz.debian.org --]
[-- Type: application/octet-stream, Size: 4997 bytes --]

[-- Attachment #2: Type: application/pgp-signature, Size: 306 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 23.0.60; [gnus] incorrect Content-Transfer-Encoding for inline message/rfc822 entities
  2008-04-23 20:18 23.0.60; [gnus] incorrect Content-Transfer-Encoding for inline message/rfc822 entities Luca Capello
@ 2008-04-24 21:58 ` Reiner Steib
  0 siblings, 0 replies; 2+ messages in thread
From: Reiner Steib @ 2008-04-24 21:58 UTC (permalink / raw)
  To: Luca Capello; +Cc: emacs-pretest-bug, rfrancoise, ding

On Wed, Apr 23 2008, Luca Capello wrote:

> Today I forwarded the attached mail to the Debian development mailing
> list [1], but the mail was rejected by Postfix with error:
>
>   Diagnostic code: smtp;550 5.6.0 invalid message/* or multipart/*
>                    encoding domain
>
> The problem seems to be in the headers of the "message/rfc822" entity:
>
>   Content-Type: message/rfc822
>   Content-Disposition: inline
>   Content-Transfer-Encoding: quoted-printable
>
> In fact, according to RFC2046, § 5.2.1, RFC822 Subtype [2],
> "quoted-printable" is not a valid encoding:
>
>   No encoding other than "7bit", "8bit", or "binary" is permitted for
>   the body of a "message/rfc822" entity.
>
> The error is in lisp/gnus/mm-encode.el:mm-safer-encoding, which returns
> quoted-printable if the entity encoding is either 8bit or
> quoted-printable.  If I correctly read RFC2046 this is plainly wrong for
> the specific "message/rfc822" entity, as it should return 8bit instead,
> and as well as for base64 (it should return binary).  I tested the
> following patch for "message/rfc822" and "text/plain" entities:

I've installed it in the stable Gnus branch (v5-10).  It will be
synced to the trunk and to Emacs (trunk and Emacs_22 branch) later.

The patch looks good to me.  Thanks for your contribution.
Does anyone see a problem with this it?

> --- mm-encode.el.~1~	2008-04-23 19:37:22.000000000 +0200
> +++ mm-encode.el	2008-04-23 20:00:32.000000000 +0200
> @@ -96,14 +96,15 @@
>        "application/octet-stream"
>      (mailcap-extension-to-mime (match-string 0 file))))
>
> -(defun mm-safer-encoding (encoding)
> +(defun mm-safer-encoding (encoding &optional type)
>    "Return an encoding similar to ENCODING but safer than it."
>    (cond
>     ((eq encoding '7bit) '7bit) ;; 7bit is considered safe.
> -   ((memq encoding '(8bit quoted-printable)) 'quoted-printable)
> +   ((memq encoding '(8bit quoted-printable))
> +    (if (string= type "message/rfc822") '8bit 'quoted-printable))
>     ;; The remaining encodings are binary and base64 (and perhaps some
>     ;; non-standard ones), which are both turned into base64.
> -   (t 'base64)))
> +   (t (if (string= type "message/rfc822") 'binary 'base64))))
>
>  (defun mm-encode-content-transfer-encoding (encoding &optional type)
>    "Encode the current buffer with ENCODING for MIME type TYPE.
> @@ -178,7 +179,7 @@
>  			    (mm-qp-or-base64)
>  			  (cadr (car rules)))))
>  		   (if mm-use-ultra-safe-encoding
> -		       (mm-safer-encoding encoding)
> +		       (mm-safer-encoding encoding type)
>  		     encoding))))
>  	(pop rules)))))

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-24 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 20:18 23.0.60; [gnus] incorrect Content-Transfer-Encoding for inline message/rfc822 entities Luca Capello
2008-04-24 21:58 ` Reiner Steib

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.