Commit 23d02adf authored by Chris Lamb's avatar Chris Lamb 💬

dh_strip_nondeterminism: Deduplicate hardlinks via stat(2) to avoid issues...

dh_strip_nondeterminism: Deduplicate hardlinks via stat(2) to avoid issues when processing files in parallel. As strip-nondeterminism's handlers are not currently guaranteed to be atomic, one process can temporarily truncate a file which can cause errors in other threads processing the "same" file under a unique pathname. This was causing a FTBFS in packages that deduplicate hardlinks in their build process (eg. src:debian-handbook). (Closes: #922168)
parent 3f4ba2fb
......@@ -45,7 +45,7 @@ things to exclude.
init();
my @nondeterministic_files;
my (@nondeterministic_files, %seen);
sub testfile {
return if -l $_ or -d $_; # Skip directories and symlinks always.
......@@ -57,6 +57,11 @@ sub testfile {
return if ($fn=~m/\Q$f\E/);
}
# Deduplicate hardlinks to avoid issues under parallelism
my ($dev, $inode, undef, $nlink) = stat($_);
return if defined $nlink && $nlink > 1 && $seen{"$inode.$dev"};
$seen{"$inode.$dev"} = 1;
my $normalizer = File::StripNondeterminism::get_normalizer_for_file($_);
if ($normalizer) {
push @nondeterministic_files, [$fn, $normalizer];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment