From nobody@FreeBSD.org  Wed Mar 25 19:04:58 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82A4C1065677
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Mar 2009 19:04:58 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 703278FC25
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Mar 2009 19:04:58 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n2PJ4wex047396
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 25 Mar 2009 19:04:58 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n2PJ4wJ4047395;
	Wed, 25 Mar 2009 19:04:58 GMT
	(envelope-from nobody)
Message-Id: <200903251904.n2PJ4wJ4047395@www.freebsd.org>
Date: Wed, 25 Mar 2009 19:04:58 GMT
From: Kael Fischer <kael.fischer@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /etc/periodic/daily/100.clean-disks traverses non-local file systems
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         133070
>Category:       conf
>Synopsis:       [patch] /etc/periodic/daily/100.clean-disks traverses non-local file systems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 25 19:10:00 UTC 2009
>Closed-Date:    Sat May 30 08:35:50 UTC 2009
>Last-Modified:  Sat May 30 08:35:50 UTC 2009
>Originator:     Kael Fischer
>Release:        7.0-RELEASE-p5
>Organization:
University of Utah
>Environment:
7.0-RELEASE-p5 FreeBSD 7.0-RELEASE-p5 #0: Wed Oct  1 07:51:58 UTC 2008     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Reading the script /etc/periodic/daily/100.clean-disks it seems that the authors intend to not traverse non-local file systems.  However, the find command used DOES traverse non-local file systems.  This can lead to lots of "permission denied" on all the machines of a cluster and clutter the periodic output badly.

As has been noted on the mailing lists 'find -x <list of local fs>'  is probably the way to go.
>How-To-Repeat:
set (in /etc/periodic.conf):
daily_clean_disks_enable="YES"
daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
daily_clean_disks_days=3
daily_clean_disks_verbose="YES"

On a system that has an nfs mount, where the server has -maproot=nobody in /etc/exports 
>Fix:
Apply patch.

Patch extracts local mount points from mount -p output as follows: all lines are considered local and cleanable that begin with / and are mounted 'rw'.  These are presented to find after -x, i.e. 'find -x / /tmp/ usr /var ...) rather than the current 'find / ...'



Patch attached with submission follows:

--- 100.clean-disks.orig	2008-02-24 02:41:26.000000000 -0700
+++ 100.clean-disks	2009-03-25 12:19:37.000000000 -0600
@@ -41,7 +41,8 @@
 		    print=;;
 	    esac
 
-	    rc=$(find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
+	    rc=$(find -x $(mount -p | awk '/^\// {if($4=="rw") print $2;}') \
+		\( ! -fstype local -o -fstype rdonly \) -a -prune -o \
 		\( $args \) -atime +$daily_clean_disks_days -delete $print |
 		tee /dev/stderr | wc -l)
 	    [ -z "$print" ] && rc=0


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Thu Mar 26 12:21:07 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133070 
Responsible-Changed-From-To: freebsd-rc->freebsd-bugs 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Fri Mar 27 00:54:52 UTC 2009 
Responsible-Changed-Why:  

rc.d != periodic 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133070 

From: Kees Jan Koster <kjkoster@kjkoster.org>
To: bug-followup@FreeBSD.org, kael.fischer@gmail.com
Cc:  
Subject: Re: conf/133070: [patch] /etc/periodic/daily/100.clean-disks traverses non-local file systems
Date: Thu, 9 Apr 2009 22:47:24 +0200

 This bug seems to be closely related to conf/122811
 
 --
 Kees Jan
 
 http://java-monitor.com/forum/
 kjkoster@kjkoster.org
 06-51838192
 
 The secret of success lies in the stability of the goal. -- Benjamin  
 Disraeli
 
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Sat May 30 08:34:16 UTC 2009 
State-Changed-Why:  
This is a dup of pr 122811 

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