From nobody@FreeBSD.org  Mon Mar 31 02:53:34 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 721C9140
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Mar 2014 02:53:34 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 5F2D3AD8
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Mar 2014 02:53:34 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s2V2rYD5057165
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Mar 2014 02:53:34 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s2V2rYWv057164;
	Mon, 31 Mar 2014 02:53:34 GMT
	(envelope-from nobody)
Message-Id: <201403310253.s2V2rYWv057164@cgiserv.freebsd.org>
Date: Mon, 31 Mar 2014 02:53:34 GMT
From: Jason Unovitch <jason.unovitch@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] ASSERTION FAILED running individual periodic scripts on 10/11 branches
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         188109
>Category:       conf
>Synopsis:       [periodic.conf] [patch] ASSERTION FAILED running individual periodic scripts on 10/11 branches
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 31 03:00:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Wed Apr 16 01:30:57 UTC 2014
>Originator:     Jason Unovitch
>Release:        10.0-RELEASE
>Organization:
N/A
>Environment:
FreeBSD xts-bsd 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
r254974 introduced the ability to run security periodic scripts on a
daily/weekly/monthly basis.  It also introduced an assumption that the
$PERIODIC variable exported on line 81 /usr/sbin/periodic would be
defined.  This introduces a minor regression as we cannot run individual
scripts by running directly from a shell anymore.
>How-To-Repeat:
cd /etc/periodic/security
./100.chksetuid

ASSERTION FAILED: Unexpected value for  $PERIODIC: ''
>Fix:
Workaround:
env PERIODIC=security ./100.chksetuid

Fix:
Apply attached patch to provide an extra case statement entry for an empty $PERIODIC variable.

Patch attached with submission follows:

Index: periodic.conf
===================================================================
--- periodic.conf	(revision 263916)
+++ periodic.conf	(working copy)
@@ -360,6 +360,10 @@
 			*) return 0 ;;
 			esac
 			;;
+		'')
+			# Run individual scripts from shell
+			return 0
+			;;
 		*)
 			echo "ASSERTION FAILED: Unexpected value for " \
 			    "\$PERIODIC: '$PERIODIC'" >&2


>Release-Note:
>Audit-Trail:

From: Jason Unovitch <jason.unovitch@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/188109: [patch] ASSERTION FAILED running individual periodic
 scripts on 10/11 branches
Date: Sun, 30 Mar 2014 23:03:00 -0400

 This is a multi-part message in MIME format.
 --------------070406080500060600050802
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Two alternate version of patches I worked are attached for ideas if the 
 patch submitted is not acceptable.
 
 - Jason Unovitch
 
 --------------070406080500060600050802
 Content-Type: text/x-patch;
  name="defaults-periodic-2.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="defaults-periodic-2.diff"
 
 Index: periodic.conf
 ===================================================================
 --- periodic.conf	(revision 263916)
 +++ periodic.conf	(working copy)
 @@ -361,9 +361,14 @@
  			esac
  			;;
  		*)
 -			echo "ASSERTION FAILED: Unexpected value for " \
 -			    "\$PERIODIC: '$PERIODIC'" >&2
 -			exit 127
 +			# Execute when undefined (run from shell), else warn and quit
 +			if [ -z "$PERIODIC" ]; then
 +				return 0
 +			else
 +				echo "ASSERTION FAILED: Unexpected value for " \
 +				    "\$PERIODIC: '$PERIODIC'" >&2
 +				exit 127
 +			fi
  			;;
  		esac
  	}
 
 --------------070406080500060600050802
 Content-Type: text/x-patch;
  name="defaults-periodic-3.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="defaults-periodic-3.diff"
 
 Index: periodic.conf
 ===================================================================
 --- periodic.conf	(revision 263916)
 +++ periodic.conf	(working copy)
 @@ -334,38 +334,43 @@
  
  		periodvar=${var%enable}period
  		eval period=\"\$$periodvar\"
 -		case "$PERIODIC" in
 -		"security daily")
 -			case "$period" in
 -			[Dd][Aa][Ii][Ll][Yy]) return 0 ;;
 -			*) return 1 ;;
 +		# Execute when undefined (run from shell), else warn and quit
 +		if [ -z "$PERIODIC" ]; then
 +			return 0
 +		else
 +			case "$PERIODIC" in
 +			"security daily")
 +				case "$period" in
 +				[Dd][Aa][Ii][Ll][Yy]) return 0 ;;
 +				*) return 1 ;;
 +				esac
 +				;;
 +			"security weekly")
 +				case "$period" in
 +				[Ww][Ee][Ee][Kk][Ll][Yy]) return 0 ;;
 +				*) return 1 ;;
 +				esac
 +				;;
 +			"security monthly")
 +				case "$period" in
 +				[Mm][Oo][Nn][Tt][Hh][Ll][Yy]) return 0 ;;
 +				*) return 1 ;;
 +				esac
 +				;;
 +			security)
 +				# Run directly from crontab(5).
 +				case "$period" in
 +				[Nn][Oo]) return 1 ;;
 +				*) return 0 ;;
 +				esac
 +				;;
 +			*)
 +				echo "ASSERTION FAILED: Unexpected value for " \
 +				    "\$PERIODIC: '$PERIODIC'" >&2
 +				exit 127
 +				;;
  			esac
 -			;;
 -		"security weekly")
 -			case "$period" in
 -			[Ww][Ee][Ee][Kk][Ll][Yy]) return 0 ;;
 -			*) return 1 ;;
 -			esac
 -			;;
 -		"security monthly")
 -			case "$period" in
 -			[Mm][Oo][Nn][Tt][Hh][Ll][Yy]) return 0 ;;
 -			*) return 1 ;;
 -			esac
 -			;;
 -		security)
 -			# Run directly from crontab(5).
 -			case "$period" in
 -			[Nn][Oo]) return 1 ;;
 -			*) return 0 ;;
 -			esac
 -			;;
 -		*)
 -			echo "ASSERTION FAILED: Unexpected value for " \
 -			    "\$PERIODIC: '$PERIODIC'" >&2
 -			exit 127
 -			;;
 -		esac
 +		fi
  	}
  
          source_periodic_confs() {
 
 --------------070406080500060600050802--
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Apr 16 01:30:03 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=188109 
>Unformatted:
