Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2012 15:48:16 GMT
From:      Kevin Kobb <kkobb@skylinecorp.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/167000: [PATCH] mail/mailscanner: Update to correct mktemp options
Message-ID:  <201204161548.q3GFmGDv019441@red.freebsd.org>
Resent-Message-ID: <201204161550.q3GFoBZC093329@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167000
>Category:       ports
>Synopsis:       [PATCH] mail/mailscanner: Update to correct mktemp options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 16 15:50:11 UTC 2012
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204161548.q3GFmGDv019441>