[Git][reproducible-builds/strip-nondeterminism][master] dh_strip_nondeterminism: Deduplicate hardlinks via stat(2) to avoid issues...

Chris Lamb gitlab at salsa.debian.org
Wed Feb 13 09:28:41 CET 2019


Chris Lamb pushed to branch master at Reproducible Builds / strip-nondeterminism


Commits:
23d02adf by Chris Lamb at 2019-02-13T08:22:06Z
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)

- - - - -


1 changed file:

- bin/dh_strip_nondeterminism


Changes:

=====================================
bin/dh_strip_nondeterminism
=====================================
@@ -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];



View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/commit/23d02adf3f976675d117122017a54a8b4abf6149

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/commit/23d02adf3f976675d117122017a54a8b4abf6149
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190213/e2019225/attachment.html>


More information about the rb-commits mailing list