Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix QubesOS/qubes-issues#8622 #2

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions 0001-qubes-make-fwupdmgr-get-updates-think-it-s-interacti.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ being listed.

"Fix" this by using new pty for stdout capture, instead of a pipe.
---
contrib/qubes/src/qubes_fwupdmgr.py | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
contrib/qubes/src/qubes_fwupdmgr.py | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/contrib/qubes/src/qubes_fwupdmgr.py b/contrib/qubes/src/qubes_fwupdmgr.py
index 031caf251..ee73af2f4 100755
index a772b940a..887241f22 100755
--- a/contrib/qubes/src/qubes_fwupdmgr.py
+++ b/contrib/qubes/src/qubes_fwupdmgr.py
@@ -7,8 +7,10 @@
Expand All @@ -29,18 +29,12 @@ index 031caf251..ee73af2f4 100755
import re
import shutil
import subprocess
@@ -366,11 +368,28 @@ class QubesFwupdmgr(FwupdHeads, FwupdUpdate, FwupdReceiveUpdates):
):
raise ValueError(f"{version} < {self.dmi_version} Downgrade not allowed")

- def _get_dom0_devices(self):
- """Gathers information about devices connected in dom0."""
- cmd_get_dom0_devices = [FWUPDMGR, "--json", "get-devices"]
- p = subprocess.Popen(cmd_get_dom0_devices, stdout=subprocess.PIPE)
- self.dom0_devices_info = p.communicate()[0].decode()
+ def _get_dom0_updates(self):
+ """Gathers information about available updates."""
+ cmd_get_dom0_updates = [FWUPDMGR, "--json", "get-updates"]
@@ -182,8 +184,25 @@ class QubesFwupdmgr(FwupdHeads, FwupdUpdate, FwupdReceiveUpdates):
def _get_dom0_updates(self):
"""Gathers information about available updates."""
cmd_get_dom0_updates = [FWUPDMGR, "--json", "get-updates"]
- p = subprocess.Popen(cmd_get_dom0_updates, stdout=subprocess.PIPE)
- self.dom0_updates_info = p.communicate()[0].decode()
+ # connect stdout to a pty, otherwise get-updates works in
+ # non-interactive mode and doesn't list all the updates
+ # (based on FWUUPD_FEATURE_* flags)
Expand All @@ -60,8 +54,8 @@ index 031caf251..ee73af2f4 100755
+ data += new_data
+ self.dom0_updates_info = data.decode()
+ p.wait()
if p.returncode != 0:
raise Exception("fwupd-qubes: Getting devices info failed")
if p.returncode != 0 and p.returncode != 2:
raise Exception("fwupd-qubes: Getting available updates failed")

--
2.39.2
Expand Down