From nobody@FreeBSD.org  Mon Apr 16 15:48:17 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34C81106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Apr 2012 15:48:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 1EE028FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Apr 2012 15:48:17 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3GFmGmj019442
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Apr 2012 15:48:16 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q3GFmGDv019441;
	Mon, 16 Apr 2012 15:48:16 GMT
	(envelope-from nobody)
Message-Id: <201204161548.q3GFmGDv019441@red.freebsd.org>
Date: Mon, 16 Apr 2012 15:48:16 GMT
From: Kevin Kobb <kkobb@skylinecorp.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] mail/mailscanner: Update to correct mktemp options
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         167000
>Category:       ports
>Synopsis:       [PATCH] mail/mailscanner: Update to correct mktemp options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    crees
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 16 15:50:11 UTC 2012
>Closed-Date:    Wed Apr 18 07:30:34 UTC 2012
>Last-Modified:  Wed Apr 18 07:40:01 UTC 2012
>Originator:     Kevin Kobb
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
>Environment:
FreeBSD mail.skylinecorp.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
The recent source update to MailScanner uses the mktemp command without any options. This works OK on linux, but the FreeBSD version needs to be supplied an option, or else you get an error like this when running mailscanner --lint

MailScanner.conf says "Virus Scanners = clamd"
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
/usr/local/libexec/MailScanner/bitdefender-wrapper: Cannot create temporary file
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
/usr/local/libexec/MailScanner/clamav-wrapper: Cannot make name for temporary dir

Note: on my system with postfix, running mailscanner --lint without this fix besides producing the above error, clobbers the permissions on the quarantine directories causing a lot of problems.


>How-To-Repeat:
Run mailscanner --lint and check the output.
>Fix:
Apply attached patch file.

Patch attached with submission follows:

diff -urN mailscanner.orig/Makefile mailscanner/Makefile
--- mailscanner.orig/Makefile	2012-03-22 15:18:54.000000000 -0400
+++ mailscanner/Makefile	2012-04-16 11:00:30.000000000 -0400
@@ -7,7 +7,7 @@
 
 PORTNAME=	MailScanner
 PORTVERSION=	4.84.5
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	mail
 MASTER_SITES=	http://www.mailscanner.info/files/4/tar/
 DISTNAME=	${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
@@ -150,7 +150,7 @@
 		-e 's,/usr/bin/clamscan,${LOCALBASE}/bin/clamscan,g'	\
 		-e 's,/usr/bin/sa-compile,${LOCALBASE}/bin/sa-compile,g' \
 		-e 's,/usr/bin/sa-update,${LOCALBASE}/bin/sa-update,g'	\
-		-e 's,/usr/bin/unzip,${LOCALBASE}/bin/unzip,g'		\
+		-e 's,/usr/bin/unzip,${UNZIP_CMD},g'				\
 		-e 's,/usr/bin/wget,${LOCALBASE}/bin/wget,g'		\
 		-e 's,/usr/lib/sendmail,/usr/sbin/sendmail,g'		\
 		${WRKSRC}/bin/MailScanner				\
diff -urN mailscanner.orig/files/CHANGES.port mailscanner/files/CHANGES.port
--- mailscanner.orig/files/CHANGES.port	2012-03-21 17:08:02.000000000 -0400
+++ mailscanner/files/CHANGES.port	2012-04-16 10:57:43.000000000 -0400
@@ -1,3 +1,11 @@
+Version 4.84.5_3
+================
+- Added FreeBSD required mktemp options
+
+Version 4.84.5_2
+================
+- Fixed creation of mailscanner.cf symlink
+
 Version 4.84.5_1
 ================
 - Added patch for TNEF.pm bug
@@ -57,8 +65,8 @@
 ==============
 - Upgrade to 4.61.7
 - Attention: update_spamassassin and update_spamassassin.cron are rewritten to fit
-  FreeBSD. Untestet. If you are using non-standard directories or FreeBSD < 6 you will
-  have to tweck update_spamassassin.
+  FreeBSD. Untested. If you are using non-standard directories or FreeBSD < 6 you will
+  have to check update_spamassassin.
 
 Version 4.60.8_2
 ================
diff -urN mailscanner.orig/files/patch-bin__Sophos.install mailscanner/files/patch-bin__Sophos.install
--- mailscanner.orig/files/patch-bin__Sophos.install	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-bin__Sophos.install	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,11 @@
+--- ./bin/Sophos.install.orig	2011-08-20 08:32:02.000000000 -0400
++++ ./bin/Sophos.install	2012-04-16 10:42:59.000000000 -0400
+@@ -125,7 +125,7 @@
+   #rm -f /tmp/crontab.$$
+   #crontab -l | sed -e 's/^\(.*savupdate.*\)$/# &/' > /tmp/crontab.$$
+   #crontab /tmp/crontab.$$
+-  crontmpfile=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++  crontmpfile=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+   crontab -l | sed -e 's/^\(.*savupdate.*\)$/# &/' > $crontmpfile
+   crontab $crontmpfile
+   rm -f  $crontmpfile
diff -urN mailscanner.orig/files/patch-bin__Sophos.install.linux mailscanner/files/patch-bin__Sophos.install.linux
--- mailscanner.orig/files/patch-bin__Sophos.install.linux	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-bin__Sophos.install.linux	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,11 @@
+--- ./bin/Sophos.install.linux.orig	2011-08-20 08:32:02.000000000 -0400
++++ ./bin/Sophos.install.linux	2012-04-16 10:43:06.000000000 -0400
+@@ -125,7 +125,7 @@
+   #rm -f /tmp/crontab.$$
+   #crontab -l | sed -e 's/^\(.*savupdate.*\)$/# &/' > /tmp/crontab.$$
+   #crontab /tmp/crontab.$$
+-  crontmpfile=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++  crontmpfile=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+   crontab -l | sed -e 's/^\(.*savupdate.*\)$/# &/' > $crontmpfile
+   crontab $crontmpfile
+   rm -f $crontmpfile
diff -urN mailscanner.orig/files/patch-lib-clamav-wrapper mailscanner/files/patch-lib-clamav-wrapper
--- mailscanner.orig/files/patch-lib-clamav-wrapper	2012-03-10 05:30:07.000000000 -0500
+++ mailscanner/files/patch-lib-clamav-wrapper	1969-12-31 19:00:00.000000000 -0500
@@ -1,12 +0,0 @@
---- ./lib/clamav-wrapper.orig	2011-08-20 08:32:02.000000000 -0400
-+++ ./lib/clamav-wrapper	2012-03-09 08:41:47.000000000 -0500
-@@ -51,6 +51,9 @@
- 
- # You may want to check this script for bash-isms
- 
-+PATH=$PATH:/usr/local/bin
-+export PATH
-+
- #TempDir="/tmp/clamav.$$"
- TempDir=$(mktemp) || { echo "$0: Cannot make name for temporary dir" >&2; exit 1; }
- ClamUser="clamav"
diff -urN mailscanner.orig/files/patch-lib__bitdefender-wrapper mailscanner/files/patch-lib__bitdefender-wrapper
--- mailscanner.orig/files/patch-lib__bitdefender-wrapper	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-lib__bitdefender-wrapper	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,11 @@
+--- ./lib/bitdefender-wrapper.orig	2011-08-20 08:20:04.000000000 -0400
++++ ./lib/bitdefender-wrapper	2012-04-16 10:43:25.000000000 -0400
+@@ -34,7 +34,7 @@
+ extras=''
+ 
+ #LogFile=/tmp/log.bdc.$$
+-LogFile=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++LogFile=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+ 
+ if [ -x ${PackageDir}/bdscan ]; then
+   # Version 7.5 is installed
diff -urN mailscanner.orig/files/patch-lib__clamav-wrapper mailscanner/files/patch-lib__clamav-wrapper
--- mailscanner.orig/files/patch-lib__clamav-wrapper	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-lib__clamav-wrapper	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,15 @@
+--- ./lib/clamav-wrapper.orig	2012-04-16 10:38:36.000000000 -0400
++++ ./lib/clamav-wrapper	2012-04-16 10:41:34.000000000 -0400
+@@ -51,8 +51,11 @@
+ 
+ # You may want to check this script for bash-isms
+ 
++PATH=$PATH:/usr/local/bin
++export PATH
++
+ #TempDir="/tmp/clamav.$$"
+-TempDir=$(mktemp) || { echo "$0: Cannot make name for temporary dir" >&2; exit 1; }
++TempDir=$(mktemp -t tmp) || { echo "$0: Cannot make name for temporary dir" >&2; exit 1; }
+ ClamUser="clamav"
+ ClamGroup="clamav"
+ 
diff -urN mailscanner.orig/files/patch-lib__kaspersky-wrapper mailscanner/files/patch-lib__kaspersky-wrapper
--- mailscanner.orig/files/patch-lib__kaspersky-wrapper	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-lib__kaspersky-wrapper	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,29 @@
+--- ./lib/kaspersky-wrapper.orig	2011-08-20 08:32:02.000000000 -0400
++++ ./lib/kaspersky-wrapper	2012-04-16 10:43:41.000000000 -0400
+@@ -42,7 +42,7 @@
+ Scanner=kav4fs/bin/kav4fs-kavscanner
+ if [ -x ${PackageDir}/$Scanner ]; then
+   #Report=/tmp/kavoutput.tmp.$$
+-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++  Report=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
+   if [ "x$1" = "x-IsItInstalled" ]; then
+     exit 0
+@@ -61,7 +61,7 @@
+ Scanner=kav4unix/bin/kavscanner
+ if [ -x ${PackageDir}/$Scanner ]; then
+   #Report=/tmp/kavoutput.tmp.$$
+-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++  Report=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
+   if [ "x$1" = "x-IsItInstalled" ]; then
+     exit 0
+@@ -80,7 +80,7 @@
+ Scanner=bin/kavscanner
+ if [ -x ${PackageDir}/$Scanner ]; then
+   #Report=/tmp/kavoutput.tmp.$$
+-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++  Report=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
+   if [ "x$1" = "x-IsItInstalled" ]; then
+     exit 0
diff -urN mailscanner.orig/files/patch-lib__trend-autoupdate mailscanner/files/patch-lib__trend-autoupdate
--- mailscanner.orig/files/patch-lib__trend-autoupdate	1969-12-31 19:00:00.000000000 -0500
+++ mailscanner/files/patch-lib__trend-autoupdate	2012-04-16 10:44:22.000000000 -0400
@@ -0,0 +1,11 @@
+--- ./lib/trend-autoupdate.orig	2011-08-20 08:27:46.000000000 -0400
++++ ./lib/trend-autoupdate	2012-04-16 10:43:16.000000000 -0400
+@@ -16,7 +16,7 @@
+ shift
+ 
+ #TEMPDIR=/tmp/trend-update.$$
+-TEMPDIR=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++TEMPDIR=$(mktemp -t tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+ # In case it's a link
+ rm -f $TEMPDIR >/dev/null 2>&1
+ # In case it's a dir


>Release-Note:
>Audit-Trail:
Class-Changed-From-To: sw-bug->maintainer-update 
Class-Changed-By: edwin 
Class-Changed-When: Mon Apr 16 15:50:27 UTC 2012 
Class-Changed-Why:  
Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167000 
Responsible-Changed-From-To: freebsd-ports-bugs->crees 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Apr 16 15:50:32 UTC 2012 
Responsible-Changed-Why:  
crees@ wants this port PRs (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167000 
State-Changed-From-To: open->feedback 
State-Changed-By: crees 
State-Changed-When: Mon Apr 16 18:59:45 UTC 2012 
State-Changed-Why:  
Hi Kevin!  How about using sed instead?  Much less space needed than 
patches :) 
http://www.bayofrum.net/~crees/patches/mailscanner-mktempfix.diff 

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

From: Kevin Kobb <kkobb@skylinecorp.com>
To: bug-followup@FreeBSD.org, kkobb@skylinecorp.com, crees@FreeBSD.org
Cc:  
Subject: Re: ports/167000: [PATCH] mail/mailscanner: Update to correct mktemp
 options
Date: Tue, 17 Apr 2012 16:51:39 -0400

 This is a multi-part message in MIME format.
 --------------080002010801090209080600
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 OK, a slightly modified version of Chris' patch (I think there was a
 misplaced "\")
 
 Seems to work fine in my testing.
 
 --------------080002010801090209080600
 Content-Type: text/plain; charset=windows-1252;
  name="patch.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="patch.txt"
 
 diff -urN mailscanner.orig/Makefile mailscanner/Makefile
 --- mailscanner.orig/Makefile	2012-03-22 15:18:54.000000000 -0400
 +++ mailscanner/Makefile	2012-04-17 16:23:16.000000000 -0400
 @@ -7,7 +7,7 @@
  
  PORTNAME=	MailScanner
  PORTVERSION=	4.84.5
 -PORTREVISION=	2
 +PORTREVISION=	3
  CATEGORIES=	mail
  MASTER_SITES=	http://www.mailscanner.info/files/4/tar/
  DISTNAME=	${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
 @@ -135,6 +135,14 @@
  		   perl-tar/MailScanner-${PORTVERSION}-${PATCHLEVEL}.tar.gz \
  		&& ${MV} MailScanner-${PORTVERSION}-${PATCHLEVEL}/* .
  
 +post-patch:
 +	@${REINPLACE_CMD} -e 's,\$$(mktemp),\$$(mktemp -t tmp),' \
 +		${WRKSRC}/lib/clamav-wrapper \
 +		${WRKSRC}/lib/trend-autoupdate \
 +		${WRKSRC}/lib/bitdefender-wrapper \
 +		${WRKSRC}/lib/kaspersky-wrapper \
 +		${WRKSRC}/bin/Sophos.install
 +
  do-build:
  	@${REINPLACE_CMD} \
  		-e 's,/bin/bash,${LOCALBASE}/bin/bash,g' \
 @@ -150,7 +158,7 @@
  		-e 's,/usr/bin/clamscan,${LOCALBASE}/bin/clamscan,g'	\
  		-e 's,/usr/bin/sa-compile,${LOCALBASE}/bin/sa-compile,g' \
  		-e 's,/usr/bin/sa-update,${LOCALBASE}/bin/sa-update,g'	\
 -		-e 's,/usr/bin/unzip,${LOCALBASE}/bin/unzip,g'		\
 +		-e 's,/usr/bin/unzip,${UNZIP_CMD},g'			\
  		-e 's,/usr/bin/wget,${LOCALBASE}/bin/wget,g'		\
  		-e 's,/usr/lib/sendmail,/usr/sbin/sendmail,g'		\
  		${WRKSRC}/bin/MailScanner				\
 diff -urN mailscanner.orig/files/CHANGES.port mailscanner/files/CHANGES.port
 --- mailscanner.orig/files/CHANGES.port	2012-03-21 17:08:02.000000000 -0400
 +++ mailscanner/files/CHANGES.port	2012-04-16 11:25:22.000000000 -0400
 @@ -1,3 +1,11 @@
 +Version 4.84.5_3
 +================
 +- Added FreeBSD required mktemp options
 +
 +Version 4.84.5_2
 +================
 +- Fixed creation of mailscanner.cf symlink
 +
  Version 4.84.5_1
  ================
  - Added patch for TNEF.pm bug
 @@ -57,8 +65,8 @@
  ==============
  - Upgrade to 4.61.7
  - Attention: update_spamassassin and update_spamassassin.cron are rewritten to fit
 -  FreeBSD. Untestet. If you are using non-standard directories or FreeBSD < 6 you will
 -  have to tweck update_spamassassin.
 +  FreeBSD. Untested. If you are using non-standard directories or FreeBSD < 6 you will
 +  have to check update_spamassassin.
  
  Version 4.60.8_2
  ================
 
 --------------080002010801090209080600--
State-Changed-From-To: feedback->open 
State-Changed-By: crees 
State-Changed-When: Wed Apr 18 07:21:58 UTC 2012 
State-Changed-Why:  
You're quite correct.... I seem to fail at basic things when hacking 
MailScanner :( 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167000 
State-Changed-From-To: open->closed 
State-Changed-By: crees 
State-Changed-When: Wed Apr 18 07:30:31 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/167000: commit references a PR
Date: Wed, 18 Apr 2012 07:30:31 +0000 (UTC)

 crees       2012-04-18 07:30:16 UTC
 
   FreeBSD ports repository
 
   Modified files:
     mail/mailscanner     Makefile 
     mail/mailscanner/files CHANGES.port 
   Log:
   Fix mktemp use (GNUism optional -t part for directory)
   
   PR:             ports/167000
   Submitted by:   Kevin Kobb <kkobb@skylinecorp.com> (maintainer)
   
   Revision  Changes    Path
   1.102     +10 -2     ports/mail/mailscanner/Makefile
   1.30      +10 -2     ports/mail/mailscanner/files/CHANGES.port
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
