Package: tee-supplicant
Version: 4.3.0-1
Severity: serious
Justification: loss of packaged files
Tags: patch
User: helm...@debian.org
Usertags: dep17p6
User: debian-...@lists.debian.org
Usertags: armhf arm64
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

The empty directory /lib/optee_armtz may go missing. Steps to reproduce:

 * Use a trixie or sid system.
 * Install optee-test-qemu and tee-supplicant.
 * Remove optee-test-qemu.
 * dpkg --verify will show
   missing     /lib/optee_armtz

Note that optee-test-qemu installs files to /usr/lib/optee_armtz while
tee-supplicant installs /lib/optee_armtz as an empty directory. When
dpkg removes optee-test-qemu, it sees that /usr/lib/optee_armtz is empty
and not owned by any other package (not realizing that it is the same as
/lib/optee_armtz) and deletes it (deleting /lib/optee_armtz from
tee-supplicant in the process).

The solution here is fairly simple. tee-supplicant needs to install
/usr/lib/optee_armtz instead. The documentation may remain as is,
because base-files guarantees that /lib is a symlink pointing to
usr/lib. A prior missing /lib/optee_armtz will be created during the
upgrade and a later removal of optee-test-qemu will no longer delete
/usr/lib/optee_armtz as dpkg then notices it still being owned by
tee-supplicant.

We also are in the lucky situation that do not have to care about
upgrades from bookworm as neither package is part of bookworm. Hence
this seemingly simple change is all that it takes to fix this bug.

It took me a while to fully understand this and I happened to build
optee-client a few times to experiment with it. To speed up that
process, I opted for cross building and hence the attached patch also
fixes the cross build. Please consider applying that aspect as well even
though it is not release critical.

If you have any questions, consider consulting
https://subdivi.de/~helmut/dep17.html section P6 and/or asking me.

Helmut
diff --minimal -Nru optee-client-4.3.0/debian/changelog 
optee-client-4.3.0/debian/changelog
--- optee-client-4.3.0/debian/changelog 2024-07-22 22:03:44.000000000 +0200
+++ optee-client-4.3.0/debian/changelog 2025-01-06 15:00:48.000000000 +0100
@@ -1,3 +1,11 @@
+optee-client (4.3.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix empty directory loss (DEP17 P6, Closes: #-1)
+  * Fix FTCBFS: Export PKG_CONFIG for make install.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 06 Jan 2025 15:00:48 +0100
+
 optee-client (4.3.0-1) unstable; urgency=low
 
   * New upstream version 4.3.0
diff --minimal -Nru optee-client-4.3.0/debian/rules 
optee-client-4.3.0/debian/rules
--- optee-client-4.3.0/debian/rules     2024-07-22 22:01:40.000000000 +0200
+++ optee-client-4.3.0/debian/rules     2025-01-06 15:00:48.000000000 +0100
@@ -3,6 +3,8 @@
 # output every command that modifies files on the build system.
 #export DH_VERBOSE = 1
 
+include /usr/share/dpkg/buildtools.mk
+export PKG_CONFIG
 
 # see FEATURE AREAS in dpkg-buildflags(1)
 #export DEB_BUILD_MAINT_OPTIONS = hardening=+all
diff --minimal -Nru optee-client-4.3.0/debian/tee-supplicant.dirs 
optee-client-4.3.0/debian/tee-supplicant.dirs
--- optee-client-4.3.0/debian/tee-supplicant.dirs       2024-07-22 
22:01:40.000000000 +0200
+++ optee-client-4.3.0/debian/tee-supplicant.dirs       2025-01-06 
13:50:19.000000000 +0100
@@ -1,2 +1,2 @@
-lib/optee_armtz/
+usr/lib/optee_armtz/
 usr/lib/tee-supplicant/plugins/

Reply via email to