[apparmor] [patch] move regexes from aa.py to regex.py
Steve Beattie
steve at nxnw.org
Thu Nov 13 17:54:01 UTC 2014
On Thu, Nov 13, 2014 at 06:09:00PM +0100, Christian Boltz wrote:
> Hello,
>
> Am Mittwoch, 12. November 2014 schrieb Steve Beattie:
> > On Wed, Nov 12, 2014 at 02:42:58PM -0800, Steve Beattie wrote:
> > > Another alternative would be explicitly name all the regex
> > > symbols, rather than glob them in (which also makes pyflakes cry,
> > > I believe).
> >
> > Indeed, 'make check' is failing in the utils/ directory on trunk
> > because of this import:
> >
> > Checking apparmor
> > apparmor/aa.py:43: 'from apparmor.regex import *' used; unable to
> > detect undefined names Makefile:98: recipe for target 'check' failed
> > make: *** [check] Error 1
> >
> > So we should come up with a solution for this.
>
> As a first step, let's import them one by one to make pyflakes happy ;-)
> (all listed regexes are used - confirmed by pyflakes ;-)
> I have some ideas how to hide the regexes in the rule classes, but I
> doubt that it will be done in the first round of the rule class patch.
>
> [ apparmor/aa.py-import-regex-one-by-one.diff ]
>
> === modified file 'utils/apparmor/aa.py'
> --- utils/apparmor/aa.py 2014-11-11 23:05:04 +0000
> +++ utils/apparmor/aa.py 2014-11-13 16:58:34 +0000
> @@ -40,7 +41,15 @@
> mode_to_str_user, mode_contains, AA_OTHER,
> flatten_mode, owner_flatten_mode)
>
> -from apparmor.regex import *
> +from apparmor.regex import (RE_PROFILE_START, RE_PROFILE_END, RE_PROFILE_CAP, RE_PROFILE_LINK,
> + RE_PROFILE_CHANGE_PROFILE, RE_PROFILE_ALIAS, RE_PROFILE_RLIMIT,
> + RE_PROFILE_BOOLEAN, RE_PROFILE_VARIABLE, RE_PROFILE_CONDITIONAL,
> + RE_PROFILE_CONDITIONAL_VARIABLE, RE_PROFILE_CONDITIONAL_BOOLEAN,
> + RE_PROFILE_BARE_FILE_ENTRY, RE_PROFILE_PATH_ENTRY, RE_PROFILE_NETWORK,
> + RE_NETWORK_FAMILY_TYPE, RE_NETWORK_FAMILY, RE_PROFILE_CHANGE_HAT,
> + RE_PROFILE_HAT_DEF, RE_PROFILE_DBUS, RE_PROFILE_MOUNT,
> + RE_PROFILE_SIGNAL, RE_PROFILE_PTRACE, RE_PROFILE_PIVOT_ROOT,
> + RE_PROFILE_UNIX, RE_RULE_HAS_COMMA, RE_HAS_COMMENT_SPLIT )
> +
> import apparmor.rules as aarules
>
> from apparmor.yasti import SendDataToYast, GetDataFromYast, shutdown_yast
I know you sometimes have funny email client issues, but the first four
lines of the replacement import look like they have a trailing space
after them; if it's not an email client issue, could you please strip
them before committing? Also, for some reason, the line counts are off
in the patch above, which causes patch to claim its malformed. But the
changes themselves are good.
Acked-by: Steve Beattie <steve at nxnw.org>
Thanks.
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141113/0102d058/attachment.pgp>
More information about the AppArmor
mailing list