[apparmor] [PATCH v2 3/8] utils: Require apparmor.aa users to call init_aa()

Christian Boltz apparmor at cboltz.de
Thu Mar 2 19:32:33 UTC 2017


Hello,

Am Mittwoch, 1. März 2017, 21:52:01 CET schrieb Tyler Hicks:
> Introduce an apparmor.aa.init_aa() method and move the initialization
> code of the apparmor.aa module into it. Note that this change will
> break any external users of apparmor.aa because global variables that
> were previously initialized when importing apparmor.aa will not be
> initialized unless a call to the new apparmor.aa.init_aa() method is
> made.


> diff --git a/utils/aa-mergeprof b/utils/aa-mergeprof
> index 4e1e633..1241515 100755
> --- a/utils/aa-mergeprof
> +++ b/utils/aa-mergeprof
> @@ -43,6 +43,8 @@ args = parser.parse_args()
> 
>  args.other = None
> 
> +apparmor.aa.init_aa()
> +
>  profiles = args.files
> 
>  profiledir = args.dir
> @@ -136,6 +138,7 @@ class Merge(object):
>          user, base = profiles
> 
>          #Read and parse base profile and save profile data, include
> data from it and reset them 
> +        apparmor.aa.init_aa()
>          apparmor.aa.read_profile(base, True)
>          self.base = cleanprofile.Prof(base)

Just curious - what's the reason for calling init_aa() a second time?
I didn't test, but I'd guess that doing it in the global code should be 
enough.


> --- a/utils/test/Makefile
> +++ b/utils/test/Makefile

>  check: __libapparmor
> -	export PYTHONPATH=$(PYTHONPATH) ; export
> LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) ; export LC_ALL=C; $(foreach test,
> $(wildcard test-*.py), echo ; echo === $(test) === ; $(call pyalldo,
> $(test))) 
> +	export PYTHONPATH=$(PYTHONPATH)
> LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) LC_ALL=C __AA_CONFDIR=$(CONFDIR) ;
> $(foreach test, $(wildcard test-*.py), echo ; echo === $(test) === ;
> $(call pyalldo, $(test)))

I remember discussions about line lenghts in python. Did we already have 
such a discussion about Makefiles? ;-)
(I know changing this in this patch would break the following patches, 
so if you want shorter lines, feel free to send a follow-up patch.)

Both questions shouldn't stop you from commiting, so
Acked-by: Christian Boltz <apparmor at cboltz.de>


Regards,

Christian Boltz
-- 
Weitere üble Beschimpfungen bitte selber einfügen, mehr fällt mir im
Moment nicht ein.  [Bernd Brodesser zu Henne Vogelsang in suse-talk]
-------------- 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/20170302/b4c2feb1/attachment.pgp>


More information about the AppArmor mailing list