[apparmor] Fwd: Re: [patch] Fix save_profiles() for YaST
Christian Boltz
apparmor at cboltz.de
Thu Oct 12 11:25:55 UTC 2017
Hello,
I assume the Ack was meant to sent in public ;-) therefore I'm
forwarding it to have it in the archives.
---------- Weitergeleitete Nachricht ----------
Betreff: Re: [apparmor] [patch] Fix save_profiles() for YaST
Datum: Donnerstag, 12. Oktober 2017, 01:05:11 CEST
Von: Seth Arnold <seth.arnold at canonical.com>
An: Christian Boltz <apparmor at cboltz.de>
On Wed, Oct 11, 2017 at 10:16:46PM +0200, Christian Boltz wrote:
> 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.
Acked for both.
Acked-by: Seth Arnold <seth.arnold at canonical.com>
Thanks
>
>
> [ 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
--
Also, monolithisch im Sinne von "das macht einfach alles und streichelt
auch noch die Katze", nicht im Sinne von einem großen Code Blob.
[Andreas Scherbaum über systemd auf
https://plus.google.com/117024231055768477646/posts/7tJUsZidkr6]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20171012/dc6ab17b/attachment.sig>
More information about the AppArmor
mailing list