Subject: pkg/26408: fix for broken uvscan_dat in uvscan package
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jdw-sendpr@jdwhite.org>
List: pkgsrc-bugs
Date: 07/22/2004 19:34:08
>Number:         26408
>Category:       pkg
>Synopsis:       fix for update_dat in uvscan package
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 23 00:35:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jason White
>Release:        NetBSD 2.0_BETA
>Organization:
Jason White (jdw-sendpr@jdwhite.org)     http://www.jdwhite.org/~jdwhite
Jabber:jdwhite(jabber.org)              IRC:irc.netbsd.org/{jdwhite,jdw}
PGP KeyID: 0x5290E477/A8A2 3FDB AB33 98EB ED74  EDAA F538 9A30 5290 E477
>Environment:
	
	
System: NetBSD bender.jdwhite.org 2.0_BETA NetBSD 2.0_BETA (BENDER) #0: Mon May 10 02:13:44 CDT 2004 gendalia@satai:/usr/obj/i386/BENDER i386
Architecture: i386
Machine: i386
>Description:
On 15-Jul-2004, McAfee changed the format of the readme.txt in their DAT
file tarballs so that it no longer contains the version number of the
DAT files.  This action broke the update_dat script.
>How-To-Repeat:
Run the update_dat script.
>Fix:
Apply the following patch.
--- update_dat.orig	2004-05-20 01:06:23.000000000 -0500
+++ update_dat	2004-07-22 19:19:07.000000000 -0500
@@ -1,8 +1,16 @@
 #!/bin/sh
 
+# Modified by Jason White <jdwhite@jdwhite.org>  22-Jul-2004
+#   * Work around changes to McAfee DAT file distribution on 15-Jun-2004.
+#      - readme.txt no longer contains DAT file version, so we now
+#        use update.ini from server and pkgdesc.ini from tarball to 
+#        determine current and old DAT file version.
+#   * Updates fetched using faster, more reliable HTTP server.
+
 UVSCANDIR="/usr/pkg/libexec/uvscan"
-DAT_SITE="ftp://ftp.nai.com/pub/datfiles/english/"
-DAT_FILES="clean.dat internet.dat names.dat scan.dat readme.txt"
+#DAT_SITE="ftp://ftp.nai.com/pub/datfiles/english/"
+DAT_SITE="http://download.nai.com/products/datfiles/4.x/nai/"
+DAT_FILES="clean.dat internet.dat names.dat scan.dat pkgdesc.ini"
 TMPDIR="${TMPDIR:-/tmp}/$$"
 
 AWK="/usr/bin/awk"
@@ -28,22 +36,27 @@
 ${MKDIR} ${TMPDIR}
 
 if [ -n "$dat_tar" ]; then
-	if ! (${GTAR} -x -C ${TMPDIR} -f $dat_tar readme.txt >/dev/null); then
-		${ECHO} "$progname: unable to extract readme.txt"
+	if ! (${GTAR} -x -C ${TMPDIR} -f $dat_tar pkgdesc.ini >/dev/null); then
+		${ECHO} "$progname: unable to extract pkgdesc.ini"
 		${RM} -rf ${TMPDIR}
 		exit 1  
 	fi
+	curver=`${AWK} -F= '/Version/ { print $2; exit }' ${TMPDIR}/pkgdesc.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'`
 else
-	# Fetch the ReadMe file to read the latest version of the DAT files.
-	if ! (cd ${TMPDIR}; ftp ${DAT_SITE}readme.txt >/dev/null); then
-		${ECHO} "$progname: unable to fetch ${DAT_SITE}readme.txt"
+	# Fetch the update.ini file to read the latest version of the DAT files.
+	if ! (cd ${TMPDIR}; ftp ${DAT_SITE}update.ini >/dev/null); then
+		${ECHO} "$progname: unable to fetch ${DAT_SITE}update.ini"
 		${RM} -rf ${TMPDIR}
 		exit 1  
 	fi
+	curver=`${AWK} -F= '/DATVersion/ { print $2; exit }' ${TMPDIR}/update.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'`
 fi
 
-curver=`${AWK} '/DAT Version/ { print $4; exit }' ${TMPDIR}/readme.txt | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'`
-oldver=`${AWK} '/DAT Version/ { print $4; exit }' ${UVSCANDIR}/readme.txt | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'`
+if [ -e ${UVSCANDIR}/pkgdesc.ini ]; then
+	oldver=`${AWK} -F= '/Version/ { print $2; exit }' ${UVSCANDIR}/pkgdesc.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'`
+else
+	oldver=0
+fi
 
 if [ $curver -le $oldver ]; then
 	if [ -z "$verbose" ]; then

>Release-Note:
>Audit-Trail:
>Unformatted: