From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Apr 21 12:10:02 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 70DE5FC5 for ; Sun, 21 Apr 2013 12:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 50C8B117E for ; Sun, 21 Apr 2013 12:10:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r3LCA2QS016799 for ; Sun, 21 Apr 2013 12:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r3LCA2mS016798; Sun, 21 Apr 2013 12:10:02 GMT (envelope-from gnats) Resent-Date: Sun, 21 Apr 2013 12:10:02 GMT Resent-Message-Id: <201304211210.r3LCA2mS016798@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jeremy Chadwick 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 ; 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 ; 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 To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: ports/178024: mail/archmbox -- uses fuser(1) with incompatible flags on BSD X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jeremy Chadwick List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Apr 2013 12:10:02 -0000 >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: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Apr 21 12:10:00 UTC 2013 >Closed-Date: >Last-Modified: >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 * 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: >Unformatted: