From d3f5380a6dd6fac196112b385ca6c5c2048210fa Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 25 Aug 2023 15:53:58 +0200 Subject: [PATCH] Fix brp-llvm-compile-lto-elf parallelism with hardlinks Deduplicate the files by inode, so each hardlink is only processed once, thus avoiding race conditions. Resolves: rhbz#2234024 --- brp-llvm-compile-lto-elf | 6 ++++-- redhat-rpm-config.spec | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/brp-llvm-compile-lto-elf b/brp-llvm-compile-lto-elf index 7eb53a1..37632d1 100755 --- a/brp-llvm-compile-lto-elf +++ b/brp-llvm-compile-lto-elf @@ -48,5 +48,7 @@ check_convert_bitcode () { echo "Checking for LLVM bitcode artifacts" export -f check_convert_bitcode -find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -print0 | \ - xargs -0 -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0 +# Deduplicate by device:inode to avoid processing hardlinks in parallel. +find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -printf "%d:%i %p\n" | \ + awk "!seen[$1]++" | cut -d" " -f2- | \ + xargs -d"\n" -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0 diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 309e763..c5178ec 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 201 +Version: 202 Release: 1%{?dist} # No version specified. License: GPL+ @@ -129,6 +129,7 @@ Requires: %{_bindir}/xargs # for brp-llvm-compile-lto-elf Requires: (llvm if clang) +Requires: (gawk if clang) # -fstack-clash-protection and -fcf-protection require GCC 8. Conflicts: gcc < 8.0.1-0.22 @@ -253,6 +254,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Fri Aug 25 2023 Nikita Popov - 202-1 +- Fix brp-llvm-compile-lto-elf parallelism with hardlinks +- Resolves: rhbz#2234024 + * Mon May 08 2023 Nikita Popov - 201-1 - Add llvm dependency if clang toolchain used - Resolves: rhbz#2193406