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

Not delete symlinks to directories in /var/run/ ?



[Please forgive the duplicate, but I first sent this with a useless
Subject line.]

debian-devel readers: There is a proposal (#272066) that bootclean.sh's
cleanrun function not delete symlinks under /var/run/ whose targets are
directories.  The function already refrains from deleting directories.
Any objections?  Please reply to 272066@bugs.debian.org, not to the list.

Cameron Hutchison wrote to #272066:
> This should do it. It uses the -xtype find(1) predicate. I'm not sure if
> that's GNU only and if so, whether it is allowed in an initscript.
> 
> --- /etc/init.d/bootclean.sh	2005-01-05 10:27:40.000000000 +1100
> +++ /tmp/bootclean.sh	2005-11-22 09:27:46.105703939 +1100
> @@ -90,7 +90,7 @@
>  
>  	[ "$VERBOSE" != no ] && echo -n " /var/run"
>  	( cd /var/run && \
> -		find . ! -type d ! -name utmp ! -name innd.pid \
> +		find . ! -type d ! -xtype d ! -name utmp ! -name innd.pid \
>  		-exec rm -f -- {} \; )
>  	rm -f /var/run/.clean
>  	set -o noclobber


"! -type d" matches everything (including symbolic links) except directories.
"! -xtype d" in the absence of "-L" matches everything except directories
and symbolic links to directories.  Thus IIUC the latter eliminates the need
for the former.

I am cc:ing this to debian-devel in order to solicit opinions.
Please reply to 272066@bugs.debian.org, not to the list.
-- 
Thomas Hood



Reply to: