exmh-2.7.2_3 mangles attachments with file names >= 59 chars

"Julian H. Stacey" <[email protected]> Mon, 10 Sep 2012 18:16:44 +0200
Newsgroups gmane.mail.exmh.user
Organization http://berklix.com BSD Unix Linux Consultancy, Munich Germany
Message-ID <[email protected]>
Hi [email protected]
Bug Report:
Attaching a long file name >= 59 chars, the data content gets mangled !
With exmh-2.7.2_3 + nmh-1.2_3 + OS=FreeBSD 8.2-RELEASE
(all localy compiled BTW)

Is this is an EXMH bug, or an nmh bug to report elsewhere please ?

Samples generated by clicking:
	More
	Sedit
	More
	Attachment
	Attach file
	(accept default encapsulation) None
	OK
	Send

I originally spotted this error also using base64, sending a file of name
	2012_09_07_after_submitting_to_companies_house_saved_from_firefox_AbbreviatedAccounts.html

BTW don't use trailing _ in names to test, as that gets truncated & won't trigger the fault.

Here are 6 extracts { good & bad } x { sent mail, received mail , original data }
+ notices to guide eyes to the differences.

Here is an extract from my sent/ directory of a good Mime encapsulation (58 chars) going out
	-------
	X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2
	to: jhs
	Subject: Re: test name length 58
	Mime-Version: 1.0
	Content-Type: multipart/mixed ;
		boundary="==_Exmh_1347287471_159880"
	Date: Mon, 10 Sep 2012 16:31:15 +0200
	Sender: [email protected]
	
	This is a multipart MIME message.
	
	- --==_Exmh_1347287471_159880
	Content-Type: text/plain; charset=iso-8859-1
	Content-Transfer-Encoding: quoted-printable
	
	test name length 58
	
	
	
	- --==_Exmh_1347287471_159880
	Content-Type: text/plain ; name="58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa"; charset=iso-8859-1
	Content-Description: 58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa
	Content-Disposition: attachment; filename="58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa"
	Content-Transfer-Encoding: quoted-printable
	
	<=21--?xml version=3D=221.0=22 encoding=3D=22UTF-8=22?-->
	<html xmlns=3D=22http://www.w3.org/1999/xhtml=22 xmlns:uk-bus=3D=22http:/=
	/www.xbrl.org/uk/cd/business/2009-09-01=22 xmlns:xbrl=3D=22http://www.xbr=
	l.org/2003/instance=22 xmlns:fn=3D=22http://www.w3.org/2005/xpath-functio=
	ns=22 xmlns:ix=3D=22http://www.xbrl.org/2008/inlineXBRL=22 xmlns:uk-gaap=
	=3D=22http://www.xbrl.org/uk/gaap/core/2009-09-01=22 xmlns:xbrli=3D=22htt=
	p://www.xbrl.org/2003/instance=22 xmlns:xbrldi=3D=22http://xbrl.org/2006/=
	xbrldi=22 xmlns:hmrc=3D=22http://hmrc.gov.uk/=22 xmlns:xfa=3D=22http://ww=
	w.xfa.org/schema/xfa-data/1.0/=22 xmlns:ixt=3D=22http://www.xbrl.org/inli=
	neXBRL/transformation/2010-04-20=22 xmlns:link=3D=22http://www.xbrl.org/2=
	003/linkbase=22 xmlns:uk-direp=3D=22http://www.xbrl.org/uk/reports/direp/=
	2009-09-01=22 xmlns:xsi=3D=22http://www.w3.org/2001/XMLSchema-instance=22=
	><head>
	    <meta content=3D=22text/html; charset=3DUTF-8=22 http-equiv=3D=22Cont=
	ent-Type=22>
	-------

Here is an extract from my sent/ directory of a bad one (59 chars) going out
	-------
	X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2
	to: jhs
	Subject: Re: test name length 59 
	Mime-Version: 1.0
	Content-Type: multipart/mixed ;
		boundary="==_Exmh_1347287826_159880"
	Date: Mon, 10 Sep 2012 16:37:08 +0200
	Sender: [email protected]
	
	This is a multipart MIME message.
	
	- --==_Exmh_1347287826_159880
	Content-Type: text/plain; charset=iso-8859-1
	Content-Transfer-Encoding: quoted-printable
	
	> test name length 59
	
	
	- --==_Exmh_1347287826_159880
	Content-Type: text/plain ; name="59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa"; charset=iso-8859-1
	Content-Description: 59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa
	a
	Content-Disposition: attachment; filename="59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa"
	Content-Transfer-Encoding: quoted-printable
	
	<=21--?xml version=3D=221.0=22 encoding=3D=22UTF-8=22?-->
	<html xmlns=3D=22http://www.w3.org/1999/xhtml=22 xmlns:uk-bus=3D=22http:/=
	/www.xbrl.org/uk/cd/business/2009-09-01=22 xmlns:xbrl=3D=22http://www.xbr=
	l.org/2003/instance=22 xmlns:fn=3D=22http://www.w3.org/2005/xpath-functio=
	ns=22 xmlns:ix=3D=22http://www.xbrl.org/2008/inlineXBRL=22 xmlns:uk-gaap=
	=3D=22http://www.xbrl.org/uk/gaap/core/2009-09-01=22 xmlns:xbrli=3D=22htt=
	p://www.xbrl.org/2003/instance=22 xmlns:xbrldi=3D=22http://xbrl.org/2006/=
	xbrldi=22 xmlns:hmrc=3D=22http://hmrc.gov.uk/=22 xmlns:xfa=3D=22http://ww=
	w.xfa.org/schema/xfa-data/1.0/=22 xmlns:ixt=3D=22http://www.xbrl.org/inli=
	neXBRL/transformation/2010-04-20=22 xmlns:link=3D=22http://www.xbrl.org/2=
	003/linkbase=22 xmlns:uk-direp=3D=22http://www.xbrl.org/uk/reports/direp/=
	2009-09-01=22 xmlns:xsi=3D=22http://www.w3.org/2001/XMLSchema-instance=22=
	><head>
	    <meta content=3D=22text/html; charset=3DUTF-8=22 http-equiv=3D=22Cont=
	ent-Type=22>
	-------

Note the difference in sent/ mails:
	There is a new line after 8 x 'a' at end of line Content-Description:
	then a final orphaned 'a'


Mail coming back with a good 58 char. name:
	-------
	From [email protected] Mon Sep 10 16:31:15 2012
	Received: from fire.js.berklix.net (localhost [127.0.0.1])
		by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id q8AEVFhK018949
		for <jhs>; Mon, 10 Sep 2012 16:31:15 +0200 (CEST)
		(envelope-from [email protected])
	Message-Id: <[email protected]>
	to: jhs
	Subject: Re: test name length 58
	Mime-Version: 1.0
	Content-Type: multipart/mixed ;
		boundary="==_Exmh_1347287471_159880"
	Date: Mon, 10 Sep 2012 16:31:15 +0200
	Sender: [email protected]
	
	This is a multipart MIME message.
	
	- --==_Exmh_1347287471_159880
	Content-Type: text/plain; charset=iso-8859-1
	Content-Transfer-Encoding: quoted-printable
	
	test name length 58
	
	
	
	- --==_Exmh_1347287471_159880
	Content-Type: text/plain ; name="58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa"; charset=iso-8859-1
	Content-Description: 58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa
	Content-Disposition: attachment; filename="58aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa"
	Content-Transfer-Encoding: quoted-printable
	
	<=21--?xml version=3D=221.0=22 encoding=3D=22UTF-8=22?-->
	<html xmlns=3D=22http://www.w3.org/1999/xhtml=22 xmlns:uk-bus=3D=22http:/=
	/www.xbrl.org/uk/cd/business/2009-09-01=22 xmlns:xbrl=3D=22http://www.xbr=
	-------

Mail coming back with a bad 59 char. name:
	-------
	From [email protected] Mon Sep 10 16:37:08 2012
	Received: from fire.js.berklix.net (localhost [127.0.0.1])
		by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id q8AEb8D5019032
		for <jhs>; Mon, 10 Sep 2012 16:37:08 +0200 (CEST)
		(envelope-from [email protected])
	Message-Id: <[email protected]>
	to: jhs
	Subject: Re: test name length 59 
	Mime-Version: 1.0
	Content-Type: multipart/mixed ;
		boundary="==_Exmh_1347287826_159880"
	Date: Mon, 10 Sep 2012 16:37:08 +0200
	Sender: [email protected]
	
	This is a multipart MIME message.
	
	- --==_Exmh_1347287826_159880
	Content-Type: text/plain; charset=iso-8859-1
	Content-Transfer-Encoding: quoted-printable
	
	> test name length 59
	
	
	- --==_Exmh_1347287826_159880
	Content-Type: text/plain ; name="59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa"; charset=iso-8859-1
	Content-Description: 59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaa
	
	Content-Disposition: attachment; filename="59aaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa9aaaaaaaaa"
	Content-Transfer-Encoding: quoted-printable
	
	<=21--?xml version=3D=221.0=22 encoding=3D=22UTF-8=22?-->
	<html xmlns=3D=22http://www.w3.org/1999/xhtml=22 xmlns:uk-bus=3D=22http:/=
	/www.xbrl.org/uk/cd/business/2009-09-01=22 xmlns:xbrl=3D=22http://www.xbr=
	-------

Note the difference in mails back:
	A missing 9th 'a' at end of Content-Description
	A rogue unwanted new line after Content-Description before Content-Disposition

Original source data file, First 3 lines:
	--------
	<!--?xml version="1.0" encoding="UTF-8"?-->
	<html xmlns="http://www.w3.org/1999/xhtml" xmlns:uk-bus="http://www.xbrl.org/uk/cd/business/2009-09-01" xmlns:xbrl="http://www.xbrl.org/2003/instance" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" xmlns:uk-gaap="http://www.xbrl.org/uk/gaap/core/2009-09-01" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:hmrc="http://hmrc.gov.uk/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ixt="http://www.xbrl.org/inlineXBRL/transformation/2010-04-20" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:uk-direp="http://www.xbrl.org/uk/reports/direp/2009-09-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><head>
	    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
	--------

Received file extracted by exmh, First 3 lines:
	-------
	s="http://www.w3.org/1999/xhtml" xmlns:uk-bus="http://www.xbrl.org/uk/cd/business/2009-09-01" xmlns:xbrl="http://www.xbrl.org/2003/instance" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" xmlns:uk-gaap="http://www.xbrl.org/uk/gaap/core/2009-09-01" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:hmrc="http://hmrc.gov.uk/" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns:ixt="http://www.xbrl.org/inlineXBRL/transformation/2010-04-20" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:uk-direp="http://www.xbrl.org/uk/reports/direp/2009-09-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><head>
	    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
	    <title></title>
	-------

Is this a known bug fixed later sources (which) ?
If you want me to test patches, welcome.

Thanks,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultant, Munich http://berklix.com
 Reply below not above, like a play script.  Indent old text with "> ".
 Send plain text. Not: HTML, multipart/alternative, base64, quoted-printable.