tags 263782 +patch thanks Unless I didn't make any obvious errors this feature was rather straightforward to add.
To keep the diff smaller, I didn't rename $md5 or %md5list even though they don't strictly have only md5 sums in them anymore. s/md5/ident/ or something like that might be appropriate. This patch makes finddup always check the uid, gid and permissions. It might be desirable to have those checked only optionally.
diff -ru perforate-1.1/debian/finddup.1 perforate-1.1.changed/debian/finddup.1 --- perforate-1.1/debian/finddup.1 2005-11-09 05:40:42.771561886 +0200 +++ perforate-1.1.changed/debian/finddup.1 2005-11-09 05:39:25.414445085 +0200 @@ -7,8 +7,8 @@ .B finddup searches (starting point is the current directory, doesn't cross device boundaries) files for duplicates. Files are considered as duplicate, if their -.B md5sum -match. Links are not counted as duplicate. +.BR md5sum ,\ uid ,\ gid +and permissions match. Links are not counted as duplicate. .PP The output is a list of duplicate files. Each line consists of the size (in blocks) of the file(s) and the names it appears as. Only in perforate-1.1.changed/debian: finddup.1~ diff -ru perforate-1.1/finddup perforate-1.1.changed/finddup --- perforate-1.1/finddup 2005-11-09 05:40:42.769562296 +0200 +++ perforate-1.1.changed/finddup 2005-11-09 05:30:54.226402955 +0200 @@ -61,7 +61,8 @@ { if (open(IN, "<", $_->[1]->[0])) { - my $md5 = Digest::MD5->new->addfile(*IN)->hexdigest; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat IN; + my $md5 = Digest::MD5->new->addfile(*IN)->hexdigest."\t$mode\t$uid\t$gid"; close IN; $md5list{$md5} = [] unless exists $md5list{$md5}; push @{$md5list{$md5}}, $_; Only in perforate-1.1.changed/: finddup~