Your message dated Thu, 07 Feb 2019 01:34:10 +0000
with message-id <e1gryzu-000b0l...@fasolo.debian.org>
and subject line Bug#819705: fixed in b43-fwcutter 1:019-4
has caused the Debian Bug report #819705,
regarding firmware-b43-installer: Brittle handling of /lib/firmware/b43, can 
readily conflict with other packages, improper removal during *postrm*
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
819705: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819705
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: firmware-b43-installer
Version: 1:019-2
Severity: important
Tags: patch

I'm fearful this should be marked "serious", rather than "important".

firmware-b43-installer's handling of /lib/firmware/b43 is very brittle.
Notably it doesn't register the contents of the directory with `dpkg`.
Worse, during *postrm* it does an `rm -rf /lib/firmware/b43`.  As a
result, even a package that merely conflicts with firmware-b43-installer
will be broken since the rm will be done *after* that package is
installed.

The attached patch attempts to remedy this in two ways.  First, it
creates a file in /lib/firmware/b43 cataloging the firmware files that
have been installed.  Second, during removal the list of files is run
past `dpkg-query -S` to ensure nothing taken over by other packages is
removed.

A better solution is bug #819136.  Making the firmware into a package
which can then be installed using `dpkg` and thus removal is safely
handled.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sig...@m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445


>From 12387d36ac959d6355af15103c13681afda56298 Mon Sep 17 00:00:00 2001
From: Elliott Mitchell <ehem+deb...@drgnwing.com>
Date: Thu, 31 Mar 2016 17:33:23 -0700
Subject: [PATCH 01/10] Implement catalog of firmware files installed

This allows for targeted removal of downloaded firmware files, instead of
needing to remove the whole directory.  Also pass paths to be removed
through `dpkg-query -S`, increasing safety of removals.  This is much
safer and allows for other features.
---
 debian/firmware-b43-installer.postinst |   33 +++++++++++++++++++++++++-------
 debian/firmware-b43-installer.postrm   |   15 ---------------
 debian/firmware-b43-installer.prerm    |   28 +++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 22 deletions(-)
 delete mode 100644 debian/firmware-b43-installer.postrm
 create mode 100644 debian/firmware-b43-installer.prerm

diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst
index 0d9c0e1..d8794c2 100644
--- a/debian/firmware-b43-installer.postinst
+++ b/debian/firmware-b43-installer.postinst
@@ -25,16 +25,35 @@ fi
 if ! wget --timeout=60 http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2 ; then
 	echo "Some problem occurred during the firmware download. Please check your internet connection." 
 	exit 0
-    else
-	if [ -d /lib/firmware/b43 ]; then
-	   echo "Deleting old extracted firmware..."
-	   rm -rf /lib/firmware/b43
-	fi
 fi
 tar xvjf broadcom-wl-5.100.138.tar.bz2
 cd broadcom-wl-5.100.138/linux
-b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" wl_apsta.o
+if [ -d "${FIRMWARE_INSTALL_DIR}/b43" ]; then
+	echo "Deleting old extracted firmware..."
+	xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm --
+	rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog"
+fi
+mkdir "${FIRMWARE_INSTALL_DIR}/b43" || true
+catalog="${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog"
+retcode=0
+b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" wl_apsta.o | while read line
+do	echo "${line}"
+	file="${line#Extracting }"
+	if [ "${file}" != "${line}" ]
+	then	if [ "${retcode}" -ne 0 ]
+		then	rm "${FIRMWARE_INSTALL_DIR}/${file}"
+
+		elif [ -z "${FIRMWARE_INSTALL_DIR}/${file}" ] || \
+		! printf %s/%s\\x00 "${FIRMWARE_INSTALL_DIR}" "${file}" >> "${catalog}"
+		then	echo "$0: Failed during extraction of ${file} from ${WL_APSTA}" 1>&2
+			echo "$0: Warning, manual removal/cleaning of ${FIRMWARE_INSTALL_DIR}/b43 may be needed!" 1>&2
+			rm "${FIRMWARE_INSTALL_DIR}/${file}"
+			retcode=1
+		fi
+	fi
+done
 rm -rf $tmp
+[ ${retcode} -eq 0 ] || exit ${retcode}
 }
 
 # check environment
@@ -48,7 +67,7 @@ if [ "$(stat -c %d/%i /)" != "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ];
     echo "No chroot environment found. Starting normal installation"
 fi
      
-     
+
 
 
 # check kernel version
diff --git a/debian/firmware-b43-installer.postrm b/debian/firmware-b43-installer.postrm
deleted file mode 100644
index 339d140..0000000
--- a/debian/firmware-b43-installer.postrm
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = purge ] || [ "$1" = remove ]; then
-
-	if [ -d /lib/firmware/b43 ]; then
-		echo "Deleting old extracted firmware..."
-		rm -rf /lib/firmware/b43/*
-	fi
-fi
-
-#DEBHELPER#
-
-exit 0 
diff --git a/debian/firmware-b43-installer.prerm b/debian/firmware-b43-installer.prerm
new file mode 100644
index 0000000..535ffd2
--- /dev/null
+++ b/debian/firmware-b43-installer.prerm
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#########################################################################
+#$Id$	#
+#########################################################################
+
+FIRMWARE_INSTALL_DIR="/lib/firmware"
+
+#########################################################################
+# stable sections below, not updated for firmware updates		#
+#########################################################################
+
+
+set -e
+
+if [ "$1" = purge ] || [ "$1" = remove ]; then
+	if [ -s "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" ]; then
+		echo "$0: Deleting installed firmware..." 1>&2
+		xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm --
+		rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43.catalog"
+		rmdir "${FIRMWARE_INSTALL_DIR}/b43" || exit 0
+	fi
+fi
+
+#DEBHELPER#
+
+exit 0
+
-- 
1.7.10.4


--- End Message ---
--- Begin Message ---
Source: b43-fwcutter
Source-Version: 1:019-4

We believe that the bug you reported is fixed in the latest version of
b43-fwcutter, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 819...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andreas Beckmann <a...@debian.org> (supplier of updated b43-fwcutter package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 07 Feb 2019 02:00:18 +0100
Source: b43-fwcutter
Architecture: source
Version: 1:019-4
Distribution: unstable
Urgency: medium
Maintainer: Debian QA Group <packa...@qa.debian.org>
Changed-By: Andreas Beckmann <a...@debian.org>
Closes: 756664 819129 819705
Changes:
 b43-fwcutter (1:019-4) unstable; urgency=medium
 .
   [ Andreas Beckmann ]
   * QA upload.
   * Set Maintainer to Debian QA Group.  (See: #751205)
   * Migrate GIT repository to salsa.debian.org.
   * Update Lintian overrides.
   * Use dpkg makefile snippets instead of manual changelog parsing.
   * Switch to debhelper-compat (= 12).
   * Bump Standards-Version 4.3.0 (no changes).
   * Port Elliott's changes to the legacy package.
 .
   [ Elliott Mitchell ]
   * Refactoring of firmware download/installation.
   * Implement catalog of firmware files installed.  (Closes: #819705)
   * Only unpack the required files.  (Closes: #819129)
   * Add checking of SHA512 checksum of downloaded tarball.  (Closes: #756664)
Checksums-Sha1:
 8307e8d707d14876ab254efefe7f345f3187a3b8 2117 b43-fwcutter_019-4.dsc
 672c94c10612e874655f7e61e551ff1ffcaf42d3 18284 b43-fwcutter_019-4.debian.tar.xz
 b83b66a5fc06c02664d78c975c546049965de5e6 5087 
b43-fwcutter_019-4_source.buildinfo
Checksums-Sha256:
 eade50e5ef3d49cadaf2b40ef1b762297e28802e88e56d167409eedbbbb72509 2117 
b43-fwcutter_019-4.dsc
 d7457383fe8b5c98a80feddf2b5deb681fc04b7787b77667f425c0bf1197c44d 18284 
b43-fwcutter_019-4.debian.tar.xz
 ca8f825dcf8c7c071e92c1462429b00812978e269a08e5a322e8624e9519f186 5087 
b43-fwcutter_019-4_source.buildinfo
Files:
 bd9b0b47c469cbc95ed630660093b8f8 2117 contrib/utils optional 
b43-fwcutter_019-4.dsc
 6e2311042c354e5a07ca13bccb3ba72b 18284 contrib/utils optional 
b43-fwcutter_019-4.debian.tar.xz
 7535ff729ac416ec0f39514b4f3b4c28 5087 contrib/utils optional 
b43-fwcutter_019-4_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCAAuFiEE6/MKMKjZxjvaRMaUX7M/k1np7QgFAlxbhGgQHGFuYmVAZGVi
aWFuLm9yZwAKCRBfsz+TWentCDlhD/4o7485EaExqgCtwTLSb+n9lUKR1FHkvuom
C+z80XmJtRNgRw+ebOvhVDtXuBEcTkvW3ubaZe6HTq2cv0WB7bE4Ng3fS26BsTta
PA6CWryFEfdIezzLUU+4VtBvW9s2V/iOcfWUfn7qVWAyH4T5zlX505XLE3WASAM0
hqnuW24Jc/1yEIGiaI4XPfyP1krrdLbsyuwkm8rKqTpePEcu+i0TpedN152QLDKC
g6hvn3QkGkVxJXWcxMVtevbuNnu1OctCRnLW7rhg8zBihKzmMAFU7K6cNsBI8Wzj
HKS+k5ND9+8WtR00X2nfx/cojd2El2b4TzvWIgK1L5jMlaB4cuQE9vmp848gFkOt
0r5Od9Rw4XX2MhuM1I/s1c6m9FckP7+IRvyqTDhq3M+Ejp2O34lt3oP1PTtYjXvd
0SEYNyU3QjUaU9/zuujkZaMP5lcISnaelTVV8tlbM4zMCZHhWaTC5I2TeyD/QxuJ
ng9j4iCVfd8rVxcg32Avox0zvUN2sqPZ4DrPWMkIUh4c+QpgXZRjjafe6K/Wc312
eEhRLx4zqusjW9Kk+men86HofX51jIRDC0WFavc/QmosFX1ACQA2XvmXaVweD454
ZW33lai/7BsDpeEaJgmrTMdwg3skFS+JcQwJj5DZRPSmoKKD5lti9CxhPQxX2udo
rn+zGoaxEw==
=MLZL
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to