From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "David J. Biesack" Newsgroups: gmane.emacs.bugs Subject: bug#4448: 23.1; unrmail fails if buffer has mixed line endings (patch) Date: Wed, 16 Sep 2009 09:28:35 -0400 Message-ID: Reply-To: "David J. Biesack" , 4448@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1253109459 31331 80.91.229.12 (16 Sep 2009 13:57:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Sep 2009 13:57:39 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 16 15:57:32 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mnv0l-0001sn-S9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Sep 2009 15:57:32 +0200 Original-Received: from localhost ([127.0.0.1]:53361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mnv0l-0002u2-EZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Sep 2009 09:57:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mnuqq-0004B9-3Q for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:47:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mnuqh-00045s-Ny for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:47:14 -0400 Original-Received: from [199.232.76.173] (port=40923 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mnuqh-00045j-Gn for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:47:07 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:35024) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mnuqg-0007X5-8Q for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:47:07 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8GDl0UG005476; Wed, 16 Sep 2009 06:47:01 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8GDZ65l003158; Wed, 16 Sep 2009 06:35:06 -0700 Resent-Date: Wed, 16 Sep 2009 06:35:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "David J. Biesack" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Wed, 16 Sep 2009 13:35:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4448 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12531077281985 (code B ref -1); Wed, 16 Sep 2009 13:35:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 16 Sep 2009 13:28:48 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8GDSkSS001982 for ; Wed, 16 Sep 2009 06:28:47 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnuYw-0006Gw-00 for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:28:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnuYq-0006EZ-Ue for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:28:45 -0400 Original-Received: from [199.232.76.173] (port=33660 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnuYq-0006EO-M9 for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:28:40 -0400 Original-Received: from mercav14.na.sas.com ([149.173.6.152]:63476) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MnuYp-0004Dg-Rn for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2009 09:28:40 -0400 X-TM-IMSS-Message-ID: <199b80bd0002ea81@mercav14.na.sas.com> Original-Received: from d16922.us.sas.com ([10.40.12.239]) by mercav14.na.sas.com ([10.19.9.244]) with ESMTP (TREND IMSS SMTP Service 7.0) id 199b80bd0002ea81 ; Wed, 16 Sep 2009 09:28:36 -0400 X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 16 Sep 2009 09:47:14 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31142 Archived-At: I invoked rmail-input on an RMAIL file and got the following traceback. I performed find-file-literally on the rmail file and found that it has mixed line endings - text text of the first messages end in just LF and others end in CR LF. This causes the (re-search-forward "^[*][*][*] EOOH [*][*][*]\n") in unrmail to fail. below is the traceback. Debugger entered--Lisp error: (search-failed "^[*][*][*] EOOH [*][*][*] ") re-search-forward("^[*][*][*] EOOH [*][*][*]\n") unrmail("c:/TEMP/rmail4124CNA" "c:/TEMP/rmail4124PXG") byte-code("=3fffc6=3fffc7!=3fffc6=3fffc7!=3fffc8=3fff8e=3fffc9 =3fff88=3fffcaed #=3fff88=3fffcb \"=3fff88=3fffcc=3fffcd!=3fff88=3fffce=3fffcf=3fffce=3fffd0 =3fff88=3fffd1!=3fff88=3fffd2=3fffd3!=3fff88=3fffd4 =3fff88=3fffd5 =3fff88=3fffd6 =3fff88=3fffce=3fffd7 =3fff88db=3fff88=3fffd8 =3fff88+=3fffcc=3fffd9!+=3fff87" [new-file old-file buffer-undo-list coding-system-for-read inhibit-read-only rmail-was-converted make-temp-file "rmail" ((byte-code "=3fffc2!=3fff88=3fffc2 !=3fff87" [old-file new-file delete-file] 2)) kill-all-local-variables write-region unrmail message "Replacing BABYL format with mbox format..." t raw-text erase-buffer insert-file-contents set-buffer-file-coding-system raw-text-unix rmail-mode-1 rmail-perm-variables rmail-variables rmail-dont-modify-format rmai l-set-message-counters "Replacing BABYL format with mbox format...done"] 4) rmail-convert-babyl-to-mbox() byte-code("=3fffc2 =3fff88eb=3fff88=3fffc3=3fffc4=3fffc5!=3fff83 rmail-convert-file-maybe() byte-code("=3fffc6 =3fff88=3fffc7=3fff86 rmail("u:/rmail/test-rmail-to-mbox") byte-code("=3fffc1!=3fff87" [filename rmail] 2) rmail-input("u:/rmail/test-rmail-to-mbox") call-interactively(rmail-input nil nil) Here is a patch which makes it work, but I don't think this is the correct change; it seems that the correct change would be to account for coding systems. But this works for me. *** unrmail.el.orig Wed Sep 16 09:14:27 2009 --- unrmail.el Wed Sep 16 09:24:22 2009 *************** *** 167,180 **** (forward-line 1))) (delete-region (point-min) (point)) ;; Delete the old reformatted header. ! (re-search-forward "^[*][*][*] EOOH [*][*][*]\n") (forward-line -1) (let ((start (point))) ! (search-forward "\n\n") (delete-region start (point)))) ;; Not reformatted. Delete the special ;; lines before the real header. ! (re-search-forward "^[*][*][*] EOOH [*][*][*]\n") (delete-region (point-min) (point))) ;; Handle rmime formatting. --- 167,180 ---- (forward-line 1))) (delete-region (point-min) (point)) ;; Delete the old reformatted header. ! (re-search-forward "^[*][*][*] EOOH [*][*][*]\015?\n") (forward-line -1) (let ((start (point))) ! (re-search-forward "\n\015?\n") (delete-region start (point)))) ;; Not reformatted. Delete the special ;; lines before the real header. ! (re-search-forward "^[*][*][*] EOOH [*][*][*]\015?\n") (delete-region (point-min) (point))) ;; Handle rmime formatting. *************** *** 188,194 **** (save-restriction (narrow-to-region (point-min) ! (save-excursion (search-forward "\n\n" nil 'move) (point))) ;; Fetch or construct what we should use in the `From ' line. (setq mail-from (or (let ((from (mail-fetch-field "Mail-From"))) --- 188,194 ---- (save-restriction (narrow-to-region (point-min) ! (save-excursion (re-search-forward "\n\015?\n" nil 'move) (point))) ;; Fetch or construct what we should use in the `From ' line. (setq mail-from (or (let ((from (mail-fetch-field "Mail-From"))) *************** *** 234,240 **** (insert ?>))) ;; Make sure the message ends with two newlines (goto-char (point-max)) ! (unless (looking-back "\n\n") (insert "\n")) ;; Write it to the output file, suitably encoded. (let ((coding-system-for-write coding)) --- 234,240 ---- (insert ?>))) ;; Make sure the message ends with two newlines (goto-char (point-max)) ! (unless (looking-back "\n\015?\n") (insert "\n")) ;; Write it to the output file, suitably encoded. (let ((coding-system-for-write coding)) In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.4)' 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: ENU value of $XMODIFIERS: nil locale-coding-system: cp1252 default-enable-multibyte-characters: t Major mode: Debugger Minor modes in effect: display-time-mode: t shell-dirtrack-mode: t delete-selection-mode: t pc-selection-mode: t show-paren-mode: t iswitchb-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t Recent input: C-x C-o C-g C-g C-x o M-x ^ m C-x C-s C-x k SPC C-g C-g C-x k SPC q C-x b R M i I n s t a SPC C-x , o i n s t a SPC y e s C-x C-f C o d e SPC P SPC q C-x b C o d e C-s C-s C-x ~ M-x f i n d - f i l e - l i SPC C o d e P SPC y 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-s C-w C-w C-r C-r C-s C-s M-> C-r C-r M-< M-x ^ m C-x C-s C-x k SPC C-g C-g C-g C-n C-n C-x k SPC i C o d e P SPC C-x C-s h C-x o C-x b I R M o C o d e P r o SPC y e s C-x C-s C-x k SPC C-x C-f e C-x k SPC C-x o i A d d SPC C-x k SPC C-x o C-n C-n C-n C-p C-p C-n e C-x k SPC d C-n C-n C-n C-e C-d t e s t - r m a i l - t o - m b o x C-x o C-x D C-x D i t e s t 0 - m r m SPC SPC SPC SPC C-x h M-w M-x r e p o r t 0 - e m SPC Recent messages: Press RET when finished Toggling font-lock-mode off; better pass an explicit argument. Auto-saving...done (setq debug-on-error nil) (setq debug-on-error t) Wrote c:/TEMP/rmail4124CNA Writing messages to c:/TEMP/rmail4124PXG... Entering debugger... Mark set [2 times] Region saved -- David J. Biesack, SAS SAS Campus Dr. Cary, NC 27513 www.sas.com (919) 531-7771