Source: dx
Version: 1:4.4.4-14
Severity: important
Tags: patch bookworm sid
User: reproducible-bui...@lists.alioth.debian.org
Usertags: usrmerge
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

If dx is built on a merged-/usr system (as created by new
installations of Debian >= 10, debootstrap --merged-usr, or installing
the usrmerge package into an existing installation), the path to sh
is recorded in the binary package as /usr/bin/sh, rather than the
canonical /bin/sh. A previous solution to this appears to have not been
completely successful: it edited the path found in header files, but
not the path hard-coded into executable files.

This can be seen on the reproducible-builds.org infra:
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/dx.html

If you have sbuild available, an easy way to reproduce this is to build
twice, once with --add-depends=usrmerge and once without.

The problematic situation is if the package is *built* on a unified-/usr
system, but *used* on a non-unified-/usr system. In this situation,
/usr/bin/sh exists on the build system but not on the system where the
package will be used, resulting in the features that use this executable
not working correctly.

Similarly, if there is a /usr/local/bin/sh visible at build-time,
then that path would likely end up hard-coded into the binary,
causing the relevant feature to fail on all systems that do not have
/usr/local/bin/sh.

Technical Committee resolution #978636 mandates heading towards a
transition to merged-/usr, and variation between merged-/usr and
non-merged-/usr builds is a problem while that transition is taking
place, because it can lead to partial upgrades behaving incorrectly. It
is likely that this class of bugs will become release-critical later in
the bookworm development cycle.

A common way to resolve this sort of thing is to pass a configure option
or a variable name to ./configure, and this package appears to provide a
--with-bsh option for this purpose, so I'd recommend using it. The attached
patch builds successfully with or without usrmerge, with the same content
(although I have not otherwise tested the resulting packages).

Thanks,
    smcv
>From 3e437f02caca1a7f7985d8199b917780eaf29f09 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Mon, 6 Dec 2021 15:14:32 +0000
Subject: [PATCH] Pass interoperable path for /bin/sh to configure

The previous approach to this does not seem to have been a complete
solution, and this one seems more likely to be upstream-supported.

Signed-off-by: Simon McVittie <s...@debian.org>
---
 debian/rules | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index 1a7bf9a..5ace1e9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,6 +21,7 @@ override_dh_auto_configure:
 	dh_auto_configure -- \
 		--prefix=/usr/share \
 		--enable-smp-linux \
+		--with-bsh=/bin/sh \
 		--with-rsh=$(RSH) \
 		--disable-dependency-tracking \
 		--enable-shared
@@ -58,8 +59,6 @@ override_dh_auto_build:
 override_dh_auto_install:
 	dh_auto_install
 	# Strip paths for reproducible builds
-	sed -i -e 's/^#define BSH.*/#define BSH="\/bin\/sh"/g' \
-		$(CURDIR)/debian/tmp/usr/share/dx/include/dxconfig.h
 	sed -i -e 's/ -f\(debug\|file\)-prefix-map=[^ ]*=\. / /g' \
 		$(CURDIR)/debian/tmp/usr/share/dx/lib_*/arch.mak
 
-- 
2.34.1

Reply via email to