Bug 178024 - mail/archmbox -- uses fuser(1) with incompatible flags on BSD
Summary: mail/archmbox -- uses fuser(1) with incompatible flags on BSD
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-21 13:10 UTC by Jeremy Chadwick
Modified: 2013-08-06 13:40 UTC (History)
0 users

See Also:


Attachments
file.diff (542 bytes, patch)
2013-04-21 13:10 UTC, Jeremy Chadwick
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Chadwick 2013-04-21 13:10:00 UTC
	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).

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.
How-To-Repeat: 	See Description.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-04-21 13:10:09 UTC
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
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-04-21 13:10:10 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-08-06 13:32:53 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"
Comment 4 Alexey Dokuchaev freebsd_committer freebsd_triage 2013-08-06 13:33:06 UTC
State Changed
From-To: feedback->closed

Committed along with other changes (r324312), thanks!