Date: Sun, 21 Apr 2013 05:06:07 -0700 (PDT) From: Jeremy Chadwick <jdc@koitsu.org> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/178024: mail/archmbox -- uses fuser(1) with incompatible flags on BSD Message-ID: <20130421120607.1534173A33@icarus.home.lan> Resent-Message-ID: <201304211210.r3LCA2mS016798@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130421120607.1534173A33>