From: Zygo Blaxell Date: Wed, 19 May 2010 14:42:39 +0000 (-0400) Subject: dm6: get rid of temporary links during garbage collection X-Git-Tag: dm6-0.20100519~1 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=dupemerge;a=commitdiff_plain;h=3a2190b200435c28a3099695ef65d0d983dcf56e dm6: get rid of temporary links during garbage collection If dm6 is interrupted, it can leave temporary link files in the link-dir. These will artificially inflate the link counts, and prevent those files from ever being deleted. --- diff --git a/dm6 b/dm6 index dbec047..c824c0e 100755 --- a/dm6 +++ b/dm6 @@ -219,8 +219,8 @@ while () { # Garbage collection print STDERR "\nGarbage collection in '$link_dir'..."; chdir($link_dir) || die "chdir: $link_dir: $!"; -print STDERR "\nRemoving files with link count < 3..."; -system("find . -type f -links -3 -print0 | xargs -0rt rm -f") and die "system: exit status $?"; +print STDERR "\nRemoving files with link count < 3 and temporary links..."; +system('find . -type f \( -links -3 -o -name ".*" \) -print0 | xargs -0rt rm -f') and die "system: exit status $?"; print STDERR "\nRemoving empty directories..."; system("find . -type d -empty -print0 | xargs -0rt rmdir -p --ignore-fail-on-non-empty") and die "system: exit status $?"; print STDERR "\nDone.\n";