misc/133070: /etc/periodic/daily/100.clean-disks traverses non-local file systems

Kael Fischer kael.fischer at gmail.com
Wed Mar 25 12:10:03 PDT 2009


>Number:         133070
>Category:       misc
>Synopsis:       /etc/periodic/daily/100.clean-disks traverses non-local file systems
>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:   Wed Mar 25 19:10:00 UTC 2009
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list