[apparmor] [utils] proposed redesign for mergeprof

Kshitij Gupta kgupta8592 at gmail.com
Thu Oct 16 10:21:45 UTC 2014


Hello,

Sorry, I was away for a bit and missed the meeting. :( I've read up
the logs from the meeting. I hope we can and will try to get
aa-mergeprof ready for 2.9 release.

On Thu, Oct 16, 2014 at 2:42 AM, Christian Boltz <apparmor at cboltz.de> wrote:
> Hello,
>
> Am Mittwoch, 15. Oktober 2014 schrieb Christian Boltz:
>> Remaining known issues I noticed while testing:
>> - aa-mergeprof always asks for includes, even if they are already
>> there
>
> The attached patch fixes this ;-)
>
>> - CMD_OTHER should work ;-)
>
> to avoid the list gets shorter:
> - aa-mergeprof always asks to save the profile, even if there were no
>   changes
>
Thanks for skimming through the v1 of patch and the fixes. :-)

Thus is bring the tool to the decided new decided syntax?

I had made some changes post the old patch to allow decided format,
the entire --oldupstream --newupstream flags with some additional
checks. Unfortunately I couldn't get it to a good shape (or find time
to test enough) to send the new revision.

I've attached a diff that applies those minor fixes on your changes.

If they seem alright you might want to apply this diff and then make
any further changes.

Note: Its a small diff with basically changes for the 3-way merge, you
may want to revise the description text for the tool

Regards,
Kshitij Gupta

>
> Regards,
>
> Christian Boltz
> --
> looks like you have some special code in yast for password "x", maybe I
> should use the even more secure new password "y" in the future  ?! ;-)
> [Harald Koenig in https://bugzilla.novell.com/show_bug.cgi?id=148464]
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-------------- next part --------------
17a18
> import sys
30,31c31,32
< parser.add_argument('files', nargs='+', type=str, help=_('base profile'))
< #parser.add_argument('other', nargs='?', type=str, help=_('other profile'))
---
> parser.add_argument('files', nargs='*', type=str, help=_('base profile'))
> 
33a35,38
> # 3-way merge arguments
> parser.add_argument('--oldupstream', nargs='?', help=_('old upstream profiles'))
> parser.add_argument('--newupstream', nargs='?', help=_('other profiles'))
> 
36c41,66
< args.other = None
---
> def get_dir_files(path):
>     files = list()
>     if not os.path.exists(path):
>         raise apparmor.AppArmorException(_("Path to profiles is not valid: %(dir)") % { 'dir': path })
> 
>     for item in os.listdir(path):
>         item_path = path + "/" + item
>         if os.path.isfile(item_path):
>             files.append(item_path)
> 
>     return files
> 
> newupstream_files = None
> oldupstream_files = None
> 
> if args.newupstream or args.oldupstream:
>     if args.files or not (args.newupstream and args.oldupstream):
>         parser.print_help()
>         sys.exit()
> 
>     newupstream_files = get_dir_files(args.newupstream)
>     oldupstream_files = get_dir_files(args.oldupstream)
> elif not args.files:
>     parser.print_help()
>     sys.exit()
> 
38c68
< merge_mode = 2 #if args.other == None else 3
---
> merge_mode = 2 if args.newupstream == None else 3
40c70,75
< profiles = [args.files, [args.other]]
---
> profiles = None
> 
> if merge_mode == 2:
>     profiles = [args.files, None]
> else:
>     profiles = [oldupstream_files, newupstream_files]
89c124
<         profiles_to_merge.add(other_profile_to_file.keys())
---
>         profiles_to_merge = profiles_to_merge.union(set(other_profile_to_file.keys()))
120c155
<     mergeprofiles = Merge(files)
---
>     mergeprofiles = Merge(files, merge_mode)
122c157
< #    mergeprofiles.clear_common()
---
>     mergeprofiles.clear_common()
153,154c188,189
<         q.title = _('Changed Local Profiles')
<         q.explanation = _('The following local profiles were changed. Would you like to save them?')
---
>         q.title = _('Changes for Local Profile: %s') % (merging_profile)
>         q.explanation = _('Would you like to save them?')
180c215
<     def __init__(self, profiles):
---
>     def __init__(self, profiles, merge_mode):
181a217
>         self.merge_mode = merge_mode
190c226
<         if merge_mode == 3:
---
>         if self.merge_mode == 3:
202c238
<         if merge_mode == 3:
---
>         if self.merge_mode == 3:
211c247
<         if merge_mode == 3:
---
>         if self.merge_mode == 3:
266c302
<  
---
> 
301c337
<                 
---
> 


More information about the AppArmor mailing list