On 06/04/2023 at 20:56, Cyril Brulebois wrote:
Pascal Hambourg <pas...@plouf.fr.eu.org> (2023-04-06):
A difference between the two relevant sections in check-missing-firmware is
that install_firmware_pkg() is executed in a pipeline when a
Contents-firmware file is present, and not when it is not present. I do not
know enough about debconf to figure out how the pipeline may interfere with
it. Maybe something to do with standard input and output ?

Very useful information, thanks.

And yes, something related to pipes and possibly some missing passthrough
setting was my wild guess (as rubberducked on IRC), so that seems plausible.

Ugly attached patch works for me as PoC.
Copy fd 0 into fd 9 (because it looked unused) before entering the pipeline, and restore it when running install_firmware_pkg.
diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 5db0e180..efdecf6f 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -324,6 +324,7 @@ check_for_firmware() {
 		# packages, saving us from iterating over each firmware *.deb:
 		if [ -f $dir/Contents-firmware ]; then
 			log "lookup with $dir/Contents-firmware"
+			{
 			grep -f /tmp/grepfor $dir/Contents-firmware | while read fw_file fw_pkg_file component; do
 				# Don't install a package for each file it ships!
 				if grep -qs "^$fw_pkg_file$" /tmp/pkginstalled 2>/dev/null; then
@@ -331,10 +332,11 @@ check_for_firmware() {
 				fi
 				if check_deb_arch "$dir/$fw_pkg_file"; then
 					log "installing firmware package $dir/$fw_pkg_file ($component)"
-					install_firmware_pkg "$dir/$fw_pkg_file" "$component" || true
+					install_firmware_pkg "$dir/$fw_pkg_file" "$component" <&9 || true
 					echo "$fw_pkg_file" >> /tmp/pkginstalled
 				fi
 			done
+			} 9<&0
 			continue
 		fi
 

Reply via email to