From: Zygo Blaxell Date: Wed, 6 Jan 2010 18:22:38 +0000 (-0500) Subject: dupemerge: inodes are now non-numeric X-Git-Tag: dm6-0.20100514~26 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=dupemerge;a=commitdiff_plain;h=2b9ecf7f61072c069eada92481a6c5478afc69dc dupemerge: inodes are now non-numeric --- diff --git a/faster-dupemerge b/faster-dupemerge index 4ad0176..7e77776 100755 --- a/faster-dupemerge +++ b/faster-dupemerge @@ -288,6 +288,12 @@ sub link_files { } } +# Convert $dev,$ino into a single string where lexical and numeric orderings are equivalent +sub format_inode ($$) { + my ($dev, $ino) = @_; + return sprintf('%016x:%016x', $dev, $ino); +} + # Process all known files so far. sub merge_files { $merges_attempted++; @@ -360,7 +366,7 @@ incumbent_file: next incumbent_file; } - if ($incumbent_ino != $incumbent) { + if (format_inode($incumbent_dev, $incumbent_ino) ne $incumbent) { warn "$incumbent_file: expected inode $incumbent, found $incumbent_ino"; $surprises++; next incumbent_file; @@ -380,7 +386,7 @@ candidate_file: next candidate_file; } - if ($candidate_ino != $candidate) { + if (format_inode($candidate_dev, $candidate_ino) ne $candidate) { warn "$candidate_file: expected inode $candidate, found $candidate_ino"; $surprises++; next candidate_file; @@ -547,7 +553,7 @@ while () { die "read error: $!\nLast input line was '$_'" unless defined($name); # 64 bits out to be enough for everybody! - my $inode = sprintf('%016x:%016x', $dev, $ino); + my $inode = format_inode($dev, $ino); print STDERR "weak_key=$weak_key inode=$inode name=$name\n" if $debug;