From 09e903eb86e6ebfd73718e7abc6d8908b98ff837 Mon Sep 17 00:00:00 2001 From: Jayant-Kernel Date: Mon, 9 Mar 2026 23:58:59 +0530 Subject: [PATCH 1/2] qvm-appmenus: drop unstable-format pledge for get-available --get-available no longer requires --i-understand-format-is-unstable. The flag is kept as a deprecated no-op for backward compatibility and prints a warning to stderr when used. Fixes QubesOS/qubes-issues#10595 --- doc/tools/qvm-appmenus.rst | 6 +++--- qubesappmenus/__init__.py | 9 ++++----- qubesappmenus/tests.py | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/doc/tools/qvm-appmenus.rst b/doc/tools/qvm-appmenus.rst index 4191e12..7bbbfec 100644 --- a/doc/tools/qvm-appmenus.rst +++ b/doc/tools/qvm-appmenus.rst @@ -48,12 +48,12 @@ OPTIONS --set-default-whitelist PATH Set the default list of applications to be included in the menus of VMs based on this template. Should only be used for TemplateVMs .The PATH can be either a path to file containing a list of .desktop files, or a single hyphen ('-') to read from standard input. ---get-available [EXPERIMENTAL] [REQUIRES --i-understand-format-is-unstable] - List all available applications for the VM. The current format is UNSTABLE. +--get-available + List all available applications for the VM. The applications are listed as hyphen-separated pairs consisting of file name and application name. --file-field FIELDNAME - .desktop file field to append to output for --get-available; can be used multiple times for multiple fields. This option changes output format to pipe-("|") separated. The current format is UNSTABLE. + .desktop file field to append to output for --get-available; can be used multiple times for multiple fields. This option changes output format to pipe-("|") separated. AUTHORS ======= diff --git a/qubesappmenus/__init__.py b/qubesappmenus/__init__.py index 19d6d5f..15427a6 100644 --- a/qubesappmenus/__init__.py +++ b/qubesappmenus/__init__.py @@ -761,7 +761,7 @@ def appmenus_update(self, vm, force=False): parser.add_argument( '--i-understand-format-is-unstable', dest='fool', action='store_true', - help='required pledge for --get-available') + help='deprecated no-op for backward compatibility') parser.add_argument( '--file-field', action='append', dest='fields', help='File field to append to output for --get-available; can be used' @@ -795,6 +795,9 @@ def retrieve_list(path): def main(args=None, app=None): """main function for qvm-appmenus tool""" args = parser.parse_args(args=args, app=app) + if args.fool: + print('Warning: --i-understand-format-is-unstable is deprecated ' + 'and has no effect.', file=sys.stderr) if not args.all_domains and not args.domains: parser.error("one of the arguments --all VMNAME is required") appmenus = Appmenus() @@ -852,10 +855,6 @@ def main(args=None, app=None): if args.update: appmenus.appmenus_update(vm, force=args.force) if args.get_available: - if not args.fool: - parser.error( - 'this requires --i-understand-format-is-unstable ' - 'and a sacrifice of one cute kitten') if not args.fields: sys.stdout.write(''.join('{} - {}\n'.format(*available) for available in diff --git a/qubesappmenus/tests.py b/qubesappmenus/tests.py index 4962455..6a0bee5 100644 --- a/qubesappmenus/tests.py +++ b/qubesappmenus/tests.py @@ -726,6 +726,22 @@ def test_131_set_get_default_whitelist(self, mock_subprocess): self.ext.set_default_whitelist(tpl, whitelist) self.assertEqual(whitelist, self.ext.get_default_whitelist(tpl)) + @unittest.mock.patch('qubesappmenus.Appmenus') + def test_132_get_available_does_not_require_unstable_flag( + self, appmenus_cls): + vm = TestVM('test-inst-vm', klass='AppVM', + label=self.app.labels[1]) + self.app.domains[vm.name] = vm + appmenus_cls.return_value.get_available.return_value = [ + ('xterm.desktop', 'XTerm')] + + with unittest.mock.patch('sys.stdout', new_callable=io.StringIO) \ + as stdout: + qubesappmenus.main(['--get-available', vm.name], app=self.app) + + appmenus_cls.return_value.get_available.assert_called_once_with(vm) + self.assertEqual(stdout.getvalue(), 'xterm.desktop - XTerm\n') + def list_tests(): return (TC_00_Appmenus,) From e4cb94a6932fb4da76bb6955b6f7fa6f1cf12fd7 Mon Sep 17 00:00:00 2001 From: Jayant-Kernel Date: Thu, 12 Mar 2026 10:34:42 +0530 Subject: [PATCH 2/2] tests: allow get-available CLI test to run as root --- qubesappmenus/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qubesappmenus/tests.py b/qubesappmenus/tests.py index 6a0bee5..0430dd0 100644 --- a/qubesappmenus/tests.py +++ b/qubesappmenus/tests.py @@ -737,7 +737,8 @@ def test_132_get_available_does_not_require_unstable_flag( with unittest.mock.patch('sys.stdout', new_callable=io.StringIO) \ as stdout: - qubesappmenus.main(['--get-available', vm.name], app=self.app) + qubesappmenus.main( + ['--force-root', '--get-available', vm.name], app=self.app) appmenus_cls.return_value.get_available.assert_called_once_with(vm) self.assertEqual(stdout.getvalue(), 'xterm.desktop - XTerm\n')