File procmeter-avoid-build-race.patch of Package procmeter
sent upstream via email
fixes an instance of https://bugzilla.opensuse.org/show_bug.cgi?id=1102408 packages do not build reproducibly from race conditions
commit 83df1ac1bfa2269284be6ffa648c4aca651ca848
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date: Mon Jul 10 04:50:53 2023 +0200
Avoid race condition during build
While working on reproducible builds for openSUSE, I found that
our procmeter3-3.6+svn415 package sometimes was randomly missing
one of its libsensors-*.so files when building with make -j4
This patch avoids the underlying race condition by using unique filenames
for temporary files.
See also
https://github.com/bmwiedemann/theunreproduciblepackage/tree/master/race
diff --git a/modules/check-no-libsensors.sh b/modules/check-no-libsensors.sh
index 339382f..43945c4 100755
--- a/modules/check-no-libsensors.sh
+++ b/modules/check-no-libsensors.sh
@@ -2,20 +2,21 @@
CC=$1
CFLAGS=$2
+libsensorstest=libsensorstest-$$
-cat <<EOF > libsensors-test.c
+cat <<EOF > $libsensorstest.c
#include <sensors/sensors.h>
#if ( (SENSORS_API_VERSION & 0xf00) != 0x400 ) && ( (SENSORS_API_VERSION & 0xf00) != 0x500 )
#error
#endif
EOF
-$CC -c $CFLAGS libsensors-test.c -o libsensors-test.o 2> /dev/null
+$CC -c $CFLAGS $libsensorstest.c -o $libsensorstest.o 2> /dev/null
-rm libsensors-test.c
+rm $libsensorstest.c
-if [ -f libsensors-test.o ]; then
- rm libsensors-test.o
+if [ -f $libsensorstest.o ]; then
+ rm $libsensorstest.o
exit 1
else
echo "libsensors does not appear to be installed - skipping compilation."