Hello,

YaST has two issues in the "save changed profiles" dialog:
- when using "save selected", the list of profiles doesn't get updated.
  Update q.options inside the loop to fix this.
- the list of profiles is displayed as "["/usr/bin/foo", true]" instead
  of just "/usr/bin/foo". Use changed.keys() instead of changed to fix
  this. (text-mode aa-logprof doesn't change, it always displayed
  "/usr/bin/foo" and continues to do so.)

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1062667 part a)

I propose this patch for trunk and 2.11.

Note that 2.11 needs a slightly different patch (whitespace diff).
I have attached both variants.



[ 04-refresh-profile-list-on-save-selected.diff (for trunk) ]

--- utils/apparmor/aa.py       2017-10-11 21:19:17.237759879 +0200
+++ utils/apparmor/aa.py       2017-10-11 21:20:00.789641479 +0200
@@ -1820,13 +1820,15 @@ def save_profiles():
         q.explanation = _('The following local profiles were changed. Would 
you like to save them?')
         q.functions = ['CMD_SAVE_CHANGES', 'CMD_SAVE_SELECTED', 
'CMD_VIEW_CHANGES', 'CMD_VIEW_CHANGES_CLEAN', 'CMD_ABORT']
         q.default = 'CMD_VIEW_CHANGES'
-        q.options = changed
         q.selected = 0
         ans = ''
         arg = None
         while ans != 'CMD_SAVE_CHANGES':
             if not changed:
                 return
+
+            q.options = sorted(changed.keys())
+
             ans, arg = q.promptUser()
             if ans == 'CMD_SAVE_SELECTED':
                 profile_name = list(changed.keys())[arg]


[ 04-refresh-profile-list-on-save-selected.diff-2.11 (for 2.11 branch) ]

=== modified file 'utils/apparmor/aa.py'
--- utils/apparmor/aa.py        2017-08-04 20:27:16 +0000
+++ utils/apparmor/aa.py        2017-10-11 18:59:53 +0000
@@ -1959,13 +1959,15 @@
             q.explanation = _('The following local profiles were changed. 
Would you like to save them?')
             q.functions = ['CMD_SAVE_CHANGES', 'CMD_SAVE_SELECTED', 
'CMD_VIEW_CHANGES', 'CMD_VIEW_CHANGES_CLEAN', 'CMD_ABORT']
             q.default = 'CMD_VIEW_CHANGES'
-            q.options = changed
             q.selected = 0
             ans = ''
             arg = None
             while ans != 'CMD_SAVE_CHANGES':
                 if not changed:
                     return
+
+                q.options = sorted(changed.keys())
+
                 ans, arg = q.promptUser()
                 if ans == 'CMD_SAVE_SELECTED':
                     profile_name = list(changed.keys())[arg]



Regards,

Christian Boltz
-- 
> got a patch?
-ENOTMYJOB
[> Markus Rueckert and Bernhard Walle in opensuse-packaging]

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to