File Fix-showing-the-local-inactive-profile-in-json-mode.patch of Package apparmor.21599

From da07cdf79c5643878712e5a6e0fb6d7aadf71c61 Mon Sep 17 00:00:00 2001
From: Christian Boltz <apparmor@cboltz.de>
Date: Wed, 6 May 2020 23:20:07 +0200
Subject: [PATCH] Fix showing the local inactive profile in json mode

When aa-genprof proposes a local inactive profile, it had a hardcoded
call to 'less' to display that profile.

Unsurprisingly, this doesn't work in JSON mode and breaks YaST (luckily
it's only a case of "the button doesn't work").

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1171315
(cherry picked from commit 68a258b0064d98c376631fa27904a5be1a2e0044)
(cherry picked from commit cb95e9a2568b19e2e7601c0af363e0605a6889d9)

diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py
index 3b5ad68f..92be3592 100644
--- a/utils/apparmor/aa.py
+++ b/utils/apparmor/aa.py
@@ -559,8 +559,7 @@ def get_profile(prof_name):
         p = profile_hash[options[arg]]
         q.selected = options.index(options[arg])
         if ans == 'CMD_VIEW_PROFILE':
-            pager = get_pager()
-            subprocess.call([pager, orig_filename])
+            aaui.UI_ShowFile(uname, orig_filename)
         elif ans == 'CMD_USE_PROFILE':
             if p['profile_type'] == 'INACTIVE_LOCAL':
                 profile_data = p['profile_data']
openSUSE Build Service is sponsored by