#1038166 php-imagick: on upgrades /etc/php/7.4/mods-available/imagick.ini is left behind

Package:
php-imagick
Source:
php-imagick
Description:
Provides a wrapper to the ImageMagick library
Submitter:
Michael Prokop
Date:
2023-06-16 19:54:12 UTC
Severity:
normal
#1038166#5
Date:
2023-06-16 09:35:50 UTC
From:
To:
Hi,

this might be related to #951847, I stumbled upon this behavior
during an upgrade of a Debian system from bullseye to bookworm,
where only file /etc/php/7.4/mods-available/imagick.ini is left
behind.

System based on bullseye looking as follows:

| # ls -la /etc/php/7.4/mods-available/
| total 92
| drwxr-xr-x 2 root root 4096 Jun 16 09:15 .
| drwxr-xr-x 5 root root 4096 Jun 16 09:15 ..
| -rw-r--r-- 1 root root   74 Jun  9 16:51 calendar.ini
| -rw-r--r-- 1 root root   71 Jun  9 16:51 ctype.ini
| -rw-r--r-- 1 root root   70 Jun  9 16:51 exif.ini
| -rw-r--r-- 1 root root   69 Jun  9 16:51 ffi.ini
| -rw-r--r-- 1 root root   74 Jun  9 16:51 fileinfo.ini
| -rw-r--r-- 1 root root   69 Jun  9 16:51 ftp.ini
| -rw-r--r-- 1 root root   73 Jun  9 16:51 gettext.ini
| -rw-r--r-- 1 root root   71 Jun  9 16:51 iconv.ini
| -rw-r--r-- 1 root root   60 Mar  5  2021 imagick.ini
| -rw-r--r-- 1 root root   68 Jun  9 16:51 json.ini
| -rw-r--r-- 1 root root   79 Jun  9 16:51 opcache.ini
| -rw-r--r-- 1 root root   69 Jun  9 16:51 pdo.ini
| -rw-r--r-- 1 root root   70 Jun  9 16:51 phar.ini
| -rw-r--r-- 1 root root   71 Jun  9 16:51 posix.ini
| -rw-r--r-- 1 root root   76 Jun  9 16:51 readline.ini
| -rw-r--r-- 1 root root   71 Jun  9 16:51 shmop.ini
| -rw-r--r-- 1 root root   73 Jun  9 16:51 sockets.ini
| -rw-r--r-- 1 root root   73 Jun  9 16:51 sysvmsg.ini
| -rw-r--r-- 1 root root   73 Jun  9 16:51 sysvsem.ini
| -rw-r--r-- 1 root root   73 Jun  9 16:51 sysvshm.ini
| -rw-r--r-- 1 root root   75 Jun  9 16:51 tokenizer.ini
| # cat /etc/php/7.4/mods-available/imagick.ini
| ; configuration for php imagick module
| extension=imagick.so

Then after upgrading the system to bookworm and applying
configuration file cleanup:

| # dpkg -l | grep php
| ii  php-common                  2:93                         all          Common files for PHP packages
| ii  php-imagick                 3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| rc  php7.4-cli                  7.4.33-1+deb11u4             amd64        command-line interpreter for the PHP scripting language
| rc  php7.4-common               7.4.33-1+deb11u4             amd64        documentation, examples and common module for PHP
| rc  php7.4-json                 7.4.33-1+deb11u4             amd64        JSON module for PHP
| rc  php7.4-opcache              7.4.33-1+deb11u4             amd64        Zend OpCache module for PHP
| rc  php7.4-phpdbg               7.4.33-1+deb11u4             amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
| rc  php7.4-readline             7.4.33-1+deb11u4             amd64        readline module for PHP
| ii  php8.2-cli                  8.2.7-1~deb12u1              amd64        command-line interpreter for the PHP scripting language
| ii  php8.2-common               8.2.7-1~deb12u1              amd64        documentation, examples and common module for PHP
| ii  php8.2-imagick              3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| ii  php8.2-opcache              8.2.7-1~deb12u1              amd64        Zend OpCache module for PHP
| ii  php8.2-phpdbg               8.2.7-1~deb12u1              amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
| ii  php8.2-readline             8.2.7-1~deb12u1              amd64        readline module for PHP
| # dpkg --purge php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
| [...]

Then only `/etc/php/7.4/mods-available/imagick.ini` is left behind:

| # ls -la /etc/php/7.4/mods-available/
| total 12
| drwxr-xr-x 2 root root 4096 Jun 16 09:25 .
| drwxr-xr-x 3 root root 4096 Jun 16 09:25 ..
| -rw-r--r-- 1 root root   60 Mar  5  2021 imagick.ini
|
| # ls -la /etc/php/7.4/mods-available/imagick.ini
| -rw-r--r-- 1 root root 60 Mar  5  2021
| /etc/php/7.4/mods-available/imagick.ini
| # dpkg -S /etc/php/7.4/mods-available/imagick.ini
| php-imagick: /etc/php/7.4/mods-available/imagick.ini

Something feels wrong here?

FTR:

| # apt-cache policy php-imagick php8.2-imagick
| php-imagick:
|   Installed: 3.7.0-4
|   Candidate: 3.7.0-4
|   Version table:
|  *** 3.7.0-4 500
|         500 http://deb.debian.org/debian bookworm/main amd64 Packages
|         100 /var/lib/dpkg/status
| php8.2-imagick:
|   Installed: 3.7.0-4
|   Candidate: 3.7.0-4
|   Version table:
|  *** 3.7.0-4 500
|         500 http://deb.debian.org/debian bookworm/main amd64 Packages
|         100 /var/lib/dpkg/status
|
| # dpkg -L php-imagick
| /.
| /usr
| /usr/share
| /usr/share/doc
| /usr/share/doc/php-imagick
| /usr/share/doc/php-imagick/changelog.Debian.gz
| /usr/share/doc/php-imagick/copyright
| /etc/php/7.4/mods-available/imagick.ini
|
| # cat /var/lib/dpkg/info/php-imagick.list
| /.
| /usr
| /usr/share
| /usr/share/doc
| /usr/share/doc/php-imagick
| /usr/share/doc/php-imagick/changelog.Debian.gz
| /usr/share/doc/php-imagick/copyright
| /etc/php/7.4/mods-available/imagick.ini
|
| # cat /var/lib/dpkg/info/php8.2-imagick.conffiles
| /etc/php/8.2/mods-available/imagick.ini

regards
-mika-

#1038166#10
Date:
2023-06-16 10:26:39 UTC
From:
To:
You have just removed but not purged the php7.4 packages, so that’s expected.
#1038166#15
Date:
2023-06-16 11:19:33 UTC
From:
To:
Hi,

* Ondřej Surý [Fri Jun 16, 2023 at 12:26:39PM +0200]:

As stated, those are all php* packages that exist(ed) on the system:

And I purged all of the php7.4 ones (as stated):

| root@d17a279d1015:/# dpkg -l | grep php
| ii  php-common                  2:93                         all          Common files for PHP packages
| ii  php-imagick                 3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| rc  php7.4-cli                  7.4.33-1+deb11u4             amd64        command-line interpreter for the PHP scripting language
| rc  php7.4-common               7.4.33-1+deb11u4             amd64        documentation, examples and common module for PHP
| rc  php7.4-json                 7.4.33-1+deb11u4             amd64        JSON module for PHP
| rc  php7.4-opcache              7.4.33-1+deb11u4             amd64        Zend OpCache module for PHP
| rc  php7.4-phpdbg               7.4.33-1+deb11u4             amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
| rc  php7.4-readline             7.4.33-1+deb11u4             amd64        readline module for PHP
| ii  php8.2-cli                  8.2.7-1~deb12u1              amd64        command-line interpreter for the PHP scripting language
| ii  php8.2-common               8.2.7-1~deb12u1              amd64        documentation, examples and common module for PHP
| ii  php8.2-imagick              3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| ii  php8.2-opcache              8.2.7-1~deb12u1              amd64        Zend OpCache module for PHP
| ii  php8.2-phpdbg               8.2.7-1~deb12u1              amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
| ii  php8.2-readline             8.2.7-1~deb12u1              amd64        readline module for PHP
| root@d17a279d1015:/# dpkg --purge php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
| (Reading database ... 11733 files and directories currently installed.)
| Purging configuration files for php7.4-cli (7.4.33-1+deb11u4) ...
| Purging configuration files for php7.4-common (7.4.33-1+deb11u4) ...
| Purging configuration files for php7.4-json (7.4.33-1+deb11u4) ...
| dpkg: warning: while removing php7.4-json, directory '/etc/php/7.4/mods-available' not empty so not removed
| Purging configuration files for php7.4-opcache (7.4.33-1+deb11u4) ...
| Purging configuration files for php7.4-phpdbg (7.4.33-1+deb11u4) ...
| dpkg: warning: while removing php7.4-phpdbg, directory '/etc/php/7.4' not empty so not removed
| Purging configuration files for php7.4-readline (7.4.33-1+deb11u4) ...
| root@d17a279d1015:/# dpkg -l | grep php
| ii  php-common                  2:93                         all          Common files for PHP packages
| ii  php-imagick                 3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| ii  php8.2-cli                  8.2.7-1~deb12u1              amd64        command-line interpreter for the PHP scripting language
| ii  php8.2-common               8.2.7-1~deb12u1              amd64        documentation, examples and common module for PHP
| ii  php8.2-imagick              3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
| ii  php8.2-opcache              8.2.7-1~deb12u1              amd64        Zend OpCache module for PHP
| ii  php8.2-phpdbg               8.2.7-1~deb12u1              amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
| ii  php8.2-readline             8.2.7-1~deb12u1              amd64        readline module for PHP
| root@d17a279d1015:/# ls /etc/php/
| 7.4/ 8.2/
| root@d17a279d1015:/# ls /etc/php/7.4/mods-available/
| imagick.ini

So I don't understand which php7.4 package you're referring to. :)

The problem is perfectly reproducible:

  % podman run --pull=always --rm -i -t debian:bullseye bash
  # apt update ; apt-get -y install php-imagick
  [...]
  # cat > /etc/apt/sources.list << EOF
  deb http://deb.debian.org/debian bookworm main non-free-firmware
  deb http://deb.debian.org/debian-security/ bookworm-security main non-free-firmware
  deb http://deb.debian.org/debian bookworm-updates main non-free-firmware
  EOF
  # apt update ; apt-get -y install php-common
  [...]
  # dpkg --purge php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
  [...]
  # dpkg -S /etc/php/7.4/mods-available/imagick.ini
  php-imagick: /etc/php/7.4/mods-available/imagick.ini

HTH

regards
-mika-

#1038166#20
Date:
2023-06-16 15:04:41 UTC
From:
To:
You did not. The rc at the beginning of the line means exactly that.

ondrej@calcifer:~$ dpkg -l php7.4-memcached
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/tri>
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version                                 >
+++-================-========================================>
rc  php7.4-memcached 3.1.5+2.2.0-9+0~20210228.30+debian11~1.g>

ondrej@calcifer:~$ sudo dpkg --purge php7.4-memcached
(Reading database ... 309586 files and directories currently installed.)
Purging configuration files for php7.4-memcached (3.1.5+2.2.0-9+0~20210228.30+debian11~1.gbp2db493) ...


ondrej@calcifer:~$ dpkg -l php7.4-memcached
dpkg-query: no packages found matching php7.4-memcached
ondrej@calcifer:~$

#1038166#25
Date:
2023-06-16 18:36:34 UTC
From:
To:
Hi,

* Ondřej Surý [Fri Jun 16, 2023 at 05:04:41PM +0200]:

Yeah? I've no idea why you're bringing up php7.4-memcached now, I
never mentioned this nor had it installed, I also did remove and
purge *all* the php7.4 packages as you can see from my output
provided in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038166#15

Let me try again, see my STR (repeating from
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038166#15, I once
again verified it):

  % podman run --pull=always --rm -i -t debian:bullseye bash
  # apt update ; apt-get -y install php-imagick
  [...]
  # cat > /etc/apt/sources.list << EOF
  deb http://deb.debian.org/debian bookworm main non-free-firmware
  deb http://deb.debian.org/debian-security/ bookworm-security main non-free-firmware
  deb http://deb.debian.org/debian bookworm-updates main non-free-firmware
  EOF
  # apt update ; apt-get -y install php-common
  [...]
  # dpkg --purge php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
  # dpkg -S /etc/php/7.4/mods-available/imagick.ini
  php-imagick: /etc/php/7.4/mods-available/imagick.ini

And to highlight its result:

  root@8c0e4100a294:/# dpkg -l | grep php
  ii  php-common                  2:93                         all          Common files for PHP packages
  ii  php-imagick                 3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
  ii  php8.2-cli                  8.2.7-1~deb12u1              amd64        command-line interpreter for the PHP scripting language
  ii  php8.2-common               8.2.7-1~deb12u1              amd64        documentation, examples and common module for PHP
  ii  php8.2-imagick              3.7.0-4                      amd64        Provides a wrapper to the ImageMagick library
  ii  php8.2-opcache              8.2.7-1~deb12u1              amd64        Zend OpCache module for PHP
  ii  php8.2-phpdbg               8.2.7-1~deb12u1              amd64        server-side, HTML-embedded scripting language (PHPDBG binary)
  ii  php8.2-readline             8.2.7-1~deb12u1              amd64        readline module for PHP
  root@8c0e4100a294:/# dpkg -l | grep -v '^ii'
  Desired=Unknown/Install/Remove/Purge/Hold
  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  ||/ Name                        Version                      Architecture Description
  +++-===========================-============================-============-===========================================================================
  root@8c0e4100a294:/# dpkg -S /etc/php/7.4/mods-available/imagick.ini
  php-imagick: /etc/php/7.4/mods-available/imagick.ini

I really don't see what I should have done wrong, sorry.

regards
-mika-

#1038166#30
Date:
2023-06-16 19:49:57 UTC
From:
To:
Oh, I see now. Too much text on too little screen. Sorry.

I’ll think whether there’s easy way to fix that, but since the conffile is still registered with the package, I think this is harmless as purging php-imagick will remove the file.

Ondřej
--
Ondřej Surý <ondrej@sury.org> (He/Him)