From petefrench@ticketswitch.com  Wed Feb 18 23:03:27 2009
Return-Path: <petefrench@ticketswitch.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 400231065673
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Feb 2009 23:03:27 +0000 (UTC)
	(envelope-from petefrench@ticketswitch.com)
Received: from constantine.ticketswitch.com (constantine.ticketswitch.com [IPv6:2002:57e0:1d4e:1::3])
	by mx1.freebsd.org (Postfix) with ESMTP id 023128FC18
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Feb 2009 23:03:26 +0000 (UTC)
	(envelope-from petefrench@ticketswitch.com)
Received: from dilbert.rattatosk ([10.64.50.6] helo=dilbert.ticketswitch.com)
	by constantine.ticketswitch.com with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.69 (FreeBSD))
	(envelope-from <petefrench@ticketswitch.com>)
	id 1LZvRn-00051f-AH
	for FreeBSD-gnats-submit@freebsd.org; Wed, 18 Feb 2009 23:03:19 +0000
Received: from petefrench by dilbert.ticketswitch.com with local (Exim 4.69 (FreeBSD))
	(envelope-from <petefrench@ticketswitch.com>)
	id 1LZvRn-000As2-97
	for FreeBSD-gnats-submit@freebsd.org; Wed, 18 Feb 2009 23:03:19 +0000
Message-Id: <E1LZvRn-000As2-97@dilbert.ticketswitch.com>
Date: Wed, 18 Feb 2009 23:03:19 +0000
From: Pete French <petefrench@ticketswitch.com>
Reply-To: Pete French <petefrench@ticketswitch.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /usr/bin/mail misses addresses when replying to all
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         131861
>Category:       bin
>Synopsis:       [patch] mail(1) misses addresses when replying to all
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    uqs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 18 23:10:01 UTC 2009
>Closed-Date:    Fri Jun 11 12:11:20 UTC 2010
>Last-Modified:  Fri Jun 11 12:11:20 UTC 2010
>Originator:     Pete French
>Release:        FreeBSD 7.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD dilbert.rattatosk 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Mon Jan 5 13:02:14 GMT 2009 petefrench@constantine.rattatosk:/usr/obj/usr/src/sys/GENERIC amd64


>Description:

The 'R' command is supposed to reply to all recipients, but it
gets confused when the mail header does not have a space after the
comma separating the names. For example a mail like this:

	From: "Matthew Taylor" <Matt@seatem.com>
	To: "David Gilbert" <davidgilbert@ticketswitch.com>,"Pete French" <petefrench@ticketswitch.com>,"Peter Robinson" <peterrobinson@ticketswitch.com>
	CC: "Chris Martini" <chrismartini@ticketswitch.com>,"Jason McLaughlin" <jasonmclaughlin@ticketswitch.com>

when I hit 'R' only goes to addresses like this:

	To: peterrobinson@ticketswitch.com Matt@seatem.com
	Cc: jasonmclaughlin@ticketswitch.com

If, however, I edit the original to include spaces, so it looks like this:

	From: "Matthew Taylor" <Matt@seatem.com>
	To: "David Gilbert" <davidgilbert@ticketswitch.com>, "Pete French" <petefrench@ticketswitch.com>, "Peter Robinson" <peterrobinson@ticketswitch.com>
	CC: "Chris Martini" <chrismartini@ticketswitch.com>, "Jason McLaughlin" <jasonmclaughlin@ticketswitch.com>

Then reply now works properly, like this...

	To: davidgilbert@ticketswitch.com peterrobinson@ticketswitch.com Matt@seatem.com
	Cc: chrismartini@ticketswitch.com jasonmclaughlin@ticketswitch.com

The mails with ," instead of , " appear to be generated by Microsoft
email software, and I have not checked to see if they are RFC compliant. But
they are out there live, and are the cause of much annoyance when replying
to mail.

>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:

From: Pete French <petefrench@ticketswitch.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131861: mail(1) misses addresses when replying to all
Date: Sat, 21 Feb 2009 20:28:13 +0000

 I did a bit of further investigation, and the problem is the "skin()"
 function in aux.c stripping out the wanted addresses. This function
 could use some attention, but the couple of simple modifications I made
 to try and fix it have not worked, and I think someone needs to sit down
 with RFC822 and try and work out what on earth it is doing!
 
 

From: Pete French <petefrench@ticketswitch.com>
To: bug-followup@FreeBSD.org, petefrench@ticketswitch.com
Cc:  
Subject: Re: bin/131861: mail(1) misses addresses when replying to all
Date: Tue, 02 Feb 2010 14:19:34 +0000

 The following patch (to util.c, not aux.c - that was an error!) appears 
 to fix this.
 It allows a comma to be followed directly by a quotation mark as well as 
 a space.
 The space skipping code needs a minor adaptation to allow it to work when
 the current character is not a space, hence the second change.
 
 
 --- usr.bin/mail/util.c.orig    2010-02-02 14:10:34.220987358 +0000
 +++ usr.bin/mail/util.c 2010-02-02 14:12:49.968147827 +0000
 @@ -496,10 +496,10 @@
                                  *cp2++ = ' ';
                          }
                          *cp2++ = c;
 -                       if (c == ',' && *cp == ' ' && !gotlt) {
 +                       if (c == ',' && (*cp == ' ' || *cp == '"') && 
 !gotlt) {
                                  *cp2++ = ' ';
 -                               while (*++cp == ' ')
 -                                       ;
 +                               while (*cp == ' ')
 +                                       cp++;
                                  lastsp = 0;
                                  bufend = cp2;
                          }
 

From: Pete French <petefrench@ticketswitch.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131861: [patch] mail(1) misses addresses when replying to all
Date: Tue, 16 Feb 2010 17:05:23 +0000

 Looks like my last email messed up the formatting of the patch. here it is
 with the tabs hopefully properly preserved!
 
 --- usr.bin/mail/util.c.orig	2010-02-02 14:10:34.220987358 +0000
 +++ usr.bin/mail/util.c	2010-02-16 09:31:08.924384302 +0000
 @@ -496,10 +496,10 @@
  				*cp2++ = ' ';
  			}
  			*cp2++ = c;
 -			if (c == ',' && *cp == ' ' && !gotlt) {
 +			if (c == ',' && (*cp == ' ' || *cp == '"') && !gotlt) {
  				*cp2++ = ' ';
 -				while (*++cp == ' ')
 -					;
 +				while (*cp == ' ')
 +					cp++;
  				lastsp = 0;
  				bufend = cp2;
  			}
Responsible-Changed-From-To: freebsd-bugs->uqs 
Responsible-Changed-By: uqs 
Responsible-Changed-When: Wed Apr 14 16:34:34 UTC 2010 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131861 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131861: commit references a PR
Date: Thu, 27 May 2010 12:59:59 +0000 (UTC)

 Author: uqs
 Date: Thu May 27 12:59:49 2010
 New Revision: 208592
 URL: http://svn.freebsd.org/changeset/base/208592
 
 Log:
   mail(1) misses addresses when replying to all
   
   There's a parsing error for fields where addresses are not separated by
   space. This is often produced by MS Outlook, eg.:
   Cc: <foo@bar.com>,"Mr Foo" <foo@baz.com>
   
   The following line now splits into the right tokens:
   Cc: f@b.com,z@y.de, <a@a.de>,<c@c.de>, "foo" <foo>,"bar" <bar>
   
   PR:		bin/131861
   Submitted by:	Pete French <petefrench at ticketswitch.com>
   Tested by:	Pete French
   Reviewed by:	mikeh
   MFC after:	2 weeks
 
 Modified:
   head/usr.bin/mail/util.c
 
 Modified: head/usr.bin/mail/util.c
 ==============================================================================
 --- head/usr.bin/mail/util.c	Thu May 27 12:54:42 2010	(r208591)
 +++ head/usr.bin/mail/util.c	Thu May 27 12:59:49 2010	(r208592)
 @@ -496,10 +496,11 @@ skin(name)
  				*cp2++ = ' ';
  			}
  			*cp2++ = c;
 -			if (c == ',' && *cp == ' ' && !gotlt) {
 +			if (c == ',' && !gotlt &&
 +			    (*cp == ' ' || *cp == '"' || *cp == '<')) {
  				*cp2++ = ' ';
 -				while (*++cp == ' ')
 -					;
 +				while (*cp == ' ')
 +					cp++;
  				lastsp = 0;
  				bufend = cp2;
  			}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: uqs 
State-Changed-When: Thu May 27 13:13:38 UTC 2010 
State-Changed-Why:  
Patched in head, going to MFC in a fortnight. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131861 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131861: commit references a PR
Date: Fri, 11 Jun 2010 11:24:32 +0000 (UTC)

 Author: uqs
 Date: Fri Jun 11 11:24:23 2010
 New Revision: 209038
 URL: http://svn.freebsd.org/changeset/base/209038
 
 Log:
   MFC r208592: mail(1) misses addresses when replying to all
   
   There's a parsing error for fields where addresses are not separated by
   space. This is often produced by MS Outlook.
   
   PR:		bin/131861
   Submitted by:	Pete French <petefrench at ticketswitch.com>
   Tested by:	Pete French
   Reviewed by:	mikeh
   Approved by:	re (kib)
 
 Modified:
   stable/8/usr.bin/mail/util.c
 Directory Properties:
   stable/8/usr.bin/mail/   (props changed)
 
 Modified: stable/8/usr.bin/mail/util.c
 ==============================================================================
 --- stable/8/usr.bin/mail/util.c	Fri Jun 11 09:27:33 2010	(r209037)
 +++ stable/8/usr.bin/mail/util.c	Fri Jun 11 11:24:23 2010	(r209038)
 @@ -496,10 +496,11 @@ skin(name)
  				*cp2++ = ' ';
  			}
  			*cp2++ = c;
 -			if (c == ',' && *cp == ' ' && !gotlt) {
 +			if (c == ',' && !gotlt &&
 +			    (*cp == ' ' || *cp == '"' || *cp == '<')) {
  				*cp2++ = ' ';
 -				while (*++cp == ' ')
 -					;
 +				while (*cp == ' ')
 +					cp++;
  				lastsp = 0;
  				bufend = cp2;
  			}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: uqs 
State-Changed-When: Fri Jun 11 12:10:15 UTC 2010 
State-Changed-Why:  
Patch has been applied to RELENG_8 and will be in 8.1-RELEASE 

Thanks for your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131861 
>Unformatted:
