Fix PHP_EXTRA_VERSION setting

Bug #1989196 reported by Athos Ribeiro
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php
Unknown
Unknown
php7.4 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Athos Ribeiro
php8.1 (Ubuntu)
Status tracked in Kinetic
Jammy
New
Undecided
Athos Ribeiro
Kinetic
Fix Released
Undecided
Athos Ribeiro

Bug Description

[ Impact ]

Until bionic, the PHP_VERSION variable and the `php --version` command output included the deb version as a suffix of the release (e.g., 7.2.20-1ubuntu2).

From focal and on, a change in the upstream configure.ac file was not accounted for in d/rules, introducing a regression.

Now, users can no longer tell if a specific php release contains a certain fix from within PHP just by parsing the internal version defined in PHP_VERSION.

[ Test Plan ]

There is a autopkgtest being proposed with this change that covers the testing for this SRU (debian/tests/version).

The idea is to compare the full deb package version string with the one in the "php --version" output. A fixed patch should show the same for both. The following script extracted from d/t/version should cover it (for focal, substitute the php version when checking/using the cli package):

#!/bin/sh
PKGVERSION=$(dpkg-query --showformat='${Version}\n' --show php8.1-cli)
PHPVERSION=$(php8.1 --version | head -1 | cut -d ' ' -f2)

if [ "${PKGVERSION}" != "${PHPVERSION}" ]; then
 echo "package version '${PKGVERSION}' does not match php CLI version '${PHPVERSION}'"
 exit 1
fi

[ Where problems could occur ]

This changes the output of "php --version" and the value set for the PHP_VERSION variable. This means that any program parsing the php version, either internally through php, or by parsing the output of `php --version`, and not accounting for possible string contents in the debian version part of the package version (e.g., -1ubuntu3 or -1ubuntu3~something) will possibly crash and will need to be adjusted.

[ Other Info ]

This is already fixed in kinetic.

While the jammy SRU will be useful to identify the previous SRU, which is specially valuable for the drupal community, the focal SRU has lower priority and therefore we should stage it (block in proposed).

[ Original message ]

The PHP_EXTRA_VERSION constant is configured in debian/rules, but the sed substitution performed in such line no longer applies since PHP 7.4 (focal).

It currently looks for
PHP_EXTRA_VERSION=""
which was available at:
https://github.com/php/php-src/blob/php-7.2.34/configure.ac#L111

Now, when we look at
https://github.com/php/php-src/blob/php-7.4.30/configure.ac#L117
we see
PHP_EXTRA_VERSION=[$]4

Which is why the following sed command, present in d/rules, no longer applies:
$(SED) -i -e 's/EXTRA_VERSION=""/EXTRA_VERSION="-$(PHP_DEBIAN_REVISION)"/' configure.ac

The fix here seems to be straightforward and should provide means for third party software to detect whether a specific Ubuntu PHP version carries certain features or fixes. ATM, this will be specially useful for Drupal to detect if PHP8.1 < 8.1.6 (i.e., jammy's PHP) carries an OPCache fix, introduced in LP: #1983205

Tags: server-todo

Related branches

no longer affects: php7.4 (Ubuntu Jammy)
no longer affects: php7.4 (Ubuntu Kinetic)
no longer affects: php8.1 (Ubuntu Focal)
Changed in php7.4 (Ubuntu):
status: New → Invalid
Changed in php8.1 (Ubuntu Kinetic):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Changed in php8.1 (Ubuntu Jammy):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Changed in php7.4 (Ubuntu Focal):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
tags: added: server-todo
Changed in php8.1 (Ubuntu Kinetic):
status: New → In Progress
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php8.1 - 8.1.7-1ubuntu3

---------------
php8.1 (8.1.7-1ubuntu3) kinetic; urgency=medium

  * d/rules: fix PHP_EXTRA_VERSION setting. (LP: #1989196)
  * Test PHP_EXTRA_VERSION setting with autopkgtest.

 -- Athos Ribeiro <email address hidden> Tue, 13 Sep 2022 11:02:34 -0300

Changed in php8.1 (Ubuntu Kinetic):
status: In Progress → Fix Released
description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.