From dsf@mail1.nywebworks.com  Sat Feb 21 14:16:30 2004
Return-Path: <dsf@mail1.nywebworks.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A76F316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Feb 2004 14:16:30 -0800 (PST)
Received: from mail1.nywebworks.com (unknown [216.42.81.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 591AE43D1F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Feb 2004 14:16:30 -0800 (PST)
	(envelope-from dsf@mail1.nywebworks.com)
Received: from mail1.nywebworks.com (localhost [127.0.0.1])
	by mail1.nywebworks.com (8.12.11/8.12.9) with ESMTP id i1LMGRE6016927
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Feb 2004 17:16:27 -0500 (EST)
	(envelope-from dsf@mail1.nywebworks.com)
Received: (from root@localhost)
	by mail1.nywebworks.com (8.12.11/8.12.9/Submit) id i1LMGRHj016926;
	Sat, 21 Feb 2004 17:16:27 -0500 (EST)
	(envelope-from dsf)
Message-Id: <200402212216.i1LMGRHj016926@mail1.nywebworks.com>
Date: Sat, 21 Feb 2004 17:16:27 -0500 (EST)
From: Dan Foster <dsf@globalcrossing.net>
Reply-To: Dan Foster <dsf@globalcrossing.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: mutt change breaks vim syntax highlighting
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         63192
>Category:       ports
>Synopsis:       mutt change breaks vim syntax highlighting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 21 14:20:11 PST 2004
>Closed-Date:    Mon May 10 04:39:39 PDT 2004
>Last-Modified:  Mon May 10 07:30:21 PDT 2004
>Originator:     Dan Foster
>Release:        FreeBSD 4.9-RELEASE-p2 i386
>Organization:
New York Web Works
>Environment:
System: FreeBSD mail1.nywebworks.com 4.9-RELEASE-p2 FreeBSD 4.9-RELEASE-p2 #9: Mon Feb 9 00:01:13 EST 2004 root@mail1.nywebworks.com:/usr/src/sys/compile/MAIL1 i386


	1 GHz Intel Pentium III (Coppermine), FreeBSD 4.9-RELEASE
>Description:
	The default builds of mutt no longer creates temporary files in the format of mutt-<short hostname>-<pid>-<revision number>. The current temporary file naming is apparently mutt-<short hostname>-<8 chars random string>. 
	
	This breaks syntax highlighting if your editor is vim because vim no longer enables syntax highlighting for mutt mail messages due to the change in the mutt temporary file naming. A fix is provided.

	While mutt is the culprit, the fix is trivial and should be done by the vim ports maintainer since this is really specific to vim, and not mutt -- mutt can interoperate with any number of editors; but this one is a vim-specific issue even though it is mutt that changed the naming.
>How-To-Repeat:
	Using SecureCRT (or equivalent ssh client), I have vt100 emulation and ANSI coloring enabled. My ~/.login (tcsh shell) has 'set term=xterm'. My ~/.vimrc file has 'syntax enable'. Both mutt and vim were from ports, default build options.

	Run latest mutt from ports, and reply to any mail message. It will fail to apply syntax highlighting to the mail message header lines.

	Reproduced after original informal problem report from another user.
>Fix:

	patch /usr/local/share/vim/vim62/filetype.vim and add an additional check to the line that has an au(tocommand) matching mutt-*-\d\+.
	
	To this line, add a new check:

	mutt-*-\w\{8\}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->obrien  
Responsible-Changed-By: krion 
Responsible-Changed-When: Sat Feb 21 14:35:54 PST 2004 
Responsible-Changed-Why:  
Over to maintainer. 

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

From: Dan Foster <dsf@globalcrossing.net>
To: freebsd-gnats-submit@FreeBSD.org, dsf@globalcrossing.net,
	obrien@FreeBSD.org, ports@FreeBSD.org
Cc: Jean-Baptiste Quenot <jb.quenot@caraldi.com>
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Wed, 24 Mar 2004 17:17:58 +0000

 Hot Diggety! Jean-Baptiste Quenot was rumored to have written:
 > Please find  attached a  patch for filetype.vim.   Just commit  it, it's
 > pretty straightforward.
 
 I agree the patch looks good. It is exactly the same as the local
 modification we used in-house. Thanks!!
 
 -Dan

From: Jean-Baptiste Quenot <jb.quenot@caraldi.com>
To: freebsd-gnats-submit@FreeBSD.org, dsf@globalcrossing.net
Cc: obrien@FreeBSD.org, ports@freebsd.org
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Wed, 24 Mar 2004 18:46:44 +0100

 --CE+1k2dSO48ffgeK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Please find  attached a  patch for filetype.vim.   Just commit  it, it's
 pretty straightforward.
 
 Thanks in advance,
 -- 
 Jean-Baptiste Quenot
 http://caraldi.com/jbq/
 
 --CE+1k2dSO48ffgeK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-02
 
 --- runtime/filetype.vim.orig	Tue May 27 21:03:50 2003
 +++ runtime/filetype.vim	Wed Mar 24 18:13:11 2004
 @@ -684,7 +684,7 @@
  au BufNewFile,BufRead *.mgp			setf mgp
  
  " Mail (for Elm, trn, mutt, rn, slrn)
 -au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\d\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
 +au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\d\+,mutt\w\{6\},mutt-*-\w\{8\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
  
  " Mailcap configuration file
  au BufNewFile,BufRead .mailcap,mailcap		setf mailcap
 
 --CE+1k2dSO48ffgeK--
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Wed Mar 24 10:16:38 PST 2004 
State-Changed-Why:  
General Vim problem, please report to the vim development list; 
vim-dev@vim.org. 

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

From: "David O'Brien" <obrien@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, dsf@globalcrossing.net,
	ports@FreeBSD.org
Cc:  
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Wed, 24 Mar 2004 10:16:28 -0800

 On Wed, Mar 24, 2004 at 06:46:44PM +0100, Jean-Baptiste Quenot wrote:
 > Please find  attached a  patch for filetype.vim.   Just commit  it,
 
 Hi Jean-Baptiste, thanks for the patch, but I won't be committing it.
 
 > it's pretty straightforward.
 
 Just email it to the vim development list, its pretty straightforward.
 FreeBSD will then get this change on a later vendor patch (we're now up
 to 399 -- the vendor is very responsive).

From: Dan Foster <dsf@globalcrossing.net>
To: "David O'Brien" <obrien@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org, dsf@globalcrossing.net,
	ports@FreeBSD.org, Jean-Baptiste Quenot <jb.quenot@caraldi.com>
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Wed, 24 Mar 2004 21:15:20 +0000

 Hot Diggety! David O'Brien was rumored to have written:
 > On Wed, Mar 24, 2004 at 06:46:44PM +0100, Jean-Baptiste Quenot wrote:
 > > Please find  attached a  patch for filetype.vim.   Just commit  it,
 > 
 > Hi Jean-Baptiste, thanks for the patch, but I won't be committing it.
 > 
 > > it's pretty straightforward.
 > 
 > Just email it to the vim development list, its pretty straightforward.
 > FreeBSD will then get this change on a later vendor patch (we're now up
 > to 399 -- the vendor is very responsive).
 
 Sent it to vim-dev and credited Jean-Baptiste.
 
 -Dan

From: Dan Foster <dsf@globalcrossing.net>
To: "David O'Brien" <obrien@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org, dsf@globalcrossing.net,
	ports@FreeBSD.org
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Fri, 26 Mar 2004 04:27:41 +0000

 I'd like to revisit this because I've come across some more information
 that paints things in a different light.
 
 Specifically, what changed mutt's behavior for the temp file name is
 patch 'patch-mktemp' supplied by the FreeBSD ports maintainer for mutt.
 
 I just checked the mutt 1.4 and 1.5 source trees (multiple versions),
 and in the unmodified mutt sources, mutt-<version/muttlib.c has this
 function:
 
 void mutt_mktemp (char *s)
 {
   snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir),
 NONULL(Hostname), (int) getpid (), Counter++);
   unlink (s);
 }
 
 The FreeBSD patch -- which doesn't seem to have come from the mutt
 developers -- has this modification:
 
 --- muttlib.c.orig      Mon Feb  9 08:25:28 2004
 +++ muttlib.c   Mon Feb  9 08:32:46 2004
 @@ -656,7 +656,8 @@
 
  void mutt_mktemp (char *s)
  {
 -  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir),
    NONULL(Hostname), (int) getpid (), Counter++);
 +  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir),
 NONULL(Hostname));
 +  mktemp (s);
    unlink (s);
  }
 
 My point is that if mutt's behavior changed due to a FreeBSD-specific
 decision, rather than a change made by the mutt developers, then a
 FreeBSD-specific patch (for the syntax highlighting autocommand) should
 also be committed to vim to keep mutt and vim in sync.
 
 A reasonable person couldn't expect the vim team to accept a patch for
 supporting a change in runtime.vim due to a change in mutt that was not
 committed by the mutt developers and is specific only to FreeBSD.
 
 This appears to be why vim developers will not commit the patch, and
 they seem to be on solid ground with that position given the reasoning.
 
 So I would, therefore, like to politely request reconsideration of the
 proposed vim patch for inclusion to the FreeBSD vim port or to have the
 mutt patch-mktemp patch backed out.
 
 Either change would be sufficient to keep the two in sync and remain
 consistent with policy regarding local changes.
 
 -Dan
State-Changed-From-To: closed->analyzed 
State-Changed-By: obrien 
State-Changed-When: Tue Apr 6 22:54:40 PDT 2004 
State-Changed-Why:  
Looks like a FreeBS speicfic issue. 
We need to understand why the change is made in the Mutt port vs. using the stock Mutt code. 

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

From: Udo Schweigert <Udo.Schweigert@siemens.com>
To: Dan Foster <dsf@globalcrossing.net>
Cc: "David O'Brien" <obrien@FreeBSD.org>, ports@FreeBSD.org,
	freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Thu, 22 Apr 2004 15:38:51 +0200

 On Fri, Mar 26, 2004 at 04:27:41 +0000, Dan Foster wrote:
 > I'd like to revisit this because I've come across some more information
 > that paints things in a different light.
 > 
 > Specifically, what changed mutt's behavior for the temp file name is
 > patch 'patch-mktemp' supplied by the FreeBSD ports maintainer for mutt.
 > 
 > I just checked the mutt 1.4 and 1.5 source trees (multiple versions),
 > and in the unmodified mutt sources, mutt-<version/muttlib.c has this
 > function:
 > 
 > void mutt_mktemp (char *s)
 > {
 >   snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir),
 > NONULL(Hostname), (int) getpid (), Counter++);
 >   unlink (s);
 }}
 > 
 > The FreeBSD patch -- which doesn't seem to have come from the mutt
 > developers -- has this modification:
 > 
 > --- muttlib.c.orig      Mon Feb  9 08:25:28 2004
 > +++ muttlib.c   Mon Feb  9 08:32:46 2004
 > @@ -656,7 +656,8 @@
 > 
 >  void mutt_mktemp (char *s)
 >  {
 > -  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir),
 >    NONULL(Hostname), (int) getpid (), Counter++);
 > +  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir),
 > NONULL(Hostname));
 > +  mktemp (s);
 >    unlink (s);
  }}
 > 
 > My point is that if mutt's behavior changed due to a FreeBSD-specific
 > decision, rather than a change made by the mutt developers, then a
 > FreeBSD-specific patch (for the syntax highlighting autocommand) should
 > also be committed to vim to keep mutt and vim in sync.
 > 
 > A reasonable person couldn't expect the vim team to accept a patch for
 > supporting a change in runtime.vim due to a change in mutt that was not
 > committed by the mutt developers and is specific only to FreeBSD.
 > 
 > This appears to be why vim developers will not commit the patch, and
 > they seem to be on solid ground with that position given the reasoning.
 > 
 > So I would, therefore, like to politely request reconsideration of the
 > proposed vim patch for inclusion to the FreeBSD vim port or to have the
 > mutt patch-mktemp patch backed out.
 > 
 > Either change would be sufficient to keep the two in sync and remain
 > consistent with policy regarding local changes.
 
 As also written in another mail today (this is for gnats):
 
 Adding the patch was done by another user's request, because the current mutt
 code causes problems on open-session machines, when PIDs are reused and thus
 mutt sometimes failes to open a tmp-file because it's already opened by
 another user. Another benefit is that the usage of mktemp() gives (a little)
 more security here.
 
 I also submitted that to the mutt developers mailing list, but it seems it
 hasn't been incorporated into the sources yet - and I doubt it will be done
 soon, because the whole handling of tmp-files in mutt should be rewritten ...
 
 A possible workaround would be to change the FreeBSD-patch so that the used
 tmp-filenames are compatible with vim. That will again lower them security
 as one would have to do something like that:
 
 --- muttlib.c.orig	Thu Apr 22 14:43:58 2004
 +++ muttlib.c	Thu Apr 22 14:51:01 2004
 @@ -657,7 +657,11 @@
  
  void _mutt_mktemp (char *s, const char *src, int line)
  {
 -  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++);
 +  char t[5];
 +  snprintf (t, 5, "-%03d", Counter++);
 +  snprintf (s, _POSIX_PATH_MAX-5, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname));
 +  mktemp (s);
 +  strncat(s, t, _POSIX_PATH_MAX);
    dprint (1, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
    unlink (s);
  }
 
 (Unfortunately there's no mktemps(), and mkstemps() isn't usable here)
 
 It's a bit ugly but it works ;-)
 
 
 So for me it's up to David O'Brien to decide on either to add a
 FreeBSD-specific patch to the vim port(s) or to let me change the patch as
 shown above. I won't have a problem with either decission.
 
 
 Best regards
 
 --
 Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
 CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
 D-81730 Muenchen / Germany   | email      : udo.schweigert@siemens.com

From: Udo Schweigert <Udo.Schweigert@siemens.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: "David O'Brien" <obrien@FreeBSD.org>
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Mon, 10 May 2004 12:14:44 +0200

 I submitted now two patches for mutt (PR 66443) and mutt-devel (PR 66444)
 which solve the problem without a change to the vim-port.
 
 After they got committed this PR can be closed.
 
 
 Best regards
 
 --
 Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
 CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
 D-81730 Muenchen / Germany   | email      : udo.schweigert@siemens.com
State-Changed-From-To: analyzed->closed 
State-Changed-By: krion 
State-Changed-When: Mon May 10 04:39:12 PDT 2004 
State-Changed-Why:  
Superseded by ports/66443 ports/66444 

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

From: "David O'Brien" <obrien@FreeBSD.org>
To: Udo Schweigert <Udo.Schweigert@siemens.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/63192: mutt change breaks vim syntax highlighting
Date: Mon, 10 May 2004 07:24:55 -0700

 On Mon, May 10, 2004 at 12:14:44PM +0200, Udo Schweigert wrote:
 > I submitted now two patches for mutt (PR 66443) and mutt-devel (PR 66444)
 > which solve the problem without a change to the vim-port.
 
 Thank you!  I think this is best as with us patching Mutt, we can only
 "fix" Vim when built from ports and not stock sources.
  
 -- 
 -- David  (obrien@FreeBSD.org)
>Unformatted:
