dupemerge: have find tell us the device too
authorZygo Blaxell <zblaxell@faye.furryterror.org>
Wed, 6 Jan 2010 16:07:24 +0000 (11:07 -0500)
committerZygo Blaxell <zblaxell@waya.furryterror.org>
Sat, 9 Jan 2010 02:17:47 +0000 (21:17 -0500)
faster-dupemerge cannot be used to link files on multiple filesystems
because the hardlinks will fail; however, if this is attempted anyway
then files with identical weak keys (size+timestamp+permissions) and
identical inode numbers might be considered as identical for hashing
and comparing purposes when they are not.  That would be bad.

faster-dupemerge

index 82483a22999bc9f71e999f7b37998470bd77edd3..6371fd037747c419cde6efce2c2a33e8b6788d6a 100755 (executable)
@@ -238,7 +238,7 @@ my @find_command = ('find', @directories, @extra_find_opts, '-type', 'f');
 my $printf_string = '%s ' .
        ($collapse_access    ? '0 0 0 ' : '%U %G %m ') .
        ($collapse_timestamp ? '0 '     : '%T@ ') .
 my $printf_string = '%s ' .
        ($collapse_access    ? '0 0 0 ' : '%U %G %m ') .
        ($collapse_timestamp ? '0 '     : '%T@ ') .
-       '%i %p\0';
+       '%D:%i %p\0';
 
 push(@find_command, '!', '-empty') unless $collapse_zero;
 push(@find_command, '-printf', $printf_string);
 
 push(@find_command, '!', '-empty') unless $collapse_zero;
 push(@find_command, '-printf', $printf_string);
@@ -538,7 +538,7 @@ end_merge:
 }
 
 while (<FIND>) {
 }
 
 while (<FIND>) {
-       my ($weak_key, $inode, $name) = m/^(\d+ \d+ \d+ \d+ -?\d+) (\d+) (.+)\0$/so;
+       my ($weak_key, $inode, $name) = m/^(\d+ \d+ \d+ \d+ -?\d+) (\d+:\d+) (.+)\0$/so;
        die "read error: $!\nLast input line was '$_'" unless defined($name);
 
        print STDERR "weak_key=$weak_key inode=$inode name=$name\n" if $debug;
        die "read error: $!\nLast input line was '$_'" unless defined($name);
 
        print STDERR "weak_key=$weak_key inode=$inode name=$name\n" if $debug;