| 1 | #!/usr/bin/perl -w | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Digest::MD5 qw(md5); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Dumpvalue; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use File::Compare qw(compare); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use File::Copy qw(cp); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use File::Temp qw(tempfile); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 2 | our %Opt; | |||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | GetOptions(\%Opt, | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 14 | "maxlinks=i", | ||||||||||||||||||||||||||||||||
| 15 | ) or die; | ||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | my @dirs = @ARGV or die "Usage: $0 OPTIONS directories"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 18 | 2 | our $DEBUG = 0; | |||||||||||||||||||||||||||||||
| 19 | 2 | our $Signal = 0; | |||||||||||||||||||||||||||||||
| 20 | 2 | our %MD5; | |||||||||||||||||||||||||||||||
| 21 | 2 | our $Usedspc = 0; | |||||||||||||||||||||||||||||||
| 22 | 2 | our $Savedspc = 0; | |||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $SIG{INT} = sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 25 | 0 | warn "Caught SIGINT; please stand by, I'm leaving as soon as possible...\n"; | |||||||||||||||||||||||||||||||
| 26 | 0 | $Signal++; | |||||||||||||||||||||||||||||||
| 27 | 2 | }; | |||||||||||||||||||||||||||||||
| 28 | 2 | our $DV = Dumpvalue->new(tick => qq{"}, | |||||||||||||||||||||||||||||||
| 29 | quoteHighBit => 1, | ||||||||||||||||||||||||||||||||
| 30 | printUndef => 1, | ||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||
| 32 | 2 | our $WD = Cwd::cwd; | |||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 498 | ▶ | sub fmt ($) { | ||||||||||||||||||||||||||||||
|
Subroutine
fmt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 35 | 498 | local $_ = shift; | |||||||||||||||||||||||||||||||
| 36 | 498 | s/(\d)(?=(\d{3})+$)/$1_/g; | |||||||||||||||||||||||||||||||
| 37 | 498 | $_; | |||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | # $success = melt($some_file,$another) | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | # $some_file is always absolute, $another is always in the current | ||||||||||||||||||||||||||||||||
| 43 | # directory | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | # melt dies on severe errors, returns 1 on success and 0 if it could | ||||||||||||||||||||||||||||||||
| 46 | # not melt the files. It warns on suspect error conditions, but does | ||||||||||||||||||||||||||||||||
| 47 | # not warn if they have no severe consequences. | ||||||||||||||||||||||||||||||||
| 48 | 4096 | ▶ | sub melt ($$) { | ||||||||||||||||||||||||||||||
|
Subroutine
melt: called CC=8 SCAR=25.4
| |||||||||||||||||||||||||||||||||
| 49 | 4096 | my($first,$basename) = @_; | |||||||||||||||||||||||||||||||
| 50 | 4096 | my($fh,$tempfile) = tempfile("trimtrees1-XXXXXXXX", DIR => "."); | |||||||||||||||||||||||||||||||
| 51 | 4096 | ▶ | unless ($tempfile) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | 0 | die "Could not create a temporary file: $!"; | |||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||
| 54 | 4096 | ▶ | unless (rename $basename, $tempfile){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | 2 | warn sprintf( | |||||||||||||||||||||||||||||||
| 56 | "Cannot rename %s to %s (%s); Skipping.", | ||||||||||||||||||||||||||||||||
| 57 | $DV->stringify($basename), | ||||||||||||||||||||||||||||||||
| 58 | $DV->stringify($tempfile), | ||||||||||||||||||||||||||||||||
| 59 | $!, | ||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||
| 61 | 2 | ▶ | unlink $tempfile or die "Could not unlink '$tempfile': $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | 2 | return 0; | |||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | 4094 | ▶ | unless (link $first, $basename){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | 0 | my $link_err = $!; | |||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if (rename $tempfile, $basename){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 67 | # We could rename back and no harm should be done. Don't warn. | ||||||||||||||||||||||||||||||||
| 68 | 0 | return 0; | |||||||||||||||||||||||||||||||
| 69 | } else { | ||||||||||||||||||||||||||||||||
| 70 | 0 | die sprintf( | |||||||||||||||||||||||||||||||
| 71 | "Could neither link %s to %s (%s) ". | ||||||||||||||||||||||||||||||||
| 72 | "nor rename %s back to %s (%s).", | ||||||||||||||||||||||||||||||||
| 73 | $DV->stringify($first), | ||||||||||||||||||||||||||||||||
| 74 | $DV->stringify($basename), | ||||||||||||||||||||||||||||||||
| 75 | $link_err, | ||||||||||||||||||||||||||||||||
| 76 | $DV->stringify($tempfile), | ||||||||||||||||||||||||||||||||
| 77 | $DV->stringify($basename), | ||||||||||||||||||||||||||||||||
| 78 | $! | ||||||||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||
| 82 | 4094 | ▶ | close $fh or warn "Could not close the temporary filehandle: $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 83 | 4094 | ▶ | unless (unlink $tempfile) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 84 | 0 | die sprintf( | |||||||||||||||||||||||||||||||
| 85 | "Could not unlink %s (was %s): %s", | ||||||||||||||||||||||||||||||||
| 86 | $DV->stringify($tempfile), | ||||||||||||||||||||||||||||||||
| 87 | $DV->stringify($basename), | ||||||||||||||||||||||||||||||||
| 88 | $! | ||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | 4094 | return 1; | |||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | { | ||||||||||||||||||||||||||||||||
| 95 | 2 | my %INODE; | |||||||||||||||||||||||||||||||
| 96 | 7 | ▶ | sub register ($$;$) { | ||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||||||
| 97 | 7 | my($md5,$cand,$candstat) = @_; | |||||||||||||||||||||||||||||||
| 98 | 7 | $MD5{$md5} = $cand; | |||||||||||||||||||||||||||||||
| 99 | 7 | ▶ | my @stat = $candstat ? @$candstat : stat $cand; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 100 | 7 | my $size = $stat[7]; | |||||||||||||||||||||||||||||||
| 101 | 7 | ▶ | warn "size undefined" unless defined $size; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 102 | 7 | ▶ | warn "usedspc undefined" unless defined $Usedspc; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 103 | 7 | ▶ | if ($DEBUG) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | 0 | warn(sprintf "\nDEBUG: cand[%s]size[%s]stat[%s]", $cand, $size, join(":",@stat)); | |||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||
| 106 | 7 | ▶ | return if $INODE{$stat[1]}++; # don't count twice | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 107 | 7 | $Usedspc += $size; | |||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | 2 | undef $/; | |||||||||||||||||||||||||||||||
| 112 | 2 | my %reported; | |||||||||||||||||||||||||||||||
| 113 | 2 | my $files = 0; | |||||||||||||||||||||||||||||||
| 114 | 2 | my $dirs = @dirs; | |||||||||||||||||||||||||||||||
| 115 | 2 | my $tl_dirs_todo = 0; | |||||||||||||||||||||||||||||||
| 116 | 2 | my $tl_dirs_doing = 0; | |||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 83 | ▶ | sub xreport () { | ||||||||||||||||||||||||||||||
|
Subroutine
xreport: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 119 | 83 | my $uniq_files = keys %MD5; | |||||||||||||||||||||||||||||||
| 120 | printf( | ||||||||||||||||||||||||||||||||
| 121 | "\rtlds[%s]cur[%s]uniq[%s]fils[%s]spcused[%s]saved[%s]", | ||||||||||||||||||||||||||||||||
| 122 | map { | ||||||||||||||||||||||||||||||||
| 123 | 83 | fmt($_) | |||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||
| 125 | ( | ||||||||||||||||||||||||||||||||
| 126 | $tl_dirs_todo, | ||||||||||||||||||||||||||||||||
| 127 | $tl_dirs_doing, | ||||||||||||||||||||||||||||||||
| 128 | $uniq_files, | ||||||||||||||||||||||||||||||||
| 129 | $files, | ||||||||||||||||||||||||||||||||
| 130 | $Usedspc, | ||||||||||||||||||||||||||||||||
| 131 | $Savedspc | ||||||||||||||||||||||||||||||||
| 132 | ) | ||||||||||||||||||||||||||||||||
| 133 | ); | ||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | 2 | $| = 1; | |||||||||||||||||||||||||||||||
| 137 | 2 | for my $diri (0..$#dirs) { | |||||||||||||||||||||||||||||||
| 138 | 2 | my $root = $dirs[$diri]; | |||||||||||||||||||||||||||||||
| 139 | find( | ||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||
| 141 | 16390 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=30 SCAR=42.3
| |||||||||||||||||||||||||||||||||
| 142 | 16390 | ▶ | if ($Signal){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 143 | 0 | $File::Find::prune = 1; | |||||||||||||||||||||||||||||||
| 144 | 0 | return; | |||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||
| 146 | 16390 | ▶ | if ($File::Find::name eq $root) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 147 | 2 | my $td = $_; | |||||||||||||||||||||||||||||||
| 148 | 2 | opendir my($dh), $td; | |||||||||||||||||||||||||||||||
| 149 | 2 | ▶ | my(@tl) = grep { !/^\./ && -d "$td/$_" } readdir $dh; | ||||||||||||||||||||||||||||||
|
Condition66%2/3
!/^\./ && -d "$td/$_"
MC/DC50%1/2
!/^\./ && -d "$td/$_"
!/^\./
-d "$td/$_"
Truth table66%2/3
not(A) && B
A= !/^\./B= -d "$td/$_"
| |||||||||||||||||||||||||||||||||
| 150 | 2 | $tl_dirs_todo = @tl; | |||||||||||||||||||||||||||||||
| 151 | } elsif (-d) { | ||||||||||||||||||||||||||||||||
| 152 | 8192 | my $slashes = $File::Find::name =~ tr|/||; | |||||||||||||||||||||||||||||||
| 153 | 8192 | ▶ | if ($slashes == 1) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 154 | 20 | $tl_dirs_doing++; | |||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||
| 157 | 16390 | ▶ | return if -l; # relative links would need special treatment that does not pay off | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 158 | 16390 | ▶ | return unless -f _; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 159 | 8196 | ▶ | return unless -s _; # empty files more risk that files with | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 160 | # content and no gain | ||||||||||||||||||||||||||||||||
| 161 | 8196 | $files++; | |||||||||||||||||||||||||||||||
| 162 | 8196 | my $basename = $_; | |||||||||||||||||||||||||||||||
| 163 | 8196 | my $fh; | |||||||||||||||||||||||||||||||
| 164 | 8196 | ▶ | unless (open $fh, "<", $basename) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 165 | 1 | warn sprintf( | |||||||||||||||||||||||||||||||
| 166 | "Cannot read %s (%s); Skipping.", | ||||||||||||||||||||||||||||||||
| 167 | $DV->stringify($File::Find::name), | ||||||||||||||||||||||||||||||||
| 168 | $!, | ||||||||||||||||||||||||||||||||
| 169 | ); | ||||||||||||||||||||||||||||||||
| 170 | 1 | $Usedspc += -s $basename; | |||||||||||||||||||||||||||||||
| 171 | 1 | return; | |||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | 8195 | my $data = <$fh>; | |||||||||||||||||||||||||||||||
| 174 | 8195 | close $fh; | |||||||||||||||||||||||||||||||
| 175 | 8195 | my $md5 = md5 $data; | |||||||||||||||||||||||||||||||
| 176 | 8195 | my $cand = $File::Find::name; | |||||||||||||||||||||||||||||||
| 177 | 8195 | ▶ | if ($Opt{maxlinks}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 178 | 0 | my(@maxlstat) = stat($cand); | |||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($maxlstat[3] > $Opt{maxlinks}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 180 | # the case that we have to make a new file from a link | ||||||||||||||||||||||||||||||||
| 181 | 0 | my($fh,$tempfile) = tempfile("trimtrees2-XXXXXXXX", DIR => "."); | |||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | unless ($tempfile) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 183 | 0 | die "Could not create a temporary file: $!"; | |||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | unless (rename $cand, $tempfile){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 186 | 0 | die sprintf( | |||||||||||||||||||||||||||||||
| 187 | "Could not rename %s to %s: %s", | ||||||||||||||||||||||||||||||||
| 188 | $DV->stringify($cand), | ||||||||||||||||||||||||||||||||
| 189 | $DV->stringify($tempfile), | ||||||||||||||||||||||||||||||||
| 190 | $! | ||||||||||||||||||||||||||||||||
| 191 | ); | ||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | cp $tempfile, $cand or die sprintf( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | "Could not cp %s to %s: %s", | ||||||||||||||||||||||||||||||||
| 195 | $DV->stringify($tempfile), | ||||||||||||||||||||||||||||||||
| 196 | $DV->stringify($cand), | ||||||||||||||||||||||||||||||||
| 197 | $!, | ||||||||||||||||||||||||||||||||
| 198 | ); | ||||||||||||||||||||||||||||||||
| 199 | 0 | unlink $tempfile; | |||||||||||||||||||||||||||||||
| 200 | 0 | $Savedspc -= $maxlstat[7]; | |||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||
| 203 | 8195 | ▶ | if (my $first = $MD5{$md5}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 204 | 8190 | ▶ | unless (File::Spec->file_name_is_absolute($first)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 205 | 8190 | $first = File::Spec->catfile($WD, $first); | |||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||
| 207 | 8190 | my(@firststat) = stat($first); | |||||||||||||||||||||||||||||||
| 208 | 8190 | ▶ | die sprintf( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 209 | "illegal firststat[%s]first[%s]", | ||||||||||||||||||||||||||||||||
| 210 | join(":",@firststat), | ||||||||||||||||||||||||||||||||
| 211 | $DV->stringify($first), | ||||||||||||||||||||||||||||||||
| 212 | ) unless $firststat[1]; | ||||||||||||||||||||||||||||||||
| 213 | 8190 | my $different = compare $first, $basename; | |||||||||||||||||||||||||||||||
| 214 | 8190 | ▶ | if ($different != 0 && $File::Compare::VERSION<1.1005) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$different != 0 and $File::Compare::VERSION < "1.1005"
MC/DC0%0/2
$different != 0 and $File::Compare::VERSION < "1.1005"
$different != 0
$File::Compare::VERSION < "1.1005"
Truth table33%1/3
A and B
A= $different != 0B= $File::Compare::VERSION < "1.1005"
| |||||||||||||||||||||||||||||||||
| 215 | # workaround bug # 37716 in File::Compare | ||||||||||||||||||||||||||||||||
| 216 | 0 | $different = compare "$first\0", "$basename\0"; | |||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||
| 218 | 8190 | ▶ | if ($different<0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 219 | 0 | warn sprintf( | |||||||||||||||||||||||||||||||
| 220 | "Cannot compare %s and %s (%s); Skipping.", | ||||||||||||||||||||||||||||||||
| 221 | $DV->stringify($first), | ||||||||||||||||||||||||||||||||
| 222 | $DV->stringify($cand), | ||||||||||||||||||||||||||||||||
| 223 | $!, | ||||||||||||||||||||||||||||||||
| 224 | ); | ||||||||||||||||||||||||||||||||
| 225 | 0 | goto XREPORT; # some error occurred | |||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||
| 227 | 8190 | ▶ | die sprintf( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 228 | "Sensation, %s and %s are not equal with same MD5", | ||||||||||||||||||||||||||||||||
| 229 | $DV->stringify($first), | ||||||||||||||||||||||||||||||||
| 230 | $DV->stringify($cand), | ||||||||||||||||||||||||||||||||
| 231 | ) | ||||||||||||||||||||||||||||||||
| 232 | if $different; | ||||||||||||||||||||||||||||||||
| 233 | 8190 | my(@candstat) = stat($basename); | |||||||||||||||||||||||||||||||
| 234 | 8190 | ▶ | goto XREPORT unless $candstat[0] == $firststat[0]; # different file system | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 235 | 8190 | ▶ | if ($candstat[1] == $firststat[1]){ # already same inode | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 236 | 4094 | if (0 && $Opt{maxlinks} && $firststat[3] > $Opt{maxlinks}) { | |||||||||||||||||||||||||||||||
| 237 | } else { | ||||||||||||||||||||||||||||||||
| 238 | 4094 | goto XREPORT; | |||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||
| 241 | 4096 | ▶ | if ($Opt{maxlinks} && $firststat[3] >= $Opt{maxlinks}){ | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$main::Opt{"maxlinks"} and $firststat[3] >= $main::Opt{"maxlinks"}
MC/DC0%0/2
$main::Opt{"maxlinks"} and $firststat[3] >= $main::Opt{"maxlinks"}
$main::Opt{"maxlinks"}
$firststat[3] >= $main::Opt{"maxlinks"}
Truth table33%1/3
A and B
A= $main::Opt{"maxlinks"}B= $firststat[3] >= $main::Opt{"maxlinks"}
| |||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | register($md5,$cand,\@candstat) if $candstat[3] < $Opt{maxlinks}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 243 | } elsif (melt($first,$basename)) { | ||||||||||||||||||||||||||||||||
| 244 | 4094 | ▶ | if ($candstat[3]==1) { # we don't save space otherwise | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 245 | 4094 | $Savedspc += $firststat[7]; | |||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | } else { | ||||||||||||||||||||||||||||||||
| 248 | 2 | register($md5,$cand,\@candstat); | |||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||||||
| 251 | 5 | register($md5,$cand); | |||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||
| 253 | 8195 | ▶ | XREPORT: | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 254 | return if $files % 100; | ||||||||||||||||||||||||||||||||
| 255 | 81 | xreport; | |||||||||||||||||||||||||||||||
| 256 | }, | ||||||||||||||||||||||||||||||||
| 257 | 2 | no_chdir => 1, | |||||||||||||||||||||||||||||||
| 258 | }, | ||||||||||||||||||||||||||||||||
| 259 | $root | ||||||||||||||||||||||||||||||||
| 260 | ); | ||||||||||||||||||||||||||||||||
| 261 | 2 | ▶ | last if $Signal; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||
| 263 | 2 | xreport; | |||||||||||||||||||||||||||||||
| 264 | 2 | print "\nDONE\n"; | |||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||
| 266 | __END__ | ||||||||||||||||||||||||||||||||