From 3a2190b200435c28a3099695ef65d0d983dcf56e Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Wed, 19 May 2010 10:42:39 -0400 Subject: [PATCH] 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. --- dm6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; -- 2.30.2