From 6910de85c5daa8b99a1ea7d6e4614584fbfdfec5 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 8 Jan 2010 21:33:20 -0500 Subject: [PATCH] merge_files: add extra sanity check that input files are in fact files Now that there is no '-f _' filter in the input loop, merge_files may encounter a candidate or incumbent filename which resolves to a non-file object on the filesystem. If --skip-hash is not used, this sanity check will be applied during file hashing; however, if --skip-hash is used, the sanity check will not be applied until the files are compared. --- faster-dupemerge | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faster-dupemerge b/faster-dupemerge index 9c159ee..7e899dd 100755 --- a/faster-dupemerge +++ b/faster-dupemerge @@ -380,7 +380,7 @@ incumbent_file: my ($incumbent_dev,$incumbent_ino,$incumbent_mode,$incumbent_nlink,$incumbent_uid,$incumbent_gid,$incumbent_rdev,$incumbent_size,$incumbent_atime,$incumbent_mtime,$incumbent_ctime,$incumbent_blksize,$incumbent_blocks) = lstat($incumbent_file); print STDERR "\t\tINCUMBENT dev=$incumbent_dev ino=$incumbent_ino mode=$incumbent_mode nlink=$incumbent_nlink uid=$incumbent_uid gid=$incumbent_gid rdev=$incumbent_rdev size=$incumbent_size atime=$incumbent_atime mtime=$incumbent_mtime ctime=$incumbent_ctime blksize=$incumbent_blksize blocks=$incumbent_blocks _=$incumbent_file\n" if $debug; - if (!defined($incumbent_blocks)) { + if (!defined($incumbent_blocks) || ! (-f _)) { warn "lstat: $incumbent_file: $!"; $surprises++; next incumbent_file; @@ -401,7 +401,7 @@ candidate_file: my ($candidate_dev,$candidate_ino,$candidate_mode,$candidate_nlink,$candidate_uid,$candidate_gid,$candidate_rdev,$candidate_size,$candidate_atime,$candidate_mtime,$candidate_ctime,$candidate_blksize,$candidate_blocks) = lstat($candidate_file); print STDERR "\t\t\tCANDIDATE dev=$candidate_dev ino=$candidate_ino mode=$candidate_mode nlink=$candidate_nlink uid=$candidate_uid gid=$candidate_gid rdev=$candidate_rdev size=$candidate_size atime=$candidate_atime mtime=$candidate_mtime ctime=$candidate_ctime blksize=$candidate_blksize blocks=$candidate_blocks _=$candidate_file\n" if $debug; - if (!defined($candidate_blocks)) { + if (!defined($candidate_blocks) || ! (-f _)) { warn "lstat: $candidate_file: $!"; $surprises++; next candidate_file; -- 2.30.2