Merge ~bryce/ubuntu/+source/php7.4:fix-lp1865218-mod-php-upgrade-focal into ubuntu/+source/php7.4:ubuntu/focal-devel

Proposed by Bryce Harrington
Status: Merged
Approved by: Bryce Harrington
Approved revision: aaca0776a750a660899e230af164ded37dab0738
Merge reported by: Bryce Harrington
Merged at revision: aaca0776a750a660899e230af164ded37dab0738
Proposed branch: ~bryce/ubuntu/+source/php7.4:fix-lp1865218-mod-php-upgrade-focal
Merge into: ubuntu/+source/php7.4:ubuntu/focal-devel
Diff against target: 38 lines (+16/-3)
2 files modified
debian/changelog (+8/-0)
debian/libapache2-mod-php.postinst.extra (+8/-3)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+383849@code.launchpad.net

Description of the change

SRU to fix failure when upgrading with mod-php enabled.

I've verified this works using the test case from the bug #1865218, using this PPA:

PPA: https://launchpad.net/~bryce/+archive/ubuntu/php-defaults-fix-lp1865218-mod-php-upgrade

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

See groovy MP

review: Needs Information
Revision history for this message
Bryce Harrington (bryce) wrote :

Suggested changes applied, ready for re-review.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Checked in detail in groovy, this matches +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index a8f481d..434c2a8 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+php7.4 (7.4.3-4ubuntu2.1) focal; urgency=medium
7+
8+ * libapache2-mod-php.postinst.extra: Disable other mod-php versions.
9+ Fixes failure when upgrading from previous versions of mod-php.
10+ (LP: #1865218)
11+
12+ -- Bryce Harrington <bryce@canonical.com> Tue, 21 Apr 2020 23:04:30 +0000
13+
14 php7.4 (7.4.3-4ubuntu2) focal; urgency=medium
15
16 * SECURITY UPDATE: Read one byte of uninitialized memory
17diff --git a/debian/libapache2-mod-php.postinst.extra b/debian/libapache2-mod-php.postinst.extra
18index 923e475..6c6ef99 100644
19--- a/debian/libapache2-mod-php.postinst.extra
20+++ b/debian/libapache2-mod-php.postinst.extra
21@@ -13,9 +13,14 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
22 fi
23
24 PHP_MODULE=$(a2query -m | sed -n 's/^\(php[\.0-9]*\) (enabled.*)/\1/p')
25- if [ -n "$PHP_MODULE" -a "$PHP_MODULE" != "php@PHP_VERSION@" ]; then
26- apache2_msg "err" "$DPKG_MAINTSCRIPT_PACKAGE: $PHP_MODULE module already enabled, not enabling PHP @PHP_VERSION@"
27- return 1
28+ if [ -n "$PHP_MODULE" -a "$PHP_MODULE" != "php@PHP_VERSION@" ]; then
29+ local a2invoke_ret=0
30+ apache2_msg "info" "$DPKG_MAINTSCRIPT_PACKAGE: Disabling old $PHP_MODULE in favor of using PHP @PHP_VERSION@"
31+ apache2_invoke dismod $PHP_MODULE || a2invoke_ret=1
32+ if [ "${a2invoke_ret}" -ne 0 ]; then
33+ apache2_msg "err" "$DPKG_MAINTSCRIPT_PACKAGE: (${a2invoke_ret}) failed to disable old $PHP_MODULE"
34+ return 1
35+ fi
36 fi
37
38 mpm=$(a2query -M)

Subscribers

People subscribed via source and target branches