GNU bug report logs - #4448
23.1; unrmail fails if buffer has mixed line endings (patch)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: "David J. Biesack" <David.Biesack@HIDDEN>; Keywords: wontfix patch; dated Wed, 16 Sep 2009 13:35:05 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) wontfix. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) patch. Request was from Dan Nicolaescu <dann@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug reassigned from package 'emacs' to 'emacs,rmail'. Request was from Glenn Morris <rgm@HIDDEN> to control@HIDDEN. Full text available.
Added tag(s) moreinfo. Request was from Juanma Barranquero <lekktu@HIDDEN> to control@HIDDEN. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 17 Sep 2009 14:56:14 +0000
From David.Biesack@HIDDEN Thu Sep 17 07:56:13 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.0 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mercav14.na.sas.com (mercav14.na.sas.com [149.173.6.152])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8HEuC50001869
	for <4448@HIDDEN>; Thu, 17 Sep 2009 07:56:13 -0700
X-TM-IMSS-Message-ID:<1f11f0bd0003bc63@HIDDEN>
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 1f11f0bd0003bc63 ; Thu, 17 Sep 2009 10:56:04 -0400
Date: Thu, 17 Sep 2009 10:56:03 -0400
Message-Id: <ytbpr9pwrgc.fsf@HIDDEN>
From: "David J. Biesack" <David.Biesack@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
CC: 4448 <at> debbugs.gnu.org, eliz@HIDDEN
In-reply-to: <jwvbpl91xcs.fsf-monnier+emacsbugreports@HIDDEN> (message from
        Stefan Monnier on Thu, 17 Sep 2009 10:06:05 -0400)
Subject: Re: bug#4448: 23.1; unrmail fails if buffer has mixed line endings (patch)
References: <ytbr5u7m324.fsf@HIDDEN> <837hvyyfkd.fsf@HIDDEN>
        <ytb4or2ye4m.fsf@HIDDEN> <83zl8uwrx3.fsf@HIDDEN>
        <ytbws3xwwwt.fsf@HIDDEN> <jwvbpl91xcs.fsf-monnier+emacsbugreports@HIDDEN>

> From: Stefan Monnier <monnier@HIDDEN>
> CC: <4448@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
> Date: Thu, 17 Sep 2009 10:06:05 -0400
> 
> Agreed.
> Of course, maybe the ^Ms were not added by Emacs but by your networked
> file system.  

I highly doubt that - these files have mixed line endings:
the first n messages have no ^m; then remaining messages
have ^m on all lines, and this changed only on message boundaries.
(I've not inspected closely to see if any file has more
than one line ending switch.)

-- 
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com    (919) 531-7771



Acknowledgement sent to "David J. Biesack" <David.Biesack@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 17 Sep 2009 14:06:13 +0000
From monnier@HIDDEN Thu Sep 17 07:06:13 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-4.7 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MDO_DATING14,MURPHY_DRUGS_REL8 autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.181])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8HE6B0o026479
	for <4448@HIDDEN>; Thu, 17 Sep 2009 07:06:13 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Aq8EAK/esUpFxKiJ/2dsb2JhbACBU90xhBgFh38
X-IronPort-AV: E=Sophos;i="4.44,403,1249272000"; 
   d="scan'208";a="45861789"
Received: from 69-196-168-137.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.137])
  by ironport2-out.pppoe.ca with ESMTP; 17 Sep 2009 10:06:05 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id BAD2E827E; Thu, 17 Sep 2009 10:06:05 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: "David J. Biesack" <David.Biesack@HIDDEN>
Cc: 4448 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#4448: 23.1; unrmail fails if buffer has mixed line endings (patch)
Message-ID: <jwvbpl91xcs.fsf-monnier+emacsbugreports@HIDDEN>
References: <ytbr5u7m324.fsf@HIDDEN> <837hvyyfkd.fsf@HIDDEN>
	<ytb4or2ye4m.fsf@HIDDEN> <83zl8uwrx3.fsf@HIDDEN>
	<ytbws3xwwwt.fsf@HIDDEN>
Date: Thu, 17 Sep 2009 10:06:05 -0400
In-Reply-To: <ytbws3xwwwt.fsf@HIDDEN> (David J. Biesack's message of "Thu, 17
	Sep 2009 08:58:10 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

>> > If you have to modify the code to detect the situation and generate
>> > an more meaningful error message, there should be clear
>> > instructions on how to fix it.... which is still not very friendly.
>> Run it through dos2unix or "flip -u", or even find-file-literally in
>> Emacs, then remove all ^M characters and save.
> Yes, I know how to convert; I have an elisp function named ^m that
> does this, but it's an annoyance and it is unknown how many other
> users will encounter this.  Again, I assert that if Emacs created rmail
> files with ^m in them, then  Emacs should repair them, especially if
> Emacs forces mbox conversion.

Agreed.
Of course, maybe the ^Ms were not added by Emacs but by your networked
file system.  Still, if the BABYL file worked fine with Emacs-22,
I think we should try and make it work fine with Emacs-23 as well.


        Stefan



Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 17 Sep 2009 12:58:20 +0000
From David.Biesack@HIDDEN Thu Sep 17 05:58:20 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.9 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mercav16.na.sas.com (mercav16.na.sas.com [149.173.6.153])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8HCwIBS014463
	for <4448@HIDDEN>; Thu, 17 Sep 2009 05:58:19 -0700
X-TM-IMSS-Message-ID:<0e5b60aa00027bfa@HIDDEN>
Received: from d16922.us.sas.com ([10.40.12.239]) by mercav16.na.sas.com ([10.19.9.246]) with ESMTP (TREND IMSS SMTP Service 7.0) id 0e5b60aa00027bfa ; Thu, 17 Sep 2009 08:58:10 -0400
Date: Thu, 17 Sep 2009 08:58:10 -0400
Message-Id: <ytbws3xwwwt.fsf@HIDDEN>
From: "David J. Biesack" <David.Biesack@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
CC: 4448 <at> debbugs.gnu.org
In-reply-to: <83zl8uwrx3.fsf@HIDDEN> (message from Eli Zaretskii on Wed, 16
        Sep 2009 23:33:44 +0300)
Subject: Re: bug#4448: 23.1;    unrmail fails if buffer has mixed line endings (patch)
References: <ytbr5u7m324.fsf@HIDDEN> <837hvyyfkd.fsf@HIDDEN> <ytb4or2ye4m.fsf@HIDDEN> <83zl8uwrx3.fsf@HIDDEN>

> Date: Wed, 16 Sep 2009 23:33:44 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> CC: <4448@HIDDEN>
> 
> > If you have to modify the code to detect the situation and generate an more meaningful error message, there should be clear instructions on how to fix it.... which is still not very friendly.
> 
> Run it through dos2unix or "flip -u", or even find-file-literally in
> Emacs, then remove all ^M characters and save.

Yes, I know how to convert; I have an elisp function named ^m that does this,
but it's an annoyance and it is unknown how many other users will encounter
this. Again, I assert that if Emacs created rmail files with ^m in them, then 
Emacs should repair them, especially if Emacs forces mbox conversion.

-- 
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com    (919) 531-7771



Acknowledgement sent to "David J. Biesack" <David.Biesack@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 16 Sep 2009 20:34:45 +0000
From eliz@HIDDEN Wed Sep 16 13:34:45 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.9 required=4.0 tests=AWL,HAS_BUG_NUMBER,
	MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02
Received: from mtaout7.012.net.il (mtaout7.012.net.il [84.95.2.19])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8GKYhYr016595
	for <4448@HIDDEN>; Wed, 16 Sep 2009 13:34:44 -0700
Received: from conversion-daemon.i-mtaout7.012.net.il by i-mtaout7.012.net.il (HyperSendmail v2007.08) id <0KQ200200ZM41900@HIDDEN> for 4448@HIDDEN; Wed, 16 Sep 2009 23:33:43 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.70.38.189]) by i-mtaout7.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KQ200JKEZS3QJ50@HIDDEN>; Wed, 16 Sep 2009 23:33:40 +0300 (IDT)
Date: Wed, 16 Sep 2009 23:33:44 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#4448: 23.1;    unrmail fails if buffer has mixed line endings (patch)
In-reply-to: <ytb4or2ye4m.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: "David J. Biesack" <David.Biesack@HIDDEN>
Cc: 4448 <at> debbugs.gnu.org
Reply-to: Eli Zaretskii <eliz@HIDDEN>
Message-id: <83zl8uwrx3.fsf@HIDDEN>
References: <ytbr5u7m324.fsf@HIDDEN> <837hvyyfkd.fsf@HIDDEN> <ytb4or2ye4m.fsf@HIDDEN>

> Date: Wed, 16 Sep 2009 13:48:41 -0400
> From: "David J. Biesack" <David.Biesack@HIDDEN>
> CC: 4448@HIDDEN
> 
> If you have to modify the code to detect the situation and generate an more meaningful error message, there should be clear instructions on how to fix it.... which is still not very friendly.

Run it through dos2unix or "flip -u", or even find-file-literally in
Emacs, then remove all ^M characters and save.



Acknowledgement sent to Eli Zaretskii <eliz@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 16 Sep 2009 17:48:51 +0000
From David.Biesack@HIDDEN Wed Sep 16 10:48:51 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-1.7 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER,
	MDO_DATING14,MURPHY_DRUGS_REL8 autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from mercav14.na.sas.com (mercav14.na.sas.com [149.173.6.152])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8GHmnI7020328
	for <4448@HIDDEN>; Wed, 16 Sep 2009 10:48:51 -0700
X-TM-IMSS-Message-ID:<1a89a0d2000322ff@HIDDEN>
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 1a89a0d2000322ff ; Wed, 16 Sep 2009 13:48:42 -0400
Date: Wed, 16 Sep 2009 13:48:41 -0400
Message-Id: <ytb4or2ye4m.fsf@HIDDEN>
From: "David J. Biesack" <David.Biesack@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
CC: 4448 <at> debbugs.gnu.org
In-reply-to: <837hvyyfkd.fsf@HIDDEN> (message from Eli Zaretskii on Wed, 16
        Sep 2009 20:17:38 +0300)
Subject: Re: bug#4448: 23.1;    unrmail fails if buffer has mixed line endings (patch)
References: <ytbr5u7m324.fsf@HIDDEN> <837hvyyfkd.fsf@HIDDEN>

> Date: Wed, 16 Sep 2009 20:17:38 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > This causes the 
> > 
> >                   (re-search-forward "^[*][*][*] EOOH [*][*][*]\n")
> > 
> > in unrmail to fail.
> 
> Yes, by design (although the traceback is not by design).

I turned on debug-on-error to obtain the traceback
 
> > 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.
> 
> Actually, I think the correct change would be to throw an error with a
> meaningful error message.  Babyl files written by Rmail are supposed
> to have Unix EOLs.

"supposed to", but in my case, this has happened multiple times (I have over 40 rmail files with \n in them) whether because rmail-edit, rmail-output, or the fact that I'm running on Windows and my rmail files are on a unix filesystem, or something else.

If you have to modify the code to detect the situation and generate an more meaningful error message, there should be clear instructions on how to fix it.... which is still not very friendly. In that case, you may as well be more robust to begin with and just make it work, at least for this case. (My opinion; I'm certainly going to leave my patch in my installation.)

> Of course, entering the debugger is not a graceful
> reaction, but I don't think we should support incorrectly formatted
> Babyl files.  That way lies madness.

Well, this again goes back to "how did it get incorrectly formatted?" and if Emacs created the problem, Emacs should correct it. I was happily using Emacs/rmail for years until 23.1 forced me to adopt mbox format.

> Thanks.

thanks

-- 
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com    (919) 531-7771



Acknowledgement sent to "David J. Biesack" <David.Biesack@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at 4448@HIDDEN:


Received: (at 4448) by emacsbugs.donarmstrong.com; 16 Sep 2009 17:17:43 +0000
From eliz@HIDDEN Wed Sep 16 10:17:43 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER,
	MDO_DATING14,MURPHY_DRUGS_REL8 autolearn=ham
	version=3.2.5-bugs.debian.org_2005_01_02
Received: from mtaout7.012.net.il (mtaout7.012.net.il [84.95.2.19])
	by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8GHHf7t014718
	for <4448@HIDDEN>; Wed, 16 Sep 2009 10:17:43 -0700
Received: from conversion-daemon.i-mtaout7.012.net.il by i-mtaout7.012.net.il (HyperSendmail v2007.08) id <0KQ200100QL4PH00@HIDDEN> for 4448@HIDDEN; Wed, 16 Sep 2009 20:17:35 +0300 (IDT)
Received: from HOME-C4E4A596F7 ([87.70.38.189]) by i-mtaout7.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KQ200AZOQPAXR70@HIDDEN>; Wed, 16 Sep 2009 20:17:34 +0300 (IDT)
Date: Wed, 16 Sep 2009 20:17:38 +0300
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#4448: 23.1;	unrmail fails if buffer has mixed line endings (patch)
In-reply-to: <ytbr5u7m324.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: "David J. Biesack" <David.Biesack@HIDDEN>,
        4448 <at> debbugs.gnu.org
Reply-to: Eli Zaretskii <eliz@HIDDEN>
Message-id: <837hvyyfkd.fsf@HIDDEN>
References: <ytbr5u7m324.fsf@HIDDEN>

> Date: Wed, 16 Sep 2009 09:28:35 -0400
> From: "David J. Biesack" <David.Biesack@HIDDEN>
> Cc: 
> 
> 
> 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.

Yes, by design (although the traceback is not by design).

> 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.

Actually, I think the correct change would be to throw an error with a
meaningful error message.  Babyl files written by Rmail are supposed
to have Unix EOLs.  Of course, entering the debugger is not a graceful
reaction, but I don't think we should support incorrectly formatted
Babyl files.  That way lies madness.

Thanks.



Acknowledgement sent to Eli Zaretskii <eliz@HIDDEN>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 16 Sep 2009 13:28:48 +0000
From David.Biesack@HIDDEN Wed Sep 16 06:28:48 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=-0.3 required=4.0 tests=AWL,FOURLA,MDO_DATING14,
	MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02
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 <submit@HIDDEN>; Wed, 16 Sep 2009 06:28:47 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1MnuYw-0006Gw-00
	for bug-gnu-emacs@HIDDEN; Wed, 16 Sep 2009 09:28:46 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1MnuYq-0006EZ-Ue
	for bug-gnu-emacs@HIDDEN; Wed, 16 Sep 2009 09:28:45 -0400
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@HIDDEN; Wed, 16 Sep 2009 09:28:40 -0400
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 <David.Biesack@HIDDEN>)
	id 1MnuYp-0004Dg-Rn
	for bug-gnu-emacs@HIDDEN; Wed, 16 Sep 2009 09:28:40 -0400
X-TM-IMSS-Message-ID: <199b80bd0002ea81@HIDDEN>
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
Date: Wed, 16 Sep 2009 09:28:35 -0400
Message-Id: <ytbr5u7m324.fsf@HIDDEN>
From: "David J. Biesack" <David.Biesack@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 23.1; unrmail fails if buffer has mixed line endings (patch)
X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+


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 rmail-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 <return> C-x C-s <escape> 
C-x k SPC <backspace> C-g C-g C-x k SPC q C-x b R M 
<return> i I n s t a SPC <return> C-x , o i n s t a 
SPC <return> y e s <return> C-x C-f C o d e SPC P SPC 
<return> q C-x b C o d e C-s C-s <return> C-x ~ M-x 
f i n d - f i l e - l i SPC <return> C o d e P SPC 
<return> 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 <return> C-x C-s <escape> 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 <return> 
C-x C-s h C-x o C-x b I <backspace> R M <return> o 
C o d e P r o SPC <return> y e s <return> C-x C-s C-x 
k SPC C-x C-f <backspace> <return> <up> <up> <up> <up> 
<up> <down> e C-x k SPC <down> <down> <down> <down> 
<down> <down> <down> C-x o i A d d SPC <return> 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 <f2> C-e <backspace> C-d <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
t e s t - r m a i l - t o - m b o x <return> C-x o 
C-x D C-x D i t e s t 0 <backspace> - m <backspace> 
r m SPC SPC SPC SPC <return> C-x h M-w M-x r e p o 
r t 0 <backspace> - e m SPC <return>

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




Acknowledgement sent to "David J. Biesack" <David.Biesack@HIDDEN>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Report forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#4448; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 28 Feb 2017 21:45:01 UTC

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