From nobody@FreeBSD.org  Sat Nov  9 20:14:12 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 1364E4A0
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  9 Nov 2013 20:14:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id F32CE20E6
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  9 Nov 2013 20:14:11 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA9KEBds056549
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 9 Nov 2013 20:14:11 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA9KEBqC056546;
	Sat, 9 Nov 2013 20:14:11 GMT
	(envelope-from nobody)
Message-Id: <201311092014.rA9KEBqC056546@oldred.freebsd.org>
Date: Sat, 9 Nov 2013 20:14:11 GMT
From: Christopher <christomania@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: error in /usr/local/etc/periodic/security/410.pkg-audit
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         183820
>Category:       conf
>Synopsis:       [patch] error in /usr/local/etc/periodic/security/410.pkg-audit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 09 20:20:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Mon Nov 11 00:57:18 UTC 2013
>Originator:     Christopher
>Release:        9.2-RELEASE
>Organization:
>Environment:
FreeBSD ******** 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
I think I found an error in one of the periodic security pkg scripts:
/usr/local/etc/periodic/security/410.pkg-audit

the awk expression to set PKG_DBDIR variable is
awk -F: '$1 ~ /PKG_DBDIR$/ { print $2 }'

this does not work because the line is as
PKG_DBDIR: /.../....

so the variable PKG_DBDIR is " /.../..."
there is a space at the beginning of the script.

next the stat command failed because of the space
stat -f %m " /.../...."

>How-To-Repeat:
you can run :

sh -f -x /usr/local/etc/periodic/security/410.pkg-audit
>Fix:
I suggest the following modification:

awk -F ': ' '$1 ~ /PKG_DBDIR$/ { print $2 }'

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