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

Qubes Manager doesn’t catch all exceptions run_service() can raise #8151

Closed
DemiMarie opened this issue Apr 25, 2023 · 0 comments · Fixed by QubesOS/qubes-manager#343
Closed
Assignees
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: manager/widget diagnosed Technical diagnosis has been performed (see issue comments). P: minor Priority: minor. The lowest priority, below "default." pr submitted A pull request has been submitted for this issue.

Comments

@DemiMarie
Copy link

How to file a helpful issue

Qubes OS release

R4.1

Brief summary

Qubes Manager doesn’t catch all exceptions run_service() can raise

Steps to reproduce

Apply the following patch to Qubes Manager, then try to use it to update a qube:

diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py
index 62c68c59db56d71f5c8354bc12b3048236f1bdc1..ed72f148a8467721c12df3e261430af6bf263b5b 100644
--- a/qubesmanager/qube_manager.py
+++ b/qubesmanager/qube_manager.py
@@ -635,6 +635,7 @@ class UpdateVMThread(common_threads.QubesThread):
                     except exc.QubesDaemonAccessError:
                         # permission denied, let us hope for the best
                         pass
+                raise FileNotFoundError("test!")
                 self.vm.run_service("qubes.InstallUpdatesGUI",
                                     user="root", wait=False)
         except (ChildProcessError, subprocess.CalledProcessError,

Expected behavior

The exception should be caught, since self.vm.run_service() can raise FileNotFoundError if /usr/lib/qubes/qrexec-client is not found.

Actual behavior

The exception is not caught.

@DemiMarie DemiMarie added T: bug C: manager/widget P: minor Priority: minor. The lowest priority, below "default." diagnosed Technical diagnosis has been performed (see issue comments). labels Apr 25, 2023
@DemiMarie DemiMarie added this to the Release 4.1 updates milestone Apr 25, 2023
@DemiMarie DemiMarie self-assigned this Apr 25, 2023
@DemiMarie DemiMarie added the pr submitted A pull request has been submitted for this issue. label Apr 25, 2023
@marmarek marmarek added the backport pending On closed issues, indicates fix released for newer version will be backported to older version. label Jun 22, 2023
marmarek pushed a commit to QubesOS/qubes-manager that referenced this issue Jun 22, 2023
run_service() can raise FileNotFoundError, so catch OSError and all of
its subclasses.  Also catch the more general subprocess.SubprocessError
instead of just subprocess.CalledProcessError.

Fixes: QubesOS/qubes-issues#8151
(cherry picked from commit 98053bd)
@andrewdavidwong andrewdavidwong added the affects-4.1 This issue affects Qubes OS 4.1. label Aug 8, 2023
@marmarek marmarek removed the backport pending On closed issues, indicates fix released for newer version will be backported to older version. label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: manager/widget diagnosed Technical diagnosis has been performed (see issue comments). P: minor Priority: minor. The lowest priority, below "default." pr submitted A pull request has been submitted for this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants