[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. cc22599b44cc9aeae67774d3fba9715671c76ac0

Stefan Fritsch sf at sfritsch.de
Mon Apr 30 20:53:14 UTC 2012


The following commit has been merged in the next branch:
commit cc22599b44cc9aeae67774d3fba9715671c76ac0
Author: Stefan Fritsch <sf at sfritsch.de>
Date:   Mon Apr 30 19:09:09 2012 +0200

    Make dh_apache2 only accept shell function names as conditional
    
    This avoids problems with shell and sed special characters, especially
    after debhelper reverted the fix for #660794.
    Also lower the minimum debhelper dependency of dh_apache2 again.

diff --git a/debian/changelog b/debian/changelog
index e501c3d..6c8f801 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ apache2 (2.4.2-2) experimental; urgency=low
     not pulled in by any of the enabled modules, but we need it in any case
     for apache2.conf. Closes: #669876
   * Don't ship the changelogs in the apache2-mpm-itk transitional package.
+  * Make dh_apache2 only accept shell function names as conditional, to avoid
+    problems with shell and sed special characters.
 
   [ Arno Töll ]
   * Add mode lines to various configuration files and scripts. Reformat
diff --git a/debian/control b/debian/control
index 947963f..3f52a04 100644
--- a/debian/control
+++ b/debian/control
@@ -184,7 +184,7 @@ Description: Apache HTTP Server (on-site documentation)
 Package: apache2-dev
 Architecture: any
 Depends: ${misc:Depends}, apache2 (= ${binary:Version}), openssl,
- libapr1-dev, libaprutil1-dev, debhelper (>= 9.20120311~), ${perl:Depends}
+ libapr1-dev, libaprutil1-dev, debhelper (>= 9), ${perl:Depends}
 Provides: apache2-prefork-dev, apache2-threaded-dev, dh-apache2
 Replaces: apache2-prefork-dev, apache2-threaded-dev
 Conflicts: apache2-prefork-dev, apache2-threaded-dev
diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index d03f7e9..0fdf2ef 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -221,16 +221,15 @@ Call the named shell I<function> if running the maintainer script fails. The
 function should be provided in the F<prerm> and F<postinst> scripts, before the
 B<#DEBHELPER#> token.
 
-=item S<B<--conditional>>=I<expression>
+=item S<B<--conditional>>=I<function>
 
-Only execute maintainer scripts if the supplied I<expression> evaluates to a
+Only execute maintainer scripts if the named shell I<function> evaluates to a
 true value at installation time. This is useful to web applications which want
 to install Apache configuration files depending on a user input, for example if
 they interface to the user through L<debconf(1)>.
 
-Defaults to B<true> and is subject to shell expansion (see Debian bug #660794
-which was reverted in a later debhelper version again). The expression should
-be provided in the postrm and postinst scripts before the B<#DEBHELPER#>
+The defaults is to always execute the scripts. The named function should be
+provided in the F<prerm> and F<postinst> scripts, before the B<#DEBHELPER#>
 token.
 
 =item S<B<--restart>> S<B<-r>
@@ -302,6 +301,9 @@ if (!$dh{CONDITIONAL})
 {
 	$dh{CONDITIONAL} = 'true';
 }
+elsif ($dh{CONDITIONAL} !~ /^\w+$/) {
+	die "The conditional function name must only contain ASCII letters, numbers, and underscores\n";
+}
 
 if ($dh{RESTART})
 {
@@ -508,9 +510,14 @@ foreach my $package (getpackages())
 				foreach my $key (sort keys %replacements)
 				{
 					my $val = $replacements{$key};
-					# escape slashes and backslashes from sed
-					$val =~ s,([/\\]),\$1,g;
-					$sed_command .= "s/#$key#/$val/g; ";
+					# 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#" .
+							      $sep . $val .
+							      $sep . "g; ";
 				}
 
 				autoscript($package, "$script_type", "$script_type-apache2", $sed_command);

-- 
Debian packaging for apache2 (Apache HTTPD 2.x)



More information about the Pkg-apache-commits mailing list