Mew icon indicating copy to clipboard operation
Mew copied to clipboard

mew sends error message as mail when mewencode doesn't work

Open roklein opened this issue 9 years ago • 0 comments

Hi,

when the mewencode binary is corrupt, mew sends the error message it gets from calling mewencode as mail.

In my example mew sent mails containing only this line (using mew 6.7):

emacs: /home/roklein/.emacs.d/mew/bin/mewencode: Exec format error

I got it working using the following diff (though I don't know currently which of the patched code paths is used):

diff --git a/mew-encode.el b/mew-encode.el
index 6dd3ad1..8da33d7 100644
--- a/mew-encode.el
+++ b/mew-encode.el
@@ -703,7 +703,13 @@
            (write-region beg (point-max) file nil 'no-msg))
          (delete-region beg (point-max)))
        (mew-piolet mew-cs-text-for-read mew-cs-dummy
-         (apply 'call-process mew-prog-mime-encode file t nil opt))
+          (let ((return-code
+                 (apply 'call-process mew-prog-mime-encode file t nil opt)))
+            (when (not (and (integerp return-code)
+                            (eql 0 return-code)))
+              (mew-encode-error
+               (concat mew-prog-mime-encode " returns invalid results")))
+            return-code))
        (if textp (mew-delete-file file))))
      (t
       (mew-encode-error (concat mew-prog-mime-encode " does not exist"))))
@@ -1150,7 +1156,13 @@
            (write-region (point-min) (point-max) file nil 'no-msg)
            (delete-region (point-min) (point-max)))
          (mew-piolet mew-cs-text-for-read mew-cs-dummy
-           (apply 'call-process mew-prog-mime-encode file t nil opt))
+            (let ((return-code
+                   (apply 'call-process mew-prog-mime-encode file t nil opt)))
+              (when (not (and (integerp return-code)
+                              (eql 0 return-code)))
+                (mew-encode-error
+                 (concat mew-prog-mime-encode " returns invalid results")))
+              return-code))
          (mew-delete-file file)))
        (t
        (mew-encode-error (concat mew-prog-mime-encode " does not exist")))))))

PS: patching the mew-prog-mime-decode calls in mew-decode.el and mew-summary4.el did not work; I get a "MIME decoding error: " instead for the same corrupt mewencode binary.

Best regards Robert

roklein avatar Jan 27 '16 13:01 roklein