GNU bug report logs - #7743
unrmail loses extra blank line at end of message

Previous Next

Package: emacs;

Reported by: mark.lillibridge <at> hp.com

Date: Mon, 27 Dec 2010 19:48:02 UTC

Severity: minor

Tags: patch

Fixed in version 24.0.92

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7743 in the body.
You can then email your comments to 7743 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7743; Package emacs. (Mon, 27 Dec 2010 19:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mark.lillibridge <at> hp.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Dec 2010 19:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: bug-gnu-emacs <at> gnu.org
Subject: unrmail loses extra blank line at end of message
Date: Mon, 27 Dec 2010 11:54:10 -0800
    As of at least Emacs 23.1 and still present in version 24, unrmail
throws away the last blank line of a message if present.  The offending
code is in unrmail.el:

unrmail.el:235:
	    ;; Make sure the message ends with two newlines
	    (goto-char (point-max))
	    (unless (looking-back "\n\n")
	      (insert "\n"))

This is wrong!  Mbox format ends every message with a blank line, which
is not part of the message, so this code by failing to add the necessary
terminator blank line to messages that already end with a blank line
effectively removes the last blank line of such messages.


    The fix is easy: just always add the blank line like so:

unrmail.el:235:
	    ;; Add terminator blank line to message
	    (goto-char (point-max))
	    (insert "\n")


- Mark
PS, the patch for this change hopefully is:

ts-rhel5 [106]% diff original-unrmail.el new-unrmail.el
235c235
<           ;; Make sure the message ends with two newlines
---
>           ;; Add terminator blank line to message
237,238c237
<           (unless (looking-back "\n\n")
<             (insert "\n"))
---
>           (insert "\n")




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7743; Package emacs. (Sun, 13 Nov 2011 20:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 7743 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: 7743 <at> debbugs.gnu.org
Subject: bug #7743: unrmail loses extra blank line at end of message [PATCH]
Date: Sun, 13 Nov 2011 11:59:58 -0800
    The automatic system seems not to have noticed, but I provided a
patch for this bug:

ts-rhel5 [124]% ( setenv LC_ALL C ; setenv TZ UTC0 ; diff -Naur original-unrmail.el unrmail.el)
--- original-unrmail.el 2011-11-13 19:57:25.156549000 +0000
+++ unrmail.el  2011-11-13 19:58:34.826505000 +0000
@@ -232,10 +232,9 @@
              (while (search-forward "\nFrom " nil t)
                (forward-char -5)
                (insert ?>)))
-           ;; Make sure the message ends with two newlines
+           ;; Add terminator blank line to message
            (goto-char (point-max))
-           (unless (looking-back "\n\n")
-             (insert "\n"))
+           (insert "\n")
            ;; Write it to the output file, suitably encoded.
            (let ((coding-system-for-write coding))
              (write-region (point-min) (point-max) to-file t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7743; Package emacs. (Wed, 16 Nov 2011 07:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 7743 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: mark.lillibridge <at> hp.com
Cc: 7743 <at> debbugs.gnu.org
Subject: Re: bug#7743: unrmail loses extra blank line at end of message
Date: Wed, 16 Nov 2011 02:52:53 -0500
Mark Lillibridge wrote:

>     As of at least Emacs 23.1 and still present in version 24, unrmail
> throws away the last blank line of a message if present.

This sounds very believable, but I am having a hard time convinving
myself.

I used the system `mail' command to send myself a few mails ending in
blank lines. I used Emacs 22.3 to convert the resulting mail spool file
to Babyl, then the current trunk's unrmail to convert that Babyl back to
mbox. The mbox I got back was identical to the original mail spool
(modulo the addition of X-RMAIL-ATTRIBUTES and X-Coding-System) headers.

So I cannot see that blank lines are going missing (unless going from
Babyl to mbox adds one, and going the other way subtracts one?).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7743; Package emacs. (Sat, 19 Nov 2011 20:30:02 GMT) Full text and rfc822 format available.

Message #14 received at 7743 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 7743 <at> debbugs.gnu.org
Subject: Re: bug#7743: unrmail loses extra blank line at end of message
Date: Sat, 19 Nov 2011 12:28:00 -0800
Glenn wrote:
>  Mark Lillibridge wrote:
>  
>  >     As of at least Emacs 23.1 and still present in version 24, unrmail
>  > throws away the last blank line of a message if present.
>  
>  This sounds very believable, but I am having a hard time convinving
>  myself.
>  
>  I used the system `mail' command to send myself a few mails ending in
>  blank lines. I used Emacs 22.3 to convert the resulting mail spool file
>  to Babyl, then the current trunk's unrmail to convert that Babyl back to
>  mbox. The mbox I got back was identical to the original mail spool
>  (modulo the addition of X-RMAIL-ATTRIBUTES and X-Coding-System) headers.
>  
>  So I cannot see that blank lines are going missing (unless going from
>  Babyl to mbox adds one, and going the other way subtracts one?).

    You got it!  Examine the BABYL file and you will see that Rmail 22.3
has added an extra blank line after each of your messages.  That was a
recent (pre transformation to 23) RMAIL bug, I believe.  My older email
does not have these extra blank lines.  I haven't reported all the Rmail
22 bugs I've found because they are moot at this point.

- Mark
PS, I will send you (Glenn) my relevant test files in case you didn't
keep yours.




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Wed, 23 Nov 2011 07:52:01 GMT) Full text and rfc822 format available.

Notification sent to mark.lillibridge <at> hp.com:
bug acknowledged by developer. (Wed, 23 Nov 2011 07:52:02 GMT) Full text and rfc822 format available.

Message #19 received at 7743-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 7743-done <at> debbugs.gnu.org
Subject: Re: bug#7743: unrmail loses extra blank line at end of message
Date: Wed, 23 Nov 2011 02:50:29 -0500
Version: 24.0.92

Mark Lillibridge wrote:

>>  So I cannot see that blank lines are going missing (unless going from
>>  Babyl to mbox adds one, and going the other way subtracts one?).
>
>     You got it!  Examine the BABYL file and you will see that Rmail 22.3
> has added an extra blank line after each of your messages.  That was a
> recent (pre transformation to 23) RMAIL bug, I believe.  My older email
> does not have these extra blank lines. 

It sort of makes me wonder if it is worth changing this now, because if
most BABYL files started life as mbox files but were converted by Emacs,
then they have an extra blank line.

But anyway, I installed this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7743; Package emacs. (Sat, 26 Nov 2011 06:08:01 GMT) Full text and rfc822 format available.

Message #22 received at 7743 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: <7743 <at> debbugs.gnu.org>
Cc: rgm <at> gnu.org
Subject: Re: bug#7743: closed (Re: bug#7743: unrmail loses extra blank line at
	end of message)
Date: Fri, 25 Nov 2011 22:06:05 -0800
Glenn Morris writes:
>  Mark Lillibridge wrote:
>  
>  >>  So I cannot see that blank lines are going missing (unless going from
>  >>  Babyl to mbox adds one, and going the other way subtracts one?).
>  >
>  >     You got it!  Examine the BABYL file and you will see that Rmail 22.3
>  > has added an extra blank line after each of your messages.  That was a
>  > recent (pre transformation to 23) RMAIL bug, I believe.  My older email
>  > does not have these extra blank lines. 
>  
>  It sort of makes me wonder if it is worth changing this now, because if
>  most BABYL files started life as mbox files but were converted by Emacs,
>  then they have an extra blank line.

        The adding an extra line on incorporation is a recent bug; my
older BABYL files don't have the extra blank lines.

- Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 24 Dec 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.