Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Nov 2009 19:20:04 GMT
From:      chukharev@mail.ru
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: conf/129697: [patch] fix misbehavior of periodic/daily/100.clean-disks vs. port lang/sbcl
Message-ID:  <200911221920.nAMJK42O012099@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/129697; it has been noted by GNATS.

From: chukharev@mail.ru
To: bug-followup@freebsd.org
Cc:  
Subject: Re: conf/129697: [patch] fix misbehavior of
 periodic/daily/100.clean-disks vs. port lang/sbcl
Date: Sun, 22 Nov 2009 21:18:47 +0200

 The old patch worked for me for at least six months with no problems. Then I made
 something in Windows (the machine is dual boot notebook), and found the following.
 The windows filesystem is automatically mounted by gnome, it is not marked as read-only
 but write operations on it are not allowed. So it is scanned by 100.clean-disks
 resulting in messages in mails like
      rm: #SharedObjects: Operation not supported
 
 A new version of the patch includes one more variable, daily_clean_disks_prune,
 containing a list of directories to ignore with all their subdirectories.
 Additionally, the new variables get empty strings as default values and comments
 document meaning of the variables in /etc/defaults/periodic.conf.
 
 NB. The script is off by default, thus the patch is not changing the default behavior.
 Perhaps, "/media" (or even "/media /mnt") is a better default for daily_clean_disks_prune.
 The file has mixed tabs and spaces, this might be nice to fix in a separate cosmetic
 patch.
 
 ===
 --- etc/defaults/periodic.conf.orig	2009-06-25 16:49:49.000000000 +0300
 +++ etc/defaults/periodic.conf	2009-11-17 12:28:35.000000000 +0200
 @@ -40,6 +40,8 @@
    daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
    daily_clean_disks_days=3				# If older than this
    daily_clean_disks_verbose="YES"				# Mention files deleted
 +daily_clean_disks_prune=""					# Directories to ignore
 +daily_clean_disks_ignore=""					# Files to ignore
 
    # 110.clean-tmps
    daily_clean_tmps_enable="NO"				# Delete stuff daily
 --- etc/periodic/daily/100.clean-disks.orig	2009-10-24 18:20:24.000000000 +0300
 +++ etc/periodic/daily/100.clean-disks	2009-11-17 16:15:06.000000000 +0200
 @@ -29,10 +29,18 @@
    	    echo ""
    	    echo "Cleaning disks:"
    	    set -f noglob
 -	    args="-name "`echo "$daily_clean_disks_files" |
 +	    args="( -name "`echo "$daily_clean_disks_files" |
    		sed -e 's/^[ 	]*//' \
    		    -e 's/[ 	]*$//' \
 -		    -e 's/[ 	][ 	]*/ -o -name /g'`
 +		    -e 's/[ 	][ 	]*/ -o -name /g'`" )"
 +
 +		if ! [ -z "$daily_clean_disks_ignore" ]
 +		then
 +			args="$args -a ! ( -path "`echo "$daily_clean_disks_ignore" |
 +			sed -e 's/^[ 	]*//' \
 +				-e 's/[ 	]*$//' \
 +				-e 's/[ 	][ 	]*/ -o -path /g'`" )"
 +		fi
 
    	    case "$daily_clean_disks_verbose" in
    		[Yy][Ee][Ss])
 @@ -41,9 +49,19 @@
    		    print=;;
    	    esac
 
 -	    rc=$(find / \( ! -fstype local -o -fstype rdonly \) -prune -o \
 -		\( $args \) -atime +$daily_clean_disks_days \
 -		-execdir rm -df {} \; $print | tee /dev/stderr | wc -l)
 +		if ! [ -z "$daily_clean_disks_prune" ]
 +		then
 +			prune="-o -path "`echo "$daily_clean_disks_prune" |
 +			sed -e 's/^[ 	]*//' \
 +				-e 's/[ 	]*$//' \
 +				-e 's/[ 	][ 	]*/ -o -path /g'`
 +		else
 +			prune=""
 +		fi
 +
 +	    command="find / ( ! -fstype local -o -fstype rdonly $prune ) -prune -o ( \
 +		( $args ) -atime +$daily_clean_disks_days -execdir rm -df {} ; $print )"
 +	    rc=$($command | tee /dev/stderr | wc -l)
    	    [ -z "$print" ] && rc=0
    	    [ $rc -gt 1 ] && rc=1
    	    set -f glob
 
 ===
 
 -- 
 Vladimir Chukharev
 Tampere University of Technology



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911221920.nAMJK42O012099>