Merge ~bryce/ubuntu/+source/php8.1:fix-lp1890263-jammy into ubuntu/+source/php8.1:ubuntu/devel

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: 131b045cd85901ba1c4fd68ca9242f680f34d820
Proposed branch: ~bryce/ubuntu/+source/php8.1:fix-lp1890263-jammy
Merge into: ubuntu/+source/php8.1:ubuntu/devel
Diff against target: 139 lines (+75/-2)
4 files modified
debian/changelog (+9/-0)
debian/control (+32/-0)
debian/control.in (+32/-0)
debian/rules (+2/-2)
Reviewer Review Type Date Requested Status
Canonical Server Pending
Canonical Server packageset reviewers Pending
Review via email: mp+419245@code.launchpad.net

Description of the change

Since the package name providing mod-php includes the php version number, when moving to new PHP versions it gets removed rather than upgraded. This branch adds dummy packages with the same names as the old mod-phps; these dummy packages are empty and just serve to require the 'libapache2-mod-php' virtual package, when in turn pulls in the latest versioned mod-php. Breaks/Replaces are included to ensure the old stuff gets ejected in favor of the newer.

I found that the build would fail building in PPA (but not locally) during dh_install because these packages weren't found. I worked around this via a couple --exclude arguments, as suggested by some random internet pages, but am not sure if there may be better solutions for this.

I've tested this only lightly so far, so there may still be some large corner cases I've overlooked. I'll be continuing to test it, and appreciate any additional banging on it others can do.

I'm also looking for feedback on the general approach. I plan to SRU this fix to focal as well (for bionic->focal upgrades), etc.

A PPA with this fix is at:
 https://launchpad.net/~bryce/+archive/ubuntu/modphp-upgrade-lp1890263-fixed-backports/+packages

Easiest way to test this is to set up an impish LXC container, install libapache2-mod-php8.0, then install the PPA and apt-get full-upgrade. It should install libapache2-mod-php8.1.

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

I was curious what the outcome of this testing will be - I see it ended as double replaces combined with a double transitional package.

You have made the versioned transitional to depend on the generic libapache2-mod-php.
Which will depend on whatever the current version is.
I know that you know that there might be corner cases left.
For example:
If you installed in the past the generic libapache2-mod-php all will be fine anyway.
But if you installed the versioned pkg in the past it will now via the transitional depend on the new version. But since the transitional says "can be removed" people might remove it and then nothing will depend on the new versioned mod-php anymore leading to the old problem. So the new version might show in auto-remove.

I have done some testing to check my assumptions, after upgrade I got:
ii libapache2-mod-php 2:8.1+92ubuntu2~impish2
ii libapache2-mod-php8.0 8.1.2-1ubuntu2~impish4
ii libapache2-mod-php8.1 8.1.2-1ubuntu2~impish4
Good so far,

But also as assumed if I do remove the transitional now I get:
The following packages were automatically installed and are no longer required:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php libapache2-mod-php8.1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.3-0 php-common php8.1-cli
  php8.1-common php8.1-opcache php8.1-readline ssl-cert
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  libapache2-mod-php8.0
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 6144 B disk space will be freed.
Do you want to continue? [Y/n]

After "apt install libapache2-mod-php8.1" or "apt install libapache2-mod-php" this would no more happen.

But I stay to my word that I think it might be ok to close 95% of this issue which is much better not fixing it at all.
- It does no more remove mod-php on upgrade +1
- It does not list it on auto-remove +1
- Removing the transitional only puts the new one on auto-remove
-> That might indeed be enough, open for future improvement but enough to fix the immediate issue before people upgrade to 22.04

---

I have also a few very minor comments inline below ...

About the issues that made you add "--exclude=" do you have a pastebin of those issues?
I think only than can others think about suggesting alternatives (if there are any).

Disabling the pedantic along the way LGTM as well.

+99 from my side

Not consuming the review slot to leave this open for other reviews or suggestions.

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

Yes, using the libapache2-mod-php virtual package to indirectly pull in the versioned package feels like a bit of a hack, and you're right there's gonna be some corner cases people hit there. I'd love to know if there's a way we can tighten that up, but at least it's something people would have to hit via making a mistake rather than purely by accident so it's at least a good improvement over the current situation and does not appear likely to affect or break proper workflows.

For the "--exclude=" items, unfortunately I didn't save the output I hit there, but should be straightforward to reproduce. I'll try to remember to include that with the SRU tickets.

For those curious about the pedantic errors, they are visible in the current build logs on launchpad.

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

Regarding the "PHP is a..." boilerplate, I included it only because the other packages all included it, however looking closer at least one transitional dummy package (php8.1-xsl) omits it. I'll drop it.

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 1421b49..5a2f7ed 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+php8.1 (8.1.2-1ubuntu2) jammy; urgency=medium
7+
8+ * d/control: Add transitional packages and Breaks/Replaces to force
9+ upgrade from earlier mod-php's to version 8.1.
10+ (LP: #1890263)
11+ * d/rules: Don't fill up build log with pedantic warnings.
12+
13+ -- Bryce Harrington <bryce@canonical.com> Thu, 07 Apr 2022 17:46:26 +0000
14+
15 php8.1 (8.1.2-1ubuntu1) jammy; urgency=medium
16
17 * SECURITY UPDATE: use-after-free in php_filter_float()
18diff --git a/debian/control b/debian/control
19index 7636a6f..d0a76ae 100644
20--- a/debian/control
21+++ b/debian/control
22@@ -94,6 +94,8 @@ Depends: libmagic1,
23 Provides: libapache2-mod-php,
24 php8.1-json,
25 ${php:Provides}
26+Replaces: libapache2-mod-php7.4 (>> 8.1.2-1~),
27+ libapache2-mod-php8.0 (>> 8.1.2-1~)
28 Recommends: apache2
29 Suggests: php-pear
30 Description: server-side, HTML-embedded scripting language (Apache 2 module)
31@@ -107,6 +109,36 @@ Description: server-side, HTML-embedded scripting language (Apache 2 module)
32 open source general-purpose scripting language that is especially suited
33 for web development and can be embedded into HTML.
34
35+Package: libapache2-mod-php7.4
36+Section: httpd
37+Architecture: any
38+Replaces: libapache2-mod-php7.4 (<< 7.4.3-5~)
39+Breaks: libapache2-mod-php7.4 (<< 7.4.3-5~)
40+Depends: libapache2-mod-php,
41+ ${misc:Depends},
42+ ${shlibs:Depends}
43+Description: Transitional package
44+ This is a transitional package to libapache2-mod-php8.1. It can be safely removed.
45+ .
46+ PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
47+ open source general-purpose scripting language that is especially suited
48+ for web development and can be embedded into HTML.
49+
50+Package: libapache2-mod-php8.0
51+Section: httpd
52+Architecture: any
53+Replaces: libapache2-mod-php8.0 (<< 8.0.8-2~)
54+Breaks: libapache2-mod-php8.0 (<< 8.0.8-2~)
55+Depends: libapache2-mod-php,
56+ ${misc:Depends},
57+ ${shlibs:Depends}
58+Description: Transitional package
59+ This is a transitional package to libapache2-mod-php8.1. It can be safely removed.
60+ .
61+ PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
62+ open source general-purpose scripting language that is especially suited
63+ for web development and can be embedded into HTML.
64+
65 Package: libphp8.1-embed
66 Architecture: any
67 Depends: libmagic1,
68diff --git a/debian/control.in b/debian/control.in
69index 709af91..1d5a42e 100644
70--- a/debian/control.in
71+++ b/debian/control.in
72@@ -94,6 +94,8 @@ Depends: libmagic1,
73 Provides: libapache2-mod-php,
74 php@PHP_VERSION@-json,
75 ${php:Provides}
76+Replaces: libapache2-mod-php7.4 (>> 8.1.2-1~),
77+ libapache2-mod-php8.0 (>> 8.1.2-1~)
78 Recommends: apache2
79 Suggests: php-pear
80 Description: server-side, HTML-embedded scripting language (Apache 2 module)
81@@ -107,6 +109,36 @@ Description: server-side, HTML-embedded scripting language (Apache 2 module)
82 open source general-purpose scripting language that is especially suited
83 for web development and can be embedded into HTML.
84
85+Package: libapache2-mod-php7.4
86+Section: httpd
87+Architecture: any
88+Replaces: libapache2-mod-php7.4 (<< 7.4.3-5~)
89+Breaks: libapache2-mod-php7.4 (<< 7.4.3-5~)
90+Depends: libapache2-mod-php,
91+ ${misc:Depends},
92+ ${shlibs:Depends}
93+Description: Transitional package
94+ This is a transitional package to libapache2-mod-php8.1. It can be safely removed.
95+ .
96+ PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
97+ open source general-purpose scripting language that is especially suited
98+ for web development and can be embedded into HTML.
99+
100+Package: libapache2-mod-php8.0
101+Section: httpd
102+Architecture: any
103+Replaces: libapache2-mod-php8.0 (<< 8.0.8-2~)
104+Breaks: libapache2-mod-php8.0 (<< 8.0.8-2~)
105+Depends: libapache2-mod-php,
106+ ${misc:Depends},
107+ ${shlibs:Depends}
108+Description: Transitional package
109+ This is a transitional package to libapache2-mod-php8.1. It can be safely removed.
110+ .
111+ PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
112+ open source general-purpose scripting language that is especially suited
113+ for web development and can be embedded into HTML.
114+
115 Package: libphp@PHP_VERSION@-embed
116 Architecture: any
117 Depends: libmagic1,
118diff --git a/debian/rules b/debian/rules
119index 69374a7..1b3fc90 100755
120--- a/debian/rules
121+++ b/debian/rules
122@@ -138,7 +138,7 @@ ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
123 else
124 DEB_CFLAGS_MAINT_APPEND += -O0
125 endif
126-DEB_CFLAGS_MAINT_APPEND += -Wall -pedantic -fsigned-char -fno-strict-aliasing
127+DEB_CFLAGS_MAINT_APPEND += -Wall -fsigned-char -fno-strict-aliasing
128 DEB_CFLAGS_MAINT_APPEND += $(shell getconf LFS_CFLAGS)
129
130 # Enable IEEE-conformant floating point math on alphas (not the default)
131@@ -499,7 +499,7 @@ override_dh_install-arch: remove-files-stamp prepare-fpm-pools
132 install -d -m 755 debian/tmp/usr/lib/cgi-bin/
133 ln debian/tmp/usr/bin/php-cgi$(PHP_NAME_VERSION) debian/tmp/usr/lib/cgi-bin/php$(PHP_NAME_VERSION)
134
135- dh_install --fail-missing
136+ dh_install --fail-missing --exclude=libapache2-mod-php7.4 --exclude=libapache2-mod-php8.0
137
138 # Install a helper script for checking PHP FPM configuration
139 mkdir -p debian/$(PHP_FPM)/usr/lib/php/

Subscribers

People subscribed via source and target branches