From unknown Mon Jun 23 04:14:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27353: 25.2; rmail corrupts encoded message if you edit headers Resent-From: Ken Olum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Jun 2017 23:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27353 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 27353@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149739756916499 (code B ref -1); Tue, 13 Jun 2017 23:47:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jun 2017 23:46:09 +0000 Received: from localhost ([127.0.0.1]:46374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKvVh-0004I3-1o for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKvVf-0004Hd-99 for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKvVZ-000446-02 for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35046) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dKvVY-000442-Tg for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKvVX-0001BQ-KB for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:46:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKvVU-00041a-GN for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:45:59 -0400 Received: from cosmos.phy.tufts.edu ([130.64.84.253]:44813) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dKvVU-00041P-C3 for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:45:56 -0400 Received: from kdo by cosmos.phy.tufts.edu ([local]:local) with local id 1dKvVS-0003PC-Kn - Using Exim-4.84 (MandrivaLinux) MTA (return-path ); Tue, 13 Jun 2017 19:45:54 -0400 From: Ken Olum Date: Tue, 13 Jun 2017 19:45:54 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) If you use rmail edit to change any header in an message with nontrivial transfer encoding, parts of the header will get encoded, not just the body. The problem is that the reencoding system in rmail-cease-edit uses (point), but the previous call to rmail-edit-update-headers changes (point), unless no headers are modified. Even if you don't yourself modify any headers, bug#26918 can cause there to be a new content-type header, triggering this problem. I'll send a patch to fix this bug and #26918. Ken In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars) of 2017-06-08 built on cosmos Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Ubuntu 14.04.5 LTS Configured features: XPM JPEG TIFF GIF PNG SOUND NOTIFY LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 Important settings: value of $LC_ALL: C value of $LANG: en_US.UTF-8 locale-coding-system: nil Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t diff-auto-refine-mode: t tooltip-mode: t global-eldoc-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t Recent messages: Loading /home/kdo/emacs-init.el (source)...done Loading /home/kdo/emacs-init-mail.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug sendmail advice rmailmm message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr mail-utils shell pcomplete diff-mode easy-mmode thingatpt browse-url math derived inf-lisp easymenu comint ansi-color ring warnings cl-macs cl gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote inotify dynamic-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 105422 9891) (symbols 48 21581 3) (miscs 40 64 121) (strings 32 20808 4178) (string-bytes 1 588741) (vectors 16 14339) (vector-slots 8 453622 3906) (floats 8 173 8) (intervals 56 203 135) (buffers 976 18) (heap 1024 41469 1008)) From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 14 12:29:16 2017 Received: (at control) by debbugs.gnu.org; 14 Jun 2017 16:29:17 +0000 Received: from localhost ([127.0.0.1]:47928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLBAS-0001qQ-Nc for submit@debbugs.gnu.org; Wed, 14 Jun 2017 12:29:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLBAQ-0001qC-Op for control@debbugs.gnu.org; Wed, 14 Jun 2017 12:29:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLBAK-0007QQ-Tf for control@debbugs.gnu.org; Wed, 14 Jun 2017 12:29:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLBAK-0007QL-QU for control@debbugs.gnu.org; Wed, 14 Jun 2017 12:29:08 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dLBAK-0001vp-Gy for control@debbugs.gnu.org; Wed, 14 Jun 2017 12:29:08 -0400 Subject: control message for bug 24655 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Wed, 14 Jun 2017 12:29:08 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) block 24655 by 27353 From unknown Mon Jun 23 04:14:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27353: rmail-cease-edit patches for bugs 26918 and 27353 References: In-Reply-To: Resent-From: Ken Olum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jun 2017 18:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27353 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 26918@debbugs.gnu.org, 27353@debbugs.gnu.org Received: via spool by 27353-submit@debbugs.gnu.org id=B27353.149789762728902 (code B ref 27353); Mon, 19 Jun 2017 18:41:02 +0000 Received: (at 27353) by debbugs.gnu.org; 19 Jun 2017 18:40:27 +0000 Received: from localhost ([127.0.0.1]:56517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN1b8-0007W1-RR for submit@debbugs.gnu.org; Mon, 19 Jun 2017 14:40:27 -0400 Received: from cosmos.phy.tufts.edu ([130.64.84.253]:42486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN1b7-0007Vn-85; Mon, 19 Jun 2017 14:40:25 -0400 Received: from kdo by cosmos.phy.tufts.edu ([local]:local) with local id 1dN1b6-0005LU-EB - Using Exim-4.84 (MandrivaLinux) MTA (return-path ); Mon, 19 Jun 2017 14:40:24 -0400 From: Ken Olum Date: Mon, 19 Jun 2017 14:40:24 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Here is a patch to fix rmail editing problems associated with the content-type header and reapplying the transfer-encoding to edited messages. Ken * lisp/mail/rmailedit.el (rmail-cease-edit): If no content-type in edited headers, look for one in original headers and add it to edited headers (Bug #26918). Marker to track start of new body, so that content-transfer-encoding gets applied only to body (Bug #27353). Ensure blank line at end of message after encoding, not before. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=rmailedit.patch --- old/lisp/mail/rmailedit.el 2017-06-13 16:03:23.148043977 -0400 +++ new/lisp/mail/rmailedit.el 2017-06-19 14:28:50.227408375 -0400 @@ -188,10 +188,6 @@ (beginning-of-line) (insert ">") (forward-line))) - ;; Make sure buffer ends with a blank line so as not to run this - ;; message together with the following one. - (goto-char (point-max)) - (rmail-ensure-blank-line) (let ((old rmail-old-text) (pruned rmail-old-pruned) (mime-state rmail-old-mime-state) @@ -224,10 +220,9 @@ (setq old nil) (goto-char (point-min)) (search-forward "\n\n") - (setq headers-end (point-marker)) - (goto-char (point-min)) + (setq headers-end (point-marker)) ; first character of body (save-restriction - (narrow-to-region (point) headers-end) + (narrow-to-region (point-min) headers-end) ;; If they changed the message's encoding, rewrite the charset= ;; header for them, so that subsequent rmail-show-message ;; decodes it correctly. @@ -240,6 +235,38 @@ 'us-ascii new-coding)))) old-coding mime-beg mime-end content-type) + ;; If there's no content-type in the edited headers, look for one + ;; in the original headers and add it to the edited headers + ;; (Bug #26918) + (unless (mail-fetch-field "Content-Type") + (let (old-content-type + (msgbeg (rmail-msgbeg rmail-current-message)) + (msgend (rmail-msgend rmail-current-message))) + (with-current-buffer rmail-view-buffer ; really the mbox buffer + (save-restriction + (narrow-to-region msgbeg msgend) + (goto-char (point-min)) + (setq limit (search-forward "\n\n")) + (narrow-to-region (point-min) limit) + (goto-char (point-min)) + (when (re-search-forward "^content-type:" limit t) + (forward-line) + (setq old-content-type (buffer-substring + (match-beginning 0) (point)))))) + (when old-content-type + (save-excursion + (goto-char headers-end) ; first char of body + (backward-char) ; add header before second newline + (insert old-content-type) + ;;Add it to rmail-old-headers as though it had been + ;;there originally, to avoid rmail-edit-update-headers + ;;an extra copy + (let ((header (substring old-content-type 0 + (length "content-type")))) + (unless (assoc header rmail-old-headers) + (push (cons header old-content-type) rmail-old-headers))) + )))) + (goto-char (point-min)) (if (re-search-forward rmail-mime-charset-pattern nil 'move) (setq mime-beg (match-beginning 1) mime-end (match-end 1) @@ -281,29 +308,32 @@ (setq character-coding (downcase character-coding))) (goto-char limit) - (let ((inhibit-read-only t)) - (let ((data-buffer (current-buffer)) - (end (copy-marker (point) t))) - (with-current-buffer rmail-view-buffer - (encode-coding-region headers-end (point-max) coding-system - data-buffer)) - (delete-region end (point-max))) - + (let ((inhibit-read-only t) + (data-buffer (current-buffer)) + (start (copy-marker (point) nil)) ; new body will be between + (end (copy-marker (point) t))) ; these two markers + (with-current-buffer rmail-view-buffer + (encode-coding-region headers-end (point-max) coding-system + data-buffer)) + (delete-region end (point-max)) ;; Apply to the mbox buffer any changes in header fields ;; that the user made while editing in the view buffer. (rmail-edit-update-headers (rmail-edit-diff-headers rmail-old-headers new-headers)) - ;; Re-apply content-transfer-encoding, if any, on the message body. (cond ((string= character-coding "quoted-printable") - (mail-quote-printable-region (point) (point-max))) + (mail-quote-printable-region start (point-max))) ((and (string= character-coding "base64") is-text-message) - (base64-encode-region (point) (point-max))) + (base64-encode-region start (point-max))) ((and (eq character-coding 'uuencode) is-text-message) - (error "uuencoded messages are not supported")))) + (error "uuencoded messages are not supported"))) + ;; After encoding, make sure buffer ends with a blank line so as not to + ;; run this message together with the following one. + (goto-char (point-max)) + (rmail-ensure-blank-line)) (rmail-set-attribute rmail-edited-attr-index t)) - ;;??? BROKEN perhaps. +;;;??? BROKEN perhaps. ;;; (if (boundp 'rmail-summary-vector) ;;; (aset rmail-summary-vector (1- rmail-current-message) nil)) (rmail-show-message) --=-=-=-- From unknown Mon Jun 23 04:14:30 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ken Olum Subject: bug#27353: closed (Re: rmail-cease-edit patches for bugs 26918 and 27353) Message-ID: References: <83r2vhy2px.fsf@gnu.org> X-Gnu-PR-Message: they-closed 27353 X-Gnu-PR-Package: emacs Reply-To: 27353@debbugs.gnu.org Date: Fri, 08 Sep 2017 09:12:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1504861923-10570-1" This is a multi-part message in MIME format... ------------=_1504861923-10570-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #27353: 25.2; rmail corrupts encoded message if you edit headers which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 27353@debbugs.gnu.org. --=20 27353: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27353 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1504861923-10570-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 27353-done) by debbugs.gnu.org; 8 Sep 2017 09:11:30 +0000 Received: from localhost ([127.0.0.1]:55292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqFJx-0002jB-HD for submit@debbugs.gnu.org; Fri, 08 Sep 2017 05:11:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqFJw-0002iz-0P for 27353-done@debbugs.gnu.org; Fri, 08 Sep 2017 05:11:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqFJm-0003Lg-6a for 27353-done@debbugs.gnu.org; Fri, 08 Sep 2017 05:11:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqFJm-0003LP-39; Fri, 08 Sep 2017 05:11:18 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3318 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dqFJl-00060z-E4; Fri, 08 Sep 2017 05:11:17 -0400 Date: Fri, 08 Sep 2017 12:11:22 +0300 Message-Id: <83r2vhy2px.fsf@gnu.org> From: Eli Zaretskii To: Ken Olum In-reply-to: (message from Ken Olum on Mon, 19 Jun 2017 14:40:24 -0400) Subject: Re: rmail-cease-edit patches for bugs 26918 and 27353 References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 27353-done Cc: 26918-done@debbugs.gnu.org, 27353-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Ken Olum > Date: Mon, 19 Jun 2017 14:40:24 -0400 > > Here is a patch to fix rmail editing problems associated with the > content-type header and reapplying the transfer-encoding to edited > messages. Thanks, pushed to master. ------------=_1504861923-10570-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Jun 2017 23:46:09 +0000 Received: from localhost ([127.0.0.1]:46374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKvVh-0004I3-1o for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKvVf-0004Hd-99 for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKvVZ-000446-02 for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35046) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dKvVY-000442-Tg for submit@debbugs.gnu.org; Tue, 13 Jun 2017 19:46:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKvVX-0001BQ-KB for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:46:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKvVU-00041a-GN for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:45:59 -0400 Received: from cosmos.phy.tufts.edu ([130.64.84.253]:44813) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dKvVU-00041P-C3 for bug-gnu-emacs@gnu.org; Tue, 13 Jun 2017 19:45:56 -0400 Received: from kdo by cosmos.phy.tufts.edu ([local]:local) with local id 1dKvVS-0003PC-Kn - Using Exim-4.84 (MandrivaLinux) MTA (return-path ); Tue, 13 Jun 2017 19:45:54 -0400 From: Ken Olum To: bug-gnu-emacs@gnu.org Subject: 25.2; rmail corrupts encoded message if you edit headers Date: Tue, 13 Jun 2017 19:45:54 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) If you use rmail edit to change any header in an message with nontrivial transfer encoding, parts of the header will get encoded, not just the body. The problem is that the reencoding system in rmail-cease-edit uses (point), but the previous call to rmail-edit-update-headers changes (point), unless no headers are modified. Even if you don't yourself modify any headers, bug#26918 can cause there to be a new content-type header, triggering this problem. I'll send a patch to fix this bug and #26918. Ken In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars) of 2017-06-08 built on cosmos Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Ubuntu 14.04.5 LTS Configured features: XPM JPEG TIFF GIF PNG SOUND NOTIFY LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 Important settings: value of $LC_ALL: C value of $LANG: en_US.UTF-8 locale-coding-system: nil Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t diff-auto-refine-mode: t tooltip-mode: t global-eldoc-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t Recent messages: Loading /home/kdo/emacs-init.el (source)...done Loading /home/kdo/emacs-init-mail.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug sendmail advice rmailmm message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr mail-utils shell pcomplete diff-mode easy-mmode thingatpt browse-url math derived inf-lisp easymenu comint ansi-color ring warnings cl-macs cl gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote inotify dynamic-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 105422 9891) (symbols 48 21581 3) (miscs 40 64 121) (strings 32 20808 4178) (string-bytes 1 588741) (vectors 16 14339) (vector-slots 8 453622 3906) (floats 8 173 8) (intervals 56 203 135) (buffers 976 18) (heap 1024 41469 1008)) ------------=_1504861923-10570-1--