Control: tags -1 patch

Hi Lorenzo,

I believe I have fixed these issues. Merge requests aren't available for
runit's packaging repo so I attach four patches!

On Thu, Jan 09, 2025 at 11:46:36PM +0000, Andrew Bower wrote:
> 1) Interleaved build output with parallel make results in unpredictable
> false positives from blhc, e.g.:

Fixed in patch 1 by using the -Oline make flag.

> 2) Build flags are replicated.

Fixed in patch 2 by removing:
  d/patches/0006-make-buildsystem-respect-CFLAGS.patch
This patch actually duplicated the flags that were already added to
conf-cc.

However, we go further by simplifying how we get the flags from Debian
and also making sure we are actually using all the standard flags by
borrowing from the built-in make recipies.

> 3) The debian build flag canaries were multiplied and inconsistent.

Fixed in patch 3 by building the contrib files and the build options
config file from the same step as the actual build.

> 4) Some of the feature test programs (tst*.c) had build errors with
> recent compilers that were hidden and therefore resulted in the wrong
> build choices being made silently. Some of these cases were handled in
> #1075484.

Fixed in patch 4 by eliminating all the hidden errors.

Combined, these give a clean run in the Salsa CI pipeline:
<https://salsa.debian.org/abower/runit/-/pipelines/794932>.

Hope these look good to you!

Andrew
From 902555d7edf909cba770422d7c00393909f5d288 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Thu, 9 Jan 2025 21:43:26 +0000
Subject: [PATCH 1/4] stop build output interleaving leading to blhc false
 positives

Closes: #1092623
---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index c3da508..6ad473e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -27,7 +27,7 @@ override_dh_auto_build:
 		./debian/contrib/i-s-h/invoke-rc.d-runit.patch
 	patch   -o ./debian/contrib/i-s-h/service ./debian/contrib/i-s-h/service-*.in \
 		./debian/contrib/i-s-h/service-runit.patch
-	dh_auto_build
+	dh_auto_build -- -Oline
 
 override_dh_installsystemd:
 	dh_installsystemd --name runit --no-stop-on-upgrade
-- 
2.47.1

From 6f8afd3764a41b4267a5a6c41348e8d010df2fe7 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Thu, 9 Jan 2025 21:50:35 +0000
Subject: [PATCH 2/4] pass ALL build flags through ONCE

Simplify how build flags retrieved;
get the full flag set;
only pass the flags through once.

Closes: #1092623
---
 ...0006-make-buildsystem-respect-CFLAGS.patch | 33 -------------------
 debian/patches/series                         |  1 -
 debian/rules                                  |  7 ++--
 3 files changed, 2 insertions(+), 39 deletions(-)
 delete mode 100644 debian/patches/0006-make-buildsystem-respect-CFLAGS.patch

diff --git a/debian/patches/0006-make-buildsystem-respect-CFLAGS.patch b/debian/patches/0006-make-buildsystem-respect-CFLAGS.patch
deleted file mode 100644
index bf0f4af..0000000
--- a/debian/patches/0006-make-buildsystem-respect-CFLAGS.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From: Dmitry Bogatov <kact...@gnu.org>
-Date: Tue, 12 Mar 2019 19:07:02 +0000
-Forwarded: <not-needed>
-Subject: Make buildsystem respect dpkg-buildflags
-
-Last-Update: 2016-06-01
-
-Last-Update: 2016-06-01
----
- runit-2.1.2/src/print-cc.sh | 2 +-
- runit-2.1.2/src/print-ld.sh | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/runit-2.1.2/src/print-cc.sh b/runit-2.1.2/src/print-cc.sh
-index 31f4ed3..25e43b4 100644
---- a/runit-2.1.2/src/print-cc.sh
-+++ b/runit-2.1.2/src/print-cc.sh
-@@ -2,4 +2,4 @@ cc="`head -n1 conf-cc`"
- systype="`cat systype`"
- 
- cat warn-auto.sh
--echo exec "$cc" '-c ${1+"$@"}'
-+echo exec "$cc" "$CPPFLAGS" "$CFLAGS" '-c ${1+"$@"}'
-diff --git a/runit-2.1.2/src/print-ld.sh b/runit-2.1.2/src/print-ld.sh
-index 59489a8..6d5030d 100644
---- a/runit-2.1.2/src/print-ld.sh
-+++ b/runit-2.1.2/src/print-ld.sh
-@@ -3,4 +3,4 @@ systype="`cat systype`"
- 
- cat warn-auto.sh
- echo 'main="$1"; shift'
--echo exec "$ld" '-o "$main" "$main".o ${1+"$@"}'
-+echo exec "$ld" "$LDFLAGS" '-o "$main" "$main".o ${1+"$@"}'
diff --git a/debian/patches/series b/debian/patches/series
index 460f0b3..34b58be 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,7 +2,6 @@
 0002-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff
 0003-utmpset.c-mixes-int32_t-and-time_t.diff
 0004-src-Makefile-don-t-use-static-to-link-runit-runit-ini.diff
-0006-make-buildsystem-respect-CFLAGS.patch
 0009-fix-error-in-manpage.patch
 0010-make-build-system-print-compilatio.patch
 0011-disable-chkshgrp-test-that-fails-i.patch
diff --git a/debian/rules b/debian/rules
index 6ad473e..8e31023 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,10 +3,7 @@
 # runit-2.1.2/src/chkshgrp.c.
 # -- Dmitry Bogatov <kact...@gnu.org>  Sun, 24 Dec 2017 00:13:54 +0300
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all qa=+canary
-DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/default.mk
-export CFLAGS  += $(shell getconf LFS_CFLAGS)
-export LDFLAGS += $(shell getconf LFS_LDFLAGS)
 
 %:
 	dh $@ --sourcedirectory=runit-$(DEB_VERSION_UPSTREAM)/src \
@@ -17,8 +14,8 @@ override_dh_auto_configure:
 	      runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk
 	cp runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld \
 	      runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld.bk
-	echo $(CC) $(CFLAGS) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc
-	echo $(CC) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld
+	echo $(COMPILE.c) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc
+	echo $(LINK.o) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld
 
 override_dh_auto_build:
 	$(MAKE) debian/contrib/shutdown
-- 
2.47.1

From 18baef38c9bf8e332e54a52caf8c383e974ec1d7 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Thu, 9 Jan 2025 18:23:06 +0000
Subject: [PATCH 3/4] build contrib and write options from same dh target for
 stable canaries

Closes: #1092623
---
 debian/contrib/Makefile | 12 ++++++++++++
 debian/rules            | 32 ++++++++++++++++++--------------
 2 files changed, 30 insertions(+), 14 deletions(-)
 create mode 100644 debian/contrib/Makefile

diff --git a/debian/contrib/Makefile b/debian/contrib/Makefile
new file mode 100644
index 0000000..74a0562
--- /dev/null
+++ b/debian/contrib/Makefile
@@ -0,0 +1,12 @@
+# Build contrib'd binaries from a separate makefile to avoid recursive make
+# invocation allocating new canaries and any other unexpected magic.
+# -- Andrew Bower <and...@bower.uk>  Thu, 09 Jan 2025 18:12:00 +0000
+
+.PHONY: all clean
+
+TARGETS=shutdown lib/async-timeout
+
+all: $(TARGETS)
+
+clean:
+	$(RM) $(TARGETS)
diff --git a/debian/rules b/debian/rules
index 8e31023..f3e60fb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,9 @@ include /usr/share/dpkg/default.mk
 	dh $@ --sourcedirectory=runit-$(DEB_VERSION_UPSTREAM)/src \
 	      --with bash_completion,runit,sysuser
 
-override_dh_auto_configure:
+# Do these as part of dh_build so we don't proliferate different canaries etc.
+.PHONY: write_runit_build_flags restore_runit_build_flags
+write_runit_build_flags:
 	cp runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc \
 	      runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk
 	cp runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld \
@@ -17,9 +19,18 @@ override_dh_auto_configure:
 	echo $(COMPILE.c) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc
 	echo $(LINK.o) > runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld
 
-override_dh_auto_build:
-	$(MAKE) debian/contrib/shutdown
-	$(MAKE) debian/contrib/lib/async-timeout
+restore_runit_build_flags:
+ifneq ("$(wildcard runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk)","")
+	mv -f runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk \
+	    runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc
+endif
+ifneq ("$(wildcard runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld.bk)","")
+	mv -f runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld.bk \
+	    runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld
+endif
+
+override_dh_auto_build: write_runit_build_flags
+	$(MAKE) -C debian/contrib all
 	patch   -o ./debian/contrib/i-s-h/invoke-rc.d ./debian/contrib/i-s-h/invoke-rc.d-*.in \
 		./debian/contrib/i-s-h/invoke-rc.d-runit.patch
 	patch   -o ./debian/contrib/i-s-h/service ./debian/contrib/i-s-h/service-*.in \
@@ -45,16 +56,9 @@ override_dh_installchangelogs:
 	dh_installchangelogs -p runit -p runit-init \
 	    runit-$(DEB_VERSION_UPSTREAM)/package/CHANGES
 
-override_dh_clean:
-ifneq ("$(wildcard runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk)","")
-	mv -f runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc.bk \
-	    runit-$(DEB_VERSION_UPSTREAM)/src/conf-cc
-endif
-ifneq ("$(wildcard runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld.bk)","")
-	mv -f runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld.bk \
-	    runit-$(DEB_VERSION_UPSTREAM)/src/conf-ld
-endif
+override_dh_clean: restore_runit_build_flags
 	dh_clean
+	$(MAKE) -C debian/contrib clean
 
 autopkgtest-image:
 	autopkgtest-build-qemu unstable ../autopkgtest.img
@@ -79,4 +83,4 @@ endif
 #	    --qemu-options='-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0' \
 	    ../autopkgtest.img
 
-PHONY: autopkgtest autopkgtest-image
+.PHONY: autopkgtest autopkgtest-image
-- 
2.47.1

From 94bc2c42e8b1f071f4dc8861fa085cfc925d7071 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Thu, 9 Jan 2025 18:23:06 +0000
Subject: [PATCH 4/4] fix hidden build errors in feature test programs

Closes: #1092623
---
 ...build-errors-in-try-.c-feature-tests.patch | 68 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 debian/patches/0030-fix-build-errors-in-try-.c-feature-tests.patch

diff --git a/debian/patches/0030-fix-build-errors-in-try-.c-feature-tests.patch b/debian/patches/0030-fix-build-errors-in-try-.c-feature-tests.patch
new file mode 100644
index 0000000..5b73e4f
--- /dev/null
+++ b/debian/patches/0030-fix-build-errors-in-try-.c-feature-tests.patch
@@ -0,0 +1,68 @@
+From: Andrew Bower <and...@bower.uk>
+Date: Thu, 9 Jan 2025 21:45:31 +0000
+Forwarded: no
+Subject: fix build errors in try*.c feature tests
+
+Build errors in some of the try*.c feature test programs, which
+accumulated over time with increased compiler warning options, caused
+the wrong build-time choices to be made silently, not using the
+optimal or correct ones for Linux.
+
+---
+ runit-2.1.2/src/trymkffo.c   | 2 +-
+ runit-2.1.2/src/trypoll.c    | 1 +
+ runit-2.1.2/src/tryshsgr.c   | 2 +-
+ runit-2.1.2/src/tryulong64.c | 4 ++--
+ 4 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/runit-2.1.2/src/trymkffo.c b/runit-2.1.2/src/trymkffo.c
+index 9356342..4f8b286 100644
+--- a/runit-2.1.2/src/trymkffo.c
++++ b/runit-2.1.2/src/trymkffo.c
+@@ -3,7 +3,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
+-void main()
++int main()
+ {
+   mkfifo("temp-trymkffo",0);
+ }
+diff --git a/runit-2.1.2/src/trypoll.c b/runit-2.1.2/src/trypoll.c
+index ae36929..8348bbc 100644
+--- a/runit-2.1.2/src/trypoll.c
++++ b/runit-2.1.2/src/trypoll.c
+@@ -4,6 +4,7 @@
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include <poll.h>
++#include <unistd.h>
+ 
+ int main()
+ {
+diff --git a/runit-2.1.2/src/tryshsgr.c b/runit-2.1.2/src/tryshsgr.c
+index 4089751..6ac7f07 100644
+--- a/runit-2.1.2/src/tryshsgr.c
++++ b/runit-2.1.2/src/tryshsgr.c
+@@ -5,7 +5,7 @@
+ 
+ int main()
+ {
+-  short x[4];
++  gid_t x[4];
+  
+   x[0] = x[1] = 1;
+   if (getgroups(1,(gid_t *)x) == 0) if (setgroups(1,(gid_t *)x) == -1) _exit(1);
+diff --git a/runit-2.1.2/src/tryulong64.c b/runit-2.1.2/src/tryulong64.c
+index a4b9839..20a908d 100644
+--- a/runit-2.1.2/src/tryulong64.c
++++ b/runit-2.1.2/src/tryulong64.c
+@@ -10,6 +10,6 @@ int main()
+   u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
+   u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
+   u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
+-  if (!u) _exit(1);
+-  _exit(0);
++  if (!u) return 1;
++  return 0;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 34b58be..07b17c1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -24,3 +24,4 @@
 0027-Clarify-runsv-8-control-dx.patch
 0028-Disable-sv-test
 0029-fix-ftbfs-with-gcc14.patch
+0030-fix-build-errors-in-try-.c-feature-tests.patch
-- 
2.47.1

Attachment: signature.asc
Description: PGP signature

Reply via email to