From jdc@parodius.com  Sat Feb 23 13:38:07 2008
Return-Path: <jdc@parodius.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E859416A400
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Feb 2008 13:38:07 +0000 (UTC)
	(envelope-from jdc@parodius.com)
Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3])
	by mx1.freebsd.org (Postfix) with ESMTP id CE3C513C501
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Feb 2008 13:38:07 +0000 (UTC)
	(envelope-from jdc@parodius.com)
Received: by mx01.sc1.parodius.com (Postfix, from userid 1000)
	id ADAD41CC033; Sat, 23 Feb 2008 05:38:07 -0800 (PST)
Message-Id: <20080223133807.ADAD41CC033@mx01.sc1.parodius.com>
Date: Sat, 23 Feb 2008 05:38:07 -0800 (PST)
From: Jeremy Chadwick <koitsu@FreeBSD.org>
Reply-To: Jeremy Chadwick <koitsu@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: 340.noid -- Add "find -x" capability (don't cross fs boundaries)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         120993
>Category:       conf
>Synopsis:       [patch] 340.noid -- Add "find -x" capability (don't cross fs boundaries)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 23 13:40:01 UTC 2008
>Closed-Date:    
>Last-Modified:  Sat Feb 23 14:43:27 UTC 2008
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD eos.sc1.parodius.com 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Mon Jan 14 17:48:12 PST 2008 root@eos.sc1.parodius.com:/usr/obj/usr/src/sys/EOS i386
>Description:
Our backup server running FreeBSD rsync to do backups for all other machines
on our network, storing the results in /storage (which is its own filesystem).
All of our systems have different /etc/passwd and /etc/group files -- they are
not identical across all machines.

When weekly_noid_enable="yes" is used in periodic.conf on said server, find(1)
will traverse / (see $weekly_noid_dirs), and **will** cross fs boundaries.

This results in a 35MByte mail from "periodic weekly", which isn't desirable.
>How-To-Repeat:
See description.  :-)
>Fix:
Add support for the -x argument to find(1) in 340.noid.  Below is the patch,
and has been tested on both RELENG_7 and RELENG_6 with success.  With this
patch, we can then do use the following in periodic.conf, thus stopping find(1)
from ever hitting /storage:

weekly_noid_enable="yes"
weekly_noid_crossfs="no"
weekly_noid_dirs="/ /var /tmp /usr"

periodic.conf(5) will also need to be updated to reflect this addition.

--- 340.noid.orig	2008-02-23 05:33:55.000000000 -0800
+++ 340.noid	2008-02-23 05:34:44.000000000 -0800
@@ -11,12 +11,19 @@
     source_periodic_confs
 fi
 
+crossfs=""
+case "$weekly_noid_crossfs" in
+    [Nn][Oo])
+	crossfs="-x"
+	;;
+esac
+
 case "$weekly_noid_enable" in
     [Yy][Ee][Ss])
 	echo ""
 	echo "Check for files with an unknown user or group:"
 
-	rc=$(find -H ${weekly_noid_dirs:-/} \
+	rc=$(find -H ${crossfs} ${weekly_noid_dirs:-/} \
 	    \( ! -fstype local -prune -or -name \* \) -and \
 	    \( -nogroup -o -nouser \) -print | sed 's/^/  /' |
 	    tee /dev/stderr | wc -l)
>Release-Note:
>Audit-Trail:
>Unformatted:
