From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Lillibridge Newsgroups: gmane.emacs.devel Subject: Re: documentation of Rmail 23 mailbox format? Date: Sun, 06 Nov 2011 09:36:41 -0800 Message-ID: References: <87mxc9oin4.fsf@gnu.org> Reply-To: mark.lillibridge@hp.com NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1320601024 32530 80.91.229.12 (6 Nov 2011 17:37:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Nov 2011 17:37:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 06 18:36:59 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RN6eO-0007Pc-P3 for ged-emacs-devel@m.gmane.org; Sun, 06 Nov 2011 18:36:57 +0100 Original-Received: from localhost ([::1]:42992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN6eN-0003mG-Pn for ged-emacs-devel@m.gmane.org; Sun, 06 Nov 2011 12:36:55 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN6eK-0003k6-Js for emacs-devel@gnu.org; Sun, 06 Nov 2011 12:36:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RN6eF-0000HQ-HK for emacs-devel@gnu.org; Sun, 06 Nov 2011 12:36:52 -0500 Original-Received: from madara.hpl.hp.com ([192.6.19.124]:41849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN6eF-0000HI-48; Sun, 06 Nov 2011 12:36:47 -0500 Original-Received: from mailhub-pa1.hpl.hp.com (mailhub-pa1.hpl.hp.com [15.25.115.25]) by madara.hpl.hp.com (8.14.4/8.14.4/HPL-PA Relay) with ESMTP id pA6HahaO004106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 6 Nov 2011 09:36:43 -0800 Original-Received: from ts-rhel5 (ts-rhel5.hpl.hp.com [15.25.118.27]) by mailhub-pa1.hpl.hp.com (8.14.3/8.14.3/HPL-PA Hub) with ESMTP id pA6HafLD016572; Sun, 6 Nov 2011 09:36:41 -0800 In-reply-to: <87mxc9oin4.fsf@gnu.org> (message from Chong Yidong on Sun, 6 Nov 2011 14:43:43 +0800) X-Scanned-By: MIMEDefang 2.71 on 15.0.152.124 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 192.6.19.124 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145907 Archived-At: Chong Yidong wrote: > Mark Lillibridge writes: > > > I've found at least one bug (get messages destroys all white space at > > the end of the last message already in the mailbox) in Rmail 23 > > I think that's coming from this code in rmail-get-new-mail: > > ;; In case of brain damage caused by require-final-newline. > (goto-char (point-max)) > (skip-chars-backward " \t\n") > (delete-region (point) (point-max)) Good eye. That is indeed the primary cause of the bug. They need to be replaced with code that fixes up the mbox damage caused by this bug; e.g., add newline's until the file ends with at least one blank line. There's another bug further downstream revealed by that fix, however. In rmail.el:2022 in the rmail-insert-inbox-text function is: ;; Determine if a pair of newline message separators need ;; to be added to the new collection of messages. This is ;; the case for all new message collections added to a ;; non-empty mail file. (unless (zerop size) (save-restriction (let ((start (point-min))) (widen) (unless (eq start (point-min)) (goto-char start) (insert "\n\n") (setq size (+ 2 size)))))) This code is compensating for the previous broken code and needs to be deleted. I'm working on a patch and will include it with my official bug report, hopefully later today. > > Unless told otherwise, I'm going to assume that Rmail 23 is supposed > > be using the mboxo/mboxrd mailbox format (see > > http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/mail-mbox-formats.html). > > IIRC, it is supposed to use the mboxrd format. For instance, the > unquoting of From lines for message display is handled by this code in > rmail-show-message-1: > > ;; Unquote quoted From lines > (while (re-search-forward "^>+From " nil t) > (beginning-of-line) > (delete-char 1) > (forward-line)) Ok. Can we document this somewhere? I'm happy to write up some text describing mboxrd if desired. Rmail edit assumes mboxo by the way so the codebase is inconsistent. > > In particular, this means that: > > > > Each message is preceded by a From_ line and followed by a blank > > line. A From_ line is a line that begins with the five characters > > 'F', 'r', 'o', 'm', and ' '. > > > > Rmail 23 does not comply correctly with this. For example, it fails > > to add a blank line after the last message. > > I think that's the purpose of this code from rmail-insert-inbox-text: > > > ;; Determine if a pair of newline message separators need > ;; to be added to the new collection of messages. This is > ;; the case for all new message collections added to a > ;; non-empty mail file. > (unless (zerop size) > (save-restriction > (let ((start (point-min))) > (widen) > (unless (eq start (point-min)) > (goto-char start) > (insert "\n\n") > (setq size (+ 2 size)))))) > (goto-char (point-max)) > (or (= (preceding-char) ?\n) > (zerop size) > (insert ?\n)) > > Maybe it's not doing the right thing in some circumstances? More like doing the wrong thing in all circumstances when this bug is fixed. It mostly compensates for the bug when there is new mail but as it doesn't run when there is no new mail, it fails to always compensate. - Mark