🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
4 messages
4 total messages Started by Vagrant Cascadian Tue, 24 Nov 2026 23:10
Bug#1069907: dh_apache2: please output reproducible module package pre/post scripts.
#6028
Author: Vagrant Cascadian
Date: Tue, 24 Nov 2026 23:10
112 lines
5959 bytes
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Control: affects 1069907 subversion

On 2024-04-26, James Addison wrote:
> I'm an occasional volunteer contributor to the Reproducible Builds[1] pro=
ject,
> and noticed recently that an Apache webserver module, mod-mono, that depe=
nds[2]
> on the dh_apache2 debhelper utility from apache2-dev at build-time, faile=
d an
> automated Debian reproducibility test[3].
>
> The problem appears to be related to the substitution of a NAMES variable
> that appears in the templated pre/post scripts evaluated by dh_apache2; t=
he
> templates[4][5][6] are found in the 'apache2' source package.
>
> I don't yet know exactly how the non-deterministic ordering of entries in=
 the
> NAMES variable occurs; however the replacement parameters[7] in the
> dh_apache2.in script seem relevant, and tracing the creation of those may=
 help.

This is also occurring in subversion, which has only two modules, so a
high chance of flipping back and forth between reproducible or not:

https://reproduce.debian.net/arm64/api/v1/builds/547174/artifacts/1423172/d=
iffoscope

=2D-- /srv/rebuilderd/tmp/rebuilderd4BrIIh/inputs/libapache2-mod-svn_1.15.0=
-2_arm64.deb
+++ /srv/rebuilderd/tmp/rebuilderd4BrIIh/out/libapache2-mod-svn_1.15.0-2_ar=
m64.deb
=E2=94=9C=E2=94=80=E2=94=80 control.tar.xz
=E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 control.tar
=E2=94=82 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 ./postinst
=E2=94=82 =E2=94=82 =E2=94=82 @@ -1,12 +1,12 @@
=E2=94=82 =E2=94=82 =E2=94=82  #!/bin/sh
=E2=94=82 =E2=94=82 =E2=94=82  set -e
=E2=94=82 =E2=94=82 =E2=94=82  # Automatically added by dh_apache2/UNDECLAR=
ED
=E2=94=82 =E2=94=82 =E2=94=82  if true; then
=E2=94=82 =E2=94=82 =E2=94=82  	if [ -e /usr/share/apache2/apache2-maintscr=
ipt-helper ] ; then
=E2=94=82 =E2=94=82 =E2=94=82  		. /usr/share/apache2/apache2-maintscript-h=
elper
=E2=94=82 =E2=94=82 =E2=94=82 -		for conf in dav_svn authz_svn  ; do
=E2=94=82 =E2=94=82 =E2=94=82 +		for conf in authz_svn dav_svn  ; do
=E2=94=82 =E2=94=82 =E2=94=82  			apache2_invoke enmod $conf  || exit 1
=E2=94=82 =E2=94=82 =E2=94=82  		done
=E2=94=82 =E2=94=82 =E2=94=82  	fi
=E2=94=82 =E2=94=82 =E2=94=82  fi
=E2=94=82 =E2=94=82 =E2=94=82  # End automatically added section

This seems to match debian/debhelper/postinst-apache2:

if #CONDITIONAL_VARIABLE#; then
    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
        . /usr/share/apache2/apache2-maintscript-helper
        for conf in #NAMES# ; do
            apache2_invoke #HELPER# $conf #ACTION# || #ERROR_HANDLER#
        done
    fi
fi

Which is apparently set in debian/debhelper/dh_apache2.in:

                my %replacements =3D (
                    HELPER =3D> $ref->[0],
                    NAMES  =3D> $ref->[1],
                    ERROR_HANDLER =3D> $PACKAGE_TYPE{handler},
                    CONDITIONAL_VARIABLE =3D> $PACKAGE_TYPE{conditional},
                    ACTION =3D> $dh{RESTART},
                );

                if ($script_type eq "prerm" || $script_type eq "postrm")
                {
                    $replacements{'HELPER'} =3D~ s/en/dis/;
                }

                my $sed_command =3D "";
                foreach my $key (sort keys %replacements)
                {
                    my $val =3D $replacements{$key};
                    # Use a control char as separator for sed, to
                    # reduce escaping issues. Everything else is
                    # passed verbatim, i.e. it must not contain any
                    # shell or sed special characters.
                    my $sep =3D "\x17";
                    $sed_command .=3D "s" . $sep . "#$key#" .

It appears to call sort, but perhaps it is sorting the wrong things, or
at the wrong timing?


live well,
  vagrant

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCawYXTQAKCRDcUY/If5cW
quPFAQD2G3/5NT10m70UMP6q25yIBQtek4vh4oRfWZYH0wl5bgEAuapdt7Qo2L51
jSnMVjQSq2dYmbgCzeAg0DAfBYLPKw0=
=ZTH4
-----END PGP SIGNATURE-----
--=-=-=--
Bug#1069907: dh_apache2: please output reproducible module package pre/post scripts.
#6209
Author: James McCoy
Date: Wed, 25 Nov 2026 21:40
99 lines
5521 bytes
--ie7qyoydzzrw3mmu
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline

Control: tag -1 patch

On Tue, Nov 24, 2026 at 03:01:33PM -0800, Vagrant Cascadian wrote:
>This seems to match debian/debhelper/postinst-apache2:
>
>if #CONDITIONAL_VARIABLE#; then
>    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
>        . /usr/share/apache2/apache2-maintscript-helper
>        for conf in #NAMES# ; do
>            apache2_invoke #HELPER# $conf #ACTION# || #ERROR_HANDLER#
>        done
>    fi
>fi
>
>Which is apparently set in debian/debhelper/dh_apache2.in:
>
>                my %replacements = (
>                    HELPER => $ref->[0],
>                    NAMES  => $ref->[1],
>                    ERROR_HANDLER => $PACKAGE_TYPE{handler},
>                    CONDITIONAL_VARIABLE => $PACKAGE_TYPE{conditional},
>                    ACTION => $dh{RESTART},
>                );
>
>                if ($script_type eq "prerm" || $script_type eq "postrm")
>                {
>                    $replacements{'HELPER'} =~ s/en/dis/;
>                }
>
>                my $sed_command = "";
>                foreach my $key (sort keys %replacements)
>                {
>                    my $val = $replacements{$key};
>                    # Use a control char as separator for sed, to
>                    # reduce escaping issues. Everything else is
>                    # passed verbatim, i.e. it must not contain any
>                    # shell or sed special characters.
>                    my $sep = "\x17";
>                    $sed_command .= "s" . $sep . "#$key#" .
>
>It appears to call sort, but perhaps it is sorting the wrong things, or
>at the wrong timing?

This isn't the relevant part, I believe. Neither subversion nor mod-mono
use a .apache2 file to declare the module information. They rely on
dh_apache2's auto-discovery.

The attached patch should make this process reproducible.

Cheers,
-- 
James (he/him)
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

--ie7qyoydzzrw3mmu
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
	filename="0001-dh_apache2-Sort-File-Find-results.patch"

From 979654bae43fe845e6a748543a4b5059b0a80409 Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan@debian.org>
Date: Mon, 23 Nov 2026 22:12:26 -0500
Subject: [PATCH] dh_apache2: Sort File::Find results

When no .apache2 file is present, the has_a_* arrays are populated by
using File::Find::find() to gather relevant files and pushing the
garnered data into the has_a_* arrays. Since the order the files are fed
to find() can vary, this produces non-reproducible results.

Use find()'s preprocess key to sort the files first.

Closes: #1069907
Signed-off-by: James McCoy <jamessan@debian.org>
---
 debian/debhelper/dh_apache2.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index 862d2f85..8e5dbaf6 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -462,6 +462,7 @@ foreach my $package ((@{$dh{DOPACKAGES}}))
 	{
 		# do black magic only if there is no .apache2 configuration file
 		find({  no_chdir => 1,
+			preprocess => sub { sort },
 			wanted => sub
 			{
 				my ($dir, $file) = (dirname($File::Find::name), basename($File::Find::name));
-- 
2.53.0


--ie7qyoydzzrw3mmu--
Bug#1069907: dh_apache2: please output reproducible module package pre/post scripts.
#6222
Author: Vagrant Cascadian
Date: Wed, 25 Nov 2026 23:10
63 lines
4206 bytes
--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On 2026-11-25, James McCoy wrote:
> From 979654bae43fe845e6a748543a4b5059b0a80409 Mon Sep 17 00:00:00 2001
> From: James McCoy <jamessan@debian.org>
> Date: Mon, 23 Nov 2026 22:12:26 -0500
> Subject: [PATCH] dh_apache2: Sort File::Find results
>
> When no .apache2 file is present, the has_a_* arrays are populated by
> using File::Find::find() to gather relevant files and pushing the
> garnered data into the has_a_* arrays. Since the order the files are fed
> to find() can vary, this produces non-reproducible results.
>
> Use find()'s preprocess key to sort the files first.
>
> Closes: #1069907
> Signed-off-by: James McCoy <jamessan@debian.org>
> ---
>  debian/debhelper/dh_apache2.in | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2=
.in
> index 862d2f85..8e5dbaf6 100755
> --- a/debian/debhelper/dh_apache2.in
> +++ b/debian/debhelper/dh_apache2.in
> @@ -462,6 +462,7 @@ foreach my $package ((@{$dh{DOPACKAGES}}))
>  	{
>  		# do black magic only if there is no .apache2 configuration file
>  		find({  no_chdir =3D> 1,
> +			preprocess =3D> sub { sort },
>  			wanted =3D> sub
>  			{
>  				my ($dir, $file) =3D (dirname($File::Find::name), basename($File::Fi=
nd::name));
> --=20
> 2.53.0

Looks close! Thanks for working on it! ... but triggers FTBFS in
subversion:

make[1]: Leaving directory '/build/reproducible-path/subversion-1.15.0'
   dh_apache2 -a -O--builddirectory=3DBUILD
Not enough arguments for sort at /usr/bin/dh_apache2 line 465, near "sort }"
Execution of /usr/bin/dh_apache2 aborted due to compilation errors.


live well,
  vagrant

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCawdpoAAKCRDcUY/If5cW
qmQbAQC/5MWETnqVHaGZ0RbMnV6Rz0P83MhWVz+kjK794ke7TAEAn3lhwUVGPwyW
j1XgaJ4rf8/1WBO3gWdEPvRmY9Dmew4=
=d3nj
-----END PGP SIGNATURE-----
--=-=-=--
Bug#1069907: dh_apache2: please output reproducible module package pre/post scripts.
#6261
Author: James McCoy
Date: Thu, 26 Nov 2026 03:30
60 lines
4026 bytes
--n2bwrc7dtjn3qdgu
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Disposition: inline

On Wed, Nov 25, 2026 at 03:05:04PM -0800, Vagrant Cascadian wrote:
>Looks close! Thanks for working on it! ... but triggers FTBFS in
>subversion:
>
>make[1]: Leaving directory '/build/reproducible-path/subversion-1.15.0'
>   dh_apache2 -a -O--builddirectory=BUILD
>Not enough arguments for sort at /usr/bin/dh_apache2 line 465, near "sort }"

Oops, updated patch attached.

Cheers,
-- 
James (he/him)
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

--n2bwrc7dtjn3qdgu
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
	filename="0001-dh_apache2-Sort-File-Find-results.patch"

From a0316dd0a91b2e4ede0f87e5ac8f240dda9f2266 Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan@debian.org>
Date: Mon, 23 Nov 2026 22:12:26 -0500
Subject: [PATCH] dh_apache2: Sort File::Find results

When no .apache2 file is present, the has_a_* arrays are populated by
using File::Find::find() to gather relevant files and pushing the
garnered data into the has_a_* arrays. Since the order the files are fed
to find() can vary, this produces non-reproducible results.

Use find()'s preprocess key to sort the files first.

Closes: #1069907
Signed-off-by: James McCoy <jamessan@debian.org>
---
 debian/debhelper/dh_apache2.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index 862d2f85..cabfd5bd 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -462,6 +462,7 @@ foreach my $package ((@{$dh{DOPACKAGES}}))
 	{
 		# do black magic only if there is no .apache2 configuration file
 		find({  no_chdir => 1,
+			preprocess => sub { sort @_ },
 			wanted => sub
 			{
 				my ($dir, $file) = (dirname($File::Find::name), basename($File::Find::name));
-- 
2.53.0


--n2bwrc7dtjn3qdgu--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads