NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/46756: Ignoring subdirectories in daily's find_core



>Number:         46756
>Category:       misc
>Synopsis:       Ignoring subdirectories in daily's find_core
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 30 15:15:00 +0000 2012
>Originator:     Edgar Fuß
>Release:        NetBSD 6.0_BETA2
>Organization:
        Mathematisches Institut der Uni Bonn
>Environment:
        
        
System: NetBSD trave.math.uni-bonn.de 6.0_BETA2 NetBSD 6.0_BETA2 (MI12serv) #5: 
Mon Jul 30 12:13:14 CEST 2012 
support%trave.math.uni-bonn.de@localhost:/usr/obj/sys/arch/amd64/compile/mi12serv
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        On a file server, I would like to run find_core, yet I don't want
        to descend into people's home directories.
>How-To-Repeat:
        Code inspection.
        See also dDiscussion on tech-userlevel.
>Fix:
--- daily.orig  2012-07-27 14:41:28.000000000 +0200
+++ daily       2012-07-27 15:31:12.000000000 +0200
@@ -89,7 +89,16 @@
        ignfstypes="$(echo $find_core_ignore_fstypes | \
                sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 -fstype \2/g' \
                    -e's/^-o //')"
+       # Turn "foo bar" into "( -path foo -o -path bar ) -prune -o"
+       # Set ignpaths empty if no find_core_ignore_paths given
+       if [ -n "$find_core_ignore_paths" ]; then
+               ignpaths="$(printf " -o -path %s" $find_core_ignore_paths)"
+               ignpaths="( ${ignpaths# -o } ) -prune -o"
+       else
+               ignpaths=""
+       fi
        find / \( $ignfstypes \) -prune -o \
+               ${ignpaths} \
                -name 'lost+found' -prune -o \
                \( -name '*.core' -o -name 'core' \) -type f -print > $TMP
 #              \( -name '[#,]*' -o -name '.#*' -o -name a.out \
--- daily.conf.orig     2012-07-27 15:17:32.000000000 +0200
+++ daily.conf  2012-07-27 15:18:05.000000000 +0200
@@ -11,6 +11,7 @@
 
 find_core=YES
 find_core_ignore_fstypes="!local rdonly fdesc null kernfs procfs ptyfs"
+find_core_ignore_paths=""
 expire_news=NO
 purge_accounting=YES
 run_msgs=YES
--- daily.5.orig        2012-07-27 14:41:51.000000000 +0200
+++ daily.5     2012-07-27 15:22:23.000000000 +0200
@@ -168,6 +168,16 @@
 .Ql procfs
 type filesystems and filesystems that are not
 .Ql local .
+.It Sy find_core_ignore_paths
+Lists paths to ignore during the
+.Sy find_core
+phase.
+For example,
+.Ql /export
+will not descend into any directories under the
+.Ql /export
+hierarchy. This, on a file server, allows to skip
+user data while still scanning system files.
 .It Sy run_fsck_flags
 Extra options to be passed to
 .Xr fsck 8

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index