[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1033035: marked as done (hw-detect: trivial patches)



Your message dated Wed, 22 Mar 2023 19:49:21 +0000
with message-id <E1pf4SX-005HMz-Nz@fasolo.debian.org>
and subject line Bug#1033035: fixed in hw-detect 1.155
has caused the Debian Bug report #1033035,
regarding hw-detect: trivial patches
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 owner@bugs.debian.org
immediately.)


-- 
1033035: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033035
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: src:hw-detect
Version: 1.155
Tags: patch

Dear maintainer,
Please consider merging the attached patches.

- hw-detect.pre-pkgsel.d/50install-firmware: fix path of deleted file

- check-missing-firmware.sh: shift positional parameters after reading
   -n

- check-missing-firmware.sh: define local variables in functions

- check-missing-firmware.sh: get package name from control instead of
   file name

- check-missing-firmware.sh: replace spaces with tabs in indentation
From e9a8ceeaa83fbf43e33cdd3745bbbf5d64c3291c Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Mon, 13 Mar 2023 14:57:52 +0100
Subject: [PATCH 1/5] hw-detect.pre-pkgsel.d/50install-firmware: fix path of
 deleted file

---
 hw-detect.pre-pkgsel.d/50install-firmware | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw-detect.pre-pkgsel.d/50install-firmware b/hw-detect.pre-pkgsel.d/50install-firmware
index 61d23b41..15c145e8 100644
--- a/hw-detect.pre-pkgsel.d/50install-firmware
+++ b/hw-detect.pre-pkgsel.d/50install-firmware
@@ -18,7 +18,7 @@ if [ -d /var/cache/firmware ]; then
 			else
 				n=$((n+1))
 			fi
-			rm -f "/target/tmp/$deb"
+			rm -f "/target/tmp/$(basename "$deb")"
 		fi
 	done
 	if [ $n -gt 0 ]; then
-- 
2.30.2

From 69a30ad764bb3760feae7cf5a7f19dcc34ac886a Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Wed, 8 Mar 2023 19:38:04 +0100
Subject: [PATCH 2/5] check-missing-firmware.sh: shift positional parameters
 after reading -n

---
 check-missing-firmware.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index cfb85fb1..44054818 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -6,6 +6,7 @@ DENIED=/tmp/missing-firmware-denied
 
 if [ "x$1" = "x-n" ]; then
 	NONINTERACTIVE=1
+	shift
 else
 	NONINTERACTIVE=""
 fi
-- 
2.30.2

From ce221a36cbdae932453fbcc6b037fe4d634e1dce Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Wed, 8 Mar 2023 19:35:49 +0100
Subject: [PATCH 3/5] check-missing-firmware.sh: define local variables in
 functions

---
 check-missing-firmware.sh | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 44054818..0557f7d1 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -23,8 +23,9 @@ log_output() {
 
 # USB is special, and we don't want to take it all done:
 get_usb_module() {
-	address="$1"
-	device="/sys/bus/usb/devices/$address"
+	local address="$1"
+	local device="/sys/bus/usb/devices/$address"
+	local subdirs driver
 
 	# Make sure there's a single subdirectory (e.g. 4-1.5:1.0 below 4-1.5):
 	subdirs=$(find -L "$device" -maxdepth 1 -type d -name "$address:*")
@@ -52,7 +53,7 @@ get_usb_module() {
 # The mhi module's holders directory lists ath11k_pci and qrtr_mhi
 # though!
 get_mhi_holders() {
-	holders=$(find -L /sys/module/mhi/holders/ -mindepth 1 -maxdepth 1 -exec basename {} ';')
+	local holders=$(find -L /sys/module/mhi/holders/ -mindepth 1 -maxdepth 1 -exec basename {} ';')
 	if [ "$holders" = "" ]; then
 		log "failed to perform mhi lookup (no holders found)"
 		log "=> sticking with the mhi module"
@@ -66,6 +67,8 @@ get_mhi_holders() {
 # then down any interfaces specified by ethdetect. Don't touch interfaces
 # that users might have configured (manually or via preseeding) though!
 upnics() {
+	local iface sys_iface
+
 	for iface in $IFACES; do
 		# Don't rely on ip's output, it lacks at least state UP/DOWN:
 		sys_iface="/sys/class/net/$iface"
@@ -88,7 +91,8 @@ upnics() {
 # is up and has an IP address. Such modules should not be reloaded,
 # to avoid taking down the network after it's been configured.
 nic_is_configured() {
-	module="$1"
+	local module="$1"
+	local iface dir
 
 	for iface in $(ip -o link show up | cut -d : -f 2); do
 		dir="/sys/class/net/$iface/device/driver"
@@ -103,8 +107,9 @@ nic_is_configured() {
 }
 
 get_fresh_dmesg() {
-	dmesg_file=/tmp/dmesg.txt
-	dmesg_ts=/tmp/dmesg-ts.txt
+	local dmesg_file=/tmp/dmesg.txt
+	local dmesg_ts=/tmp/dmesg-ts.txt
+	local tspattern ln
 
 	# Get current dmesg:
 	dmesg > $dmesg_file
@@ -143,6 +148,8 @@ get_fresh_dmesg() {
 }
 
 check_missing () {
+	local fwlist module address fwfile
+
 	upnics
 
 	# Give modules some time to request firmware.
@@ -264,14 +271,14 @@ list_deb_firmware () {
 }
 
 check_deb_arch () {
-	arch=$(udpkg -f "$1" | grep '^Architecture:' | sed -e 's/Architecture: *//')
+	local arch=$(udpkg -f "$1" | grep '^Architecture:' | sed -e 's/Architecture: *//')
 	[ "$arch" = all ] || [ "$arch" = "$(udpkg --print-architecture)" ]
 }
 
 get_deb_component () {
 	# This trusts the contents of the .deb, but packages in the archive could
 	# have overrides (controlled by ftpmaster):
-	section=$(udpkg -f "$1" | grep '^Section:' | sed -e 's/Section: *//')
+	local section=$(udpkg -f "$1" | grep '^Section:' | sed -e 's/Section: *//')
 	if ! echo "$section" | grep -qs '/'; then
 		echo "main"
 	else
@@ -281,7 +288,9 @@ get_deb_component () {
 
 # Remove non-accepted firmware package
 remove_pkg() {
-	pkgname="$1"
+	local pkgname="$1"
+	local file
+
 	# Remove all files listed in /var/lib/dpkg/info/$pkgname.md5sums
 	for file in $(cut -d" " -f 2- /var/lib/dpkg/info/$pkgname.md5sums) ; do
 		rm /$file
@@ -289,11 +298,13 @@ remove_pkg() {
 }
 
 install_firmware_pkg () {
+	local filename="$(basename "$1")"
+	local pkgname="$(echo $filename |cut -d_ -f1)"
+	local removed
+
 	# cache deb for installation into /target later
 	mkdir -p /var/cache/firmware/
 	cp -aL "$1" /var/cache/firmware/ || true
-	filename="$(basename "$1")"
-	pkgname="$(echo $filename |cut -d_ -f1)"
 	udpkg --unpack "/var/cache/firmware/$filename"
 	if [ -f /var/lib/dpkg/info/$pkgname.preinst ] ; then
 		# Run preinst script to see if the firmware
@@ -317,6 +328,8 @@ install_firmware_pkg () {
 # This does not use anna because debs can have arbitrary
 # dependencies, which anna might try to install.
 check_for_firmware() {
+	local dir fw_file fw_pkg_file component filename
+
 	echo "$files" | sed -e 's/ /\n/g' >/tmp/grepfor
 	for dir in $@; do
 		# An index file might exist, mapping firmware files to firmware
-- 
2.30.2

From b57ec77e63d09f5c715b60f233de3a8d01b4f430 Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Mon, 13 Mar 2023 15:16:14 +0100
Subject: [PATCH 4/5] check-missing-firmware.sh: get package name from control
 instead of file name

The package file name may not follow the standard naming scheme if custom built
or provided by third party. It is more reliable to use the Package: control
field instead, like in hw-detect.pre-pkgsel.d/50install-firmware.
---
 check-missing-firmware.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 0557f7d1..6d088faf 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -299,7 +299,7 @@ remove_pkg() {
 
 install_firmware_pkg () {
 	local filename="$(basename "$1")"
-	local pkgname="$(echo $filename |cut -d_ -f1)"
+	local pkgname="$(udpkg -f "$1" | grep '^Package:' | sed -e 's/^Package: *//')"
 	local removed
 
 	# cache deb for installation into /target later
-- 
2.30.2

From 47c682c072b271fd401f5cb9d0e215ca3e1eae28 Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Thu, 16 Mar 2023 00:26:21 +0100
Subject: [PATCH 5/5] check-missing-firmware.sh: replace spaces with tabs in
 indentation

---
 check-missing-firmware.sh | 54 +++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 6d088faf..fe02775d 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -163,34 +163,34 @@ check_missing () {
 	fwlist=/tmp/check-missing-firmware-dmesg.list
 	get_fresh_dmesg | sed -rn 's/^(\[[^]]*\] )?([^ ]+) ([^ ]+): firmware: failed to load ([^ ]+) .*/\2 \3 \4/p' > $fwlist
 	while read module address fwfile ; do
-	    # rewrite module is necessary
-	    case "$module" in
-		usb)
-		    module=$(get_usb_module "$address")
-		    log "using module $module instead of usb $address"
-		;;
-		mhi)
-		    module=$(get_mhi_holders)
-		    log "using $module instead of mhi"
-		;;
-	    esac
-
-	    # ignore specific files:
-	    #  - iwlwifi, debug-only (#969264, #966218)
-	    if [ "$fwfile" = "iwl-debug-yoyo.bin" ]; then
-		log "ignoring firmware file $fwfile requested by $module"
-		continue
-	    fi
-
-	    log "looking for firmware file $fwfile requested by $module"
-	    if [ ! -e /lib/firmware/$fwfile ] ; then
-		if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
-		    log "listed in $DENIED"
-		    continue
+		# rewrite module is necessary
+		case "$module" in
+			usb)
+				module=$(get_usb_module "$address")
+				log "using module $module instead of usb $address"
+			;;
+			mhi)
+				module=$(get_mhi_holders)
+				log "using $module instead of mhi"
+			;;
+		esac
+
+		# ignore specific files:
+		#  - iwlwifi, debug-only (#969264, #966218)
+		if [ "$fwfile" = "iwl-debug-yoyo.bin" ]; then
+			log "ignoring firmware file $fwfile requested by $module"
+			continue
+		fi
+
+		log "looking for firmware file $fwfile requested by $module"
+		if [ ! -e /lib/firmware/$fwfile ] ; then
+			if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
+				log "listed in $DENIED"
+				continue
+			fi
+			files="${files:+$files }$fwfile"
+			modules="$module${modules:+ $modules}"
 		fi
-		files="${files:+$files }$fwfile"
-		modules="$module${modules:+ $modules}"
-	    fi
 	done < $fwlist
 
 	if [ -n "$modules" ]; then
-- 
2.30.2


--- End Message ---
--- Begin Message ---
Source: hw-detect
Source-Version: 1.155
Done: Cyril Brulebois <kibi@debian.org>

We believe that the bug you reported is fixed in the latest version of
hw-detect, 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 1033035@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Cyril Brulebois <kibi@debian.org> (supplier of updated hw-detect 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 ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 22 Mar 2023 20:31:11 +0100
Source: hw-detect
Architecture: source
Version: 1.155
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Cyril Brulebois <kibi@debian.org>
Closes: 1029804 1029849 1031631 1033035
Changes:
 hw-detect (1.155) unstable; urgency=medium
 .
   [ Cyril Brulebois ]
   * Deduplicate the list of requested firmware files, not just the list of
     requesting modules (Closes: #1031631).
   * Implement microcode support when /proc/cpuinfo contains a vendor_id
     field, with one of the following values (Closes: #1029804):
      - Install amd64-microcode on AuthenticAMD.
      - Install intel-microcode on GenuineIntel.
      - Enable non-free-firmware accordingly.
      - Perform installation via finish-install, making sure apt-setup has
        been configured, and using apt-install for dependency resolution.
   * Optimize firmware package installation: process dpkg triggers once,
     after all packages have been installed (i.e. install-firmware only
     triggers a single update-initramfs call).
   * Fix condition around moutmedia calls (See: #1032377).
   * Fix files removal for non-accepted firmware packages (See: #1032377).
   * Add a special case for the mhi module: when the module requesting
     firmware files is “mhi”, use the modules listed as holders (e.g.
     ath11k_pci and qrtr_mhi). This is less precise than the usb special
     case, since /sys/bus/mhi/devices/<device> gives no hints as to which
     network module would be involved (See: #1032140). Thanks to Nicolas
     Dandrimont and Benoît Chauvet for the tests.
   * Adjust dmesg timestamp management: only update the timestamp file if
     there are new lines.
   * Fix package name extraction when removing a firmware package (e.g.
     it failed to install because it was corrupted). Regression in 1.153,
     spotted in #1032970.
   * Build /var/log/firmware-summary as a 3-column summary of firmware (and
     microcode) packages getting installed (Closes: #1029849). Those three
     columns are: package, component, and reason. The reason might be dmesg
     (check-missing-firmware), modalias (install-firmware hook), or cpu
     (install-firmware hook).
 .
   [ Pascal Hambourg ]
   * Fix several glitches (Closes: #1033035):
      - Fix removal of temporary files in /target after installing firmware
        packages (they're in /tmp so the next reboot has been doing the
        trick until now).
      - Determine the package name by using the Package field instead of
        trusting the filename when installing firmware packages.
      - Make sure not to include the possible -n option when setting the
        IFACES variables in check-missing-firmware.
Checksums-Sha1:
 eaa42a8ae1ad674a6d18dd2992fa20b70ecfd296 1990 hw-detect_1.155.dsc
 9918ed7197c5f80945fe5d3cb2ef91e0b4a0298d 195232 hw-detect_1.155.tar.xz
 6e415c8183d2fb5574bf360a5815641cccfaf888 6524 hw-detect_1.155_source.buildinfo
Checksums-Sha256:
 9e55c9507048484b85870d7c89640d91cbd3c3930282ac8f51c5bd5f0eecbe50 1990 hw-detect_1.155.dsc
 b13bb32c6a162a77549dc59584418b191e6cd406e5222357b41bd71651d59b71 195232 hw-detect_1.155.tar.xz
 31a63bad2f86257964f5d545cc361fdb3dfdab1a834c1763b09a91f5f77c6b4e 6524 hw-detect_1.155_source.buildinfo
Files:
 3e9910d3b03016b60ee45f046b8e838c 1990 debian-installer standard hw-detect_1.155.dsc
 4d4062ce48d90a4802b6f8f732bfcc1e 195232 debian-installer standard hw-detect_1.155.tar.xz
 6e5293b429f561996d21cd2f9e58dd61 6524 debian-installer standard hw-detect_1.155_source.buildinfo

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

iQJEBAEBCgAuFiEEtg6/KYRFPHDXTPR4/5FK8MKzVSAFAmQbV6wQHGtpYmlAZGVi
aWFuLm9yZwAKCRD/kUrwwrNVIEBYEACRtLD90dTz8KXqRQikYF4EHd6sgNRVdbSy
iB9PyVAaGvp+VAOK4Vni0Wvf1liihqoOeRw22hYITqBMulX7OgzJWUOcRpUn+HSA
BeuBPbM1nLmS7pcDH0AKkrIwEp3PMj+yYQzhoOa1nVYH3bRdfxWYoz4XDLkXObK+
U9CLCXgQI4dDNf4GnZdt+kmJGccFnNTHcAmgDbfsOhd01AkN64uY/zOy1kSHKJCx
1lK1Wg94m83iPOU8eNKqoXXsJEp1h4m7MV7GFfB7hTBA9GsPbiMsFnmCS1YOAeCI
R9AfH239TudJmCRXGYaW4oI33h9G7AEOz17AI/IQj2MnYrrjzdSNImsQcuJ8V331
3gBUvH4bn+5Q0npj8KKDuxalot6dswOTUa6SOfZ1fryTXIEIITx20SyrjSC/Q9j1
U24Jf/fUpvWIV2cmK6vrXdl2luGBlvzk0TugG6WH7cLTFLkiW/BrBMlt0Np+mJi0
8RwUTT+GrVcmpSdtbsMTXASTrJuTm3Hy1VYSUlnpo7C+5wGhjViXDgShbdl6dSjJ
ohiAS+h3u8wWOJef7yoI7bzaH36CgSu+Qp/HkHSHGPdRtY1zazXnspRAlYlxFWH6
zTdrY7iwx3Aiw3q4jBQ8tHug0dM6VwwB1/ffi566pNAdaqjU7m+qkFyVtRtiuOoN
iRKOpMdzKA==
=5f86
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: