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
>From 979654bae43fe845e6a748543a4b5059b0a80409 Mon Sep 17 00:00:00 2001
From: James McCoy <[email protected]>
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 <[email protected]>
---
 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

Reply via email to