From jdc@koitsu.org  Sun Apr 21 12:06:08 2013
Return-Path: <jdc@koitsu.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 3EE6EF97
	for <freebsd-gnats-submit@freebsd.org>; Sun, 21 Apr 2013 12:06:08 +0000 (UTC)
	(envelope-from jdc@koitsu.org)
Received: from qmta15.emeryville.ca.mail.comcast.net (qmta15.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:44:76:96:27:228])
	by mx1.freebsd.org (Postfix) with ESMTP id 276891168
	for <freebsd-gnats-submit@freebsd.org>; Sun, 21 Apr 2013 12:06:08 +0000 (UTC)
Received: from omta08.emeryville.ca.mail.comcast.net ([76.96.30.12])
	by qmta15.emeryville.ca.mail.comcast.net with comcast
	id Sc441l0020FhH24AFc68KC; Sun, 21 Apr 2013 12:06:08 +0000
Received: from koitsu.strangled.net ([67.180.84.87])
	by omta08.emeryville.ca.mail.comcast.net with comcast
	id Sc671l0071t3BNj8Uc67fF; Sun, 21 Apr 2013 12:06:07 +0000
Received: by icarus.home.lan (Postfix, from userid 1000)
	id 1534173A33; Sun, 21 Apr 2013 05:06:07 -0700 (PDT)
Message-Id: <20130421120607.1534173A33@icarus.home.lan>
Date: Sun, 21 Apr 2013 05:06:07 -0700 (PDT)
From: Jeremy Chadwick <jdc@koitsu.org>
Reply-To: Jeremy Chadwick <jdc@koitsu.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: mail/archmbox -- uses fuser(1) with incompatible flags on BSD
X-Send-Pr-Version: 3.114
X-GNATS-Notify: tad@vif.com

>Number:         178024
>Category:       ports
>Synopsis:       mail/archmbox -- uses fuser(1) with incompatible flags on BSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 21 12:10:00 UTC 2013
>Closed-Date:    Tue Aug 06 12:33:56 UTC 2013
>Last-Modified:  Tue Aug  6 12:40:00 UTC 2013
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD icarus.home.lan 9.1-STABLE FreeBSD 9.1-STABLE #0 r249160: Fri Apr 5 06:05:12 PDT 2013 root@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_9_amd64 amd64
>Description:
	It appears that archmbox supports using either fuser(1), fstat(1),
	or lsof to determine if a classic UNIX mail spool (mailbox) is
	actively in use (and thus skip it).

	src/archmbox.pl.in has this code in it:

 100 my $FUSER       = "@FUSER@";
....
1710 if ($FUSER =~ /.*fuser$/) {
1711         return system("$FUSER -s \"$mbox\"");
1712 }

	Where @FUSER@ comes from the configure phase (and is detected as
	/usr/bin/fuser on FreeBSD 9.1).

	However, the fuser syntax used is not compatible with BSD.  The -s
	argument on BSD provides a signal name to pass to the PID, rather
	than SIGKILL.  On Linux (where this software is obviously developed)
	the -s flag indicates "silent operation".

	The end result is that an error is clearly shown during operation:

fuser: illegal signal name: /home/jdc/some-spool-file
Mailbox '/home/jdc/some-spool-file': 329 messages (2.68 MB)
Archived:                            251 messages (2.11 MB)

	...as shown -- and worse -- the mail archival continues on anyway.
	This is very dangerous as there's a good chance this program could
	cause mail spool corruption as a result of the fuser use not being
	correct.  (Please do not lecture me about using Maildir format --
	let's stick to the problem at hand).

	It's very important to understand that our fuser(1) is very different
	in implementation (and output) than Linux; they are not interchangable
	and not just due to command-line flag differences.  You must read
	the entire Linux fuser man page (not skim it) to truly understand.

	There's also this entry in ChangeLog, dated 2004:

2004-05-03
Alessandro Dotti Contra <adotti@users.sourceforge.net>
* configure.in: a check for fstat was added. It can be used as a
  replacement for fuser on *BSD systems.

	Back to the archmbox code: if $FUSER matches .*fstat$ then that
	model is used, which is supposed to be BSD-compatible.  The code
	for fstat(1) support is "odd" but does seem to be correct.

	As such, I believe we should force configure to look for fstat
	and lsof only, and remove fuser from the picture entirely.

	Patching configure is probably the best way to do this.  (Note
	that I don't patch configure.in because this program is a single
	perl script, and I feel pulling in autoconf/automake just for
	this purpose is silly.  Plus configure.in is for autoconf 2.61
	and Makefile.in is for automake 1.10 -- both ancient and those
	templates might not work on newer stuff).
>How-To-Repeat:
	See Description.
>Fix:
	Add the below patch.  Patch will also be available here once I
	get a GNATS PR number:

	http://jdc.koitsu.org/freebsd/{prnum}/

	Also, I feel this strongly warrants a PORTREVISION increase
	given the nature of the situation.

Index: files/patch-configure
===================================================================
--- files/patch-configure	(revision 0)
+++ files/patch-configure	(working copy)
@@ -0,0 +1,11 @@
+--- configure.orig	2008-11-02 08:02:35.000000000 -0800
++++ configure	2013-04-21 04:56:36.000000000 -0700
+@@ -2528,7 +2528,7 @@
+    { (exit 1); exit 1; }; }
+ 
+ 
+-for ac_prog in fuser fstat lsof
++for ac_prog in fstat lsof
+ do
+   # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Sun Apr 21 12:10:10 UTC 2013 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

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

From: Edwin Groothuis <edwin@FreeBSD.org>
To: tad@vif.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/178024: mail/archmbox -- uses fuser(1) with incompatible flags on BSD
Date: Sun, 21 Apr 2013 12:10:09 UT

 Maintainer of mail/archmbox,
 
 Please note that PR ports/178024 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/178024
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org
State-Changed-From-To: feedback->closed 
State-Changed-By: danfe 
State-Changed-When: Tue Aug 6 12:33:06 UTC 2013 
State-Changed-Why:  
Committed along with other changes (r324312), thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/178024: commit references a PR
Date: Tue,  6 Aug 2013 12:32:53 +0000 (UTC)

 Author: danfe
 Date: Tue Aug  6 12:32:40 2013
 New Revision: 324312
 URL: http://svnweb.freebsd.org/changeset/ports/324312
 
 Log:
   Linux fuser(1) is incompatible with FreeBSD one, do not look for it.  While
   here: trim the header, adjust CATEGORIES and COMMENT, employ USES for perl5,
   add LICENSE (GPLv2), install handful or docs, and update port description.
   
   PR:		ports/178024
   Submitted by:	koitsu
   Approved by:	maintainer timeout (since April 21st)
 
 Modified:
   head/mail/archmbox/Makefile
   head/mail/archmbox/pkg-descr
 
 Modified: head/mail/archmbox/Makefile
 ==============================================================================
 --- head/mail/archmbox/Makefile	Tue Aug  6 12:06:19 2013	(r324311)
 +++ head/mail/archmbox/Makefile	Tue Aug  6 12:32:40 2013	(r324312)
 @@ -1,23 +1,38 @@
 -# New ports collection makefile for:	archmbox
 -# Date created:			4 April 2004
 -# Whom:				Talal Al-Dik <tad@vif.com>
 -#
 +# Created by: Talal Al-Dik <tad@vif.com>
  # $FreeBSD$
 -#
  
  PORTNAME=	archmbox
  PORTVERSION=	4.10.0
 -CATEGORIES=	mail
 +PORTREVISION=	1
 +CATEGORIES=	mail perl5
  MASTER_SITES=	SF/adc-${PORTNAME}/${PORTNAME}/${PORTVERSION}
  
  MAINTAINER=	tad@vif.com
 -COMMENT=	Email archiver written in perl; parses mailboxes and performs actions
 +COMMENT=	Email archiver that parses mailboxes and performs actions
  
 +LICENSE=	GPLv2
 +
 +USES=		perl5
  GNU_CONFIGURE=	yes
 -USE_PERL5=	yes
 -CONFIGURE_ENV+=	PERL=${PERL}
 +CONFIGURE_ENV=	PERL="${PERL}"
  
  MAN1=		archmbox.1
  PLIST_FILES=	bin/archmbox
 +PORTDOCS=	ChangeLog NEWS README THANKS TODO
 +
 +OPTIONS_DEFINE=	DOCS
 +
 +.include <bsd.port.options.mk>
 +
 +post-patch:
 +# Linux fuser(1) is incompatible with FreeBSD one, do not look for it
 +	@${REINPLACE_CMD} -e '/for ac_prog in/s, fuser,,' \
 +		${WRKSRC}/configure
 +
 +post-install:
 +.if ${PORT_OPTIONS:MDOCS}
 +	@${MKDIR} ${DOCSDIR}
 +	${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${DOCSDIR}
 +.endif
  
  .include <bsd.port.mk>
 
 Modified: head/mail/archmbox/pkg-descr
 ==============================================================================
 --- head/mail/archmbox/pkg-descr	Tue Aug  6 12:06:19 2013	(r324311)
 +++ head/mail/archmbox/pkg-descr	Tue Aug  6 12:32:40 2013	(r324312)
 @@ -1,20 +1,23 @@
 -Archmbox is a simple email archiver written in perl: 
 -- parses one or more mailboxes
 -- selects some or all messages 
 -- performs specific actions on the selected messages.
 -At this time archmbox supports mbox and mbx mailbox formats.
 - 
 -Three different modes are available: 
 -- list mode, which is useful to list all selected messages  
 -- kill mode, if messages should be deleted from the mailbox(es) 
 -- archive mode, to archive the selected messages in a different mailbox 
 +Archmbox is a simple email archiver written in Perl; it parses one or more
 +mailboxes, selects some or all messages and then performs specific actions
 +on the selected messages.  Archmbox supports mbox and mbx mailbox formats.
  
 -Messages selection is based upon:
 -- date criteria
 -- absolute date 
 -- days offset 
 +Four different modes are available:
  
 -It is also possible to refine the selection using regex on the header fields.
 -The archive mailbox can be saved in gz or bz2 compressed format as well.
 +  - List mode, which is useful to list all selected messages before
 +    archmbox performs the real operations (archiving or deleting)
 +  - Kill mode, if messages should be deleted from the mailbox(es) rather
 +    than archived
 +  - Archive mode, to archive the selected messages in a different mailbox
 +  - Copy mode, to copy the selected messages from the source mailbox
 +
 +Messages selection is based upon a date criteria; an absolute date or days
 +offset can be specified.  It is also possible to refine the selection using
 +regular expressions on the header fields of the message.
 +
 +All archived messages are stored in a new mailbox with the same name of the
 +original one plus .archived as extension (this is the default, but can be
 +changed); the archive mailbox can be saved in gz or bz2 compressed format
 +as well.
  
  WWW: http://adc-archmbox.sourceforge.net/
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
