unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11282: 24.1.50; Error in decoding message
@ 2012-04-19 18:39 Richard Stallman
  2012-04-20  1:34 ` Kenichi Handa
  2012-05-04  6:33 ` Kenichi Handa
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Stallman @ 2012-04-19 18:39 UTC (permalink / raw)
  To: 11282

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

When I visit this as an Rmail file, Rmail gets an error
decoding the coding system.  Maybe the message really is
invalid, but Rmail should not get an unhandled Lisp error.

Here is the backtrace.

    Debugger entered--Lisp error: (wrong-type-argument wholenump nil)
      decode-coding-region(888 1351 utf-7)
      rmail-mime-insert-decoded-text([("text/html" (charset . "utf-7")) ("inline") "7bit" [[nil nil nil] [t nil t]] [#<marker at 1 in bad-message> #<marker at 5343 in bad-message> t] ["" (nil) nil] [#<marker at 5343 in bad-message> #<marker at 5806 in bad-message> t] nil rmail-mime-insert-text nil])
      rmail-mime-insert-text([("text/html" (charset . "utf-7")) ("inline") "7bit" [[nil nil nil] [t nil t]] [#<marker at 1 in bad-message> #<marker at 5343 in bad-message> t] ["" (nil) nil] [#<marker at 5343 in bad-message> #<marker at 5806 in bad-message> t] nil rmail-mime-insert-text nil])
      rmail-mime-insert([("text/html" (charset . "utf-7")) ("inline") "7bit" [[nil nil nil] [t nil t]] [#<marker at 1 in bad-message> #<marker at 5343 in bad-message> t] ["" (nil) nil] [#<marker at 5343 in bad-message> #<marker at 5806 in bad-message> t] nil rmail-mime-insert-text nil])
      rmail-show-mime()
      rmail-show-message-1(nil)
      rmail-show-message(nil)
      byte-code("\bq\210	\204\f

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

* bug#11282: 24.1.50; Error in decoding message
  2012-04-19 18:39 bug#11282: 24.1.50; Error in decoding message Richard Stallman
@ 2012-04-20  1:34 ` Kenichi Handa
  2012-05-04  6:33 ` Kenichi Handa
  1 sibling, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2012-04-20  1:34 UTC (permalink / raw)
  To: rms; +Cc: 11282

In article <E1SKwG9-0004v7-NR@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> When I visit this as an Rmail file, Rmail gets an error
> decoding the coding system.  Maybe the message really is
> invalid, but Rmail should not get an unhandled Lisp error.

> Here is the backtrace.

>     Debugger entered--Lisp error: (wrong-type-argument wholenump nil)
>       decode-coding-region(888 1351 utf-7)
>       rmail-mime-insert-decoded-text([("text/html" (charset . "utf-7")) ("inline") "7bit" [[nil nil nil] [t nil t]] [#<marker at 1 in bad-message> #<marker at 5343 in bad-message> t] ["" (nil) nil] [#<marker at 5343 in bad-message> #<marker at 5806 in bad-message> t] nil rmail-mime-insert-text nil])

As I can reproduce the bug, I'll work on fixing it.

---
Kenichi Handa
handa@m17n.org





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

* bug#11282: 24.1.50; Error in decoding message
  2012-04-19 18:39 bug#11282: 24.1.50; Error in decoding message Richard Stallman
  2012-04-20  1:34 ` Kenichi Handa
@ 2012-05-04  6:33 ` Kenichi Handa
  2012-05-04 10:28   ` Chong Yidong
  1 sibling, 1 reply; 4+ messages in thread
From: Kenichi Handa @ 2012-05-04  6:33 UTC (permalink / raw)
  To: rms; +Cc: 11282

In article <E1SKwG9-0004v7-NR@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:

> When I visit this as an Rmail file, Rmail gets an error
> decoding the coding system.  Maybe the message really is
> invalid, but Rmail should not get an unhandled Lisp error.

> Here is the backtrace.

>     Debugger entered--Lisp error: (wrong-type-argument wholenump nil)
>       decode-coding-region(888 1351 utf-7)
>       rmail-mime-insert-decoded-text([("text/html" (charset . "utf-7")) ("inline") "7bit" [[nil nil nil] [t nil t]] [#<marker at 1 in bad-message> #<marker at 5343 in bad-message> t] ["" (nil) nil] [#<marker at 5343 in bad-message> #<marker at 5806 in bad-message> t] nil rmail-mime-insert-text nil])
[...]

I've just installed this change to the trunk.  I think it
should also be applied to 24.1.

2012-05-03  Kenichi Handa  <handa@m17n.org>

	* mail/rmailmm.el (rmail-show-mime): Catch an error caused by text
	decoding, and show a warning message without signalling an error
	(Bug#11282).

=== modified file 'lisp/mail/rmailmm.el'
--- lisp/mail/rmailmm.el	2012-01-19 07:21:25 +0000
+++ lisp/mail/rmailmm.el	2012-05-03 05:47:24 +0000
@@ -1300,26 +1300,40 @@
 	(rmail-mime-mbox-buffer rmail-buffer)
 	(rmail-mime-view-buffer rmail-view-buffer)
 	(rmail-mime-coding-system nil))
+    ;; If ENTITY is not a vector, it is a string describing an error.
     (if (vectorp entity)
 	(with-current-buffer rmail-mime-view-buffer
 	  (erase-buffer)
-	  (rmail-mime-insert entity)
-	  (if (consp rmail-mime-coding-system)
-	      ;; Decoding is done by rfc2047-decode-region only for a
-	      ;; header.  But, as the used coding system may have been
-	      ;; overridden by mm-charset-override-alist, we can't
-	      ;; trust (car rmail-mime-coding-system).  So, here we
-	      ;; try the decoding again with mm-charset-override-alist
-	      ;; bound to nil.
-	      (let ((mm-charset-override-alist nil))
-		(setq rmail-mime-coding-system
-		      (rmail-mime-find-header-encoding
-		       (rmail-mime-entity-header entity)))))
-	  (set-buffer-file-coding-system
-	   (if rmail-mime-coding-system
-	       (coding-system-base rmail-mime-coding-system)
-	     'undecided)
-	   t t))
+	  ;; This condition-case is for catching an error in the
+	  ;; internal MIME decoding (e.g. incorrect BASE64 form) that
+	  ;; may be signaled by rmail-mime-insert.
+	  ;; FIXME: The current code doesn't set a proper error symbol
+	  ;; in ERR.  We must find a way to propagate a correct error
+	  ;; symbol that is caused in the very deep code of text
+	  ;; decoding (e.g. an error by base64-decode-region called by
+	  ;; post-read-conversion function of utf-7).
+	  (condition-case err
+	      (progn
+		(rmail-mime-insert entity)
+		(if (consp rmail-mime-coding-system)
+		    ;; Decoding is done by rfc2047-decode-region only for a
+		    ;; header.  But, as the used coding system may have been
+		    ;; overridden by mm-charset-override-alist, we can't
+		    ;; trust (car rmail-mime-coding-system).  So, here we
+		    ;; try the decoding again with mm-charset-override-alist
+		    ;; bound to nil.
+		    (let ((mm-charset-override-alist nil))
+		      (setq rmail-mime-coding-system
+			    (rmail-mime-find-header-encoding
+			     (rmail-mime-entity-header entity)))))
+		(set-buffer-file-coding-system
+		 (if rmail-mime-coding-system
+		     (coding-system-base rmail-mime-coding-system)
+		   'undecided)
+		 t t))
+	    (error (setq entity (format "%s" err))))))
+    ;; Re-check ENTITY.  It may be set to an error string.
+    (when (stringp entity)
       ;; Decoding failed.  ENTITY is an error message.  Insert the
       ;; original message body as is, and show warning.
       (let ((region (with-current-buffer rmail-mime-mbox-buffer






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

* bug#11282: 24.1.50; Error in decoding message
  2012-05-04  6:33 ` Kenichi Handa
@ 2012-05-04 10:28   ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2012-05-04 10:28 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: 11282, rms

Kenichi Handa <handa@gnu.org> writes:

> I've just installed this change to the trunk.  I think it
> should also be applied to 24.1.

Done.





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

end of thread, other threads:[~2012-05-04 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 18:39 bug#11282: 24.1.50; Error in decoding message Richard Stallman
2012-04-20  1:34 ` Kenichi Handa
2012-05-04  6:33 ` Kenichi Handa
2012-05-04 10:28   ` Chong Yidong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).