aa-genprof crashes on start due to python 3.6 bug

Bug #1661766 reported by Eugene Sovetkin
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
AppArmor
Fix Released
Undecided
Unassigned
apparmor (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

aa-genprof crashes with the following error message on start:

http://pastebin.com/SWvk4GAj

It seem to be realated to the following bug with python 3.6:

https://github.com/kennethreitz/tablib/issues/254

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Hi Eugene, thanks for the bug report. You don't happen to know off-hand if the Python developers intend to fix this regression, do you?

Thanks

Revision history for this message
Eugene Sovetkin (e-sovetkin) wrote :

Hi Seth, I am not sure it is a regression with python. By "bug with python 3.6" I meant a similar issue I managed to find.

Revision history for this message
Eugene Sovetkin (e-sovetkin) wrote :

I forgot to mention the version of package I am using. On my machine aa-genprof belongs to a package called apparmor-utils 2.10.1.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

By 'regression' I meant 'something that used to work and now doesn't work': e.g.:

$ python2 -c 'import re; re.search("hi", "hi", re.LOCALE)'
$ python3.5 -c 'import re; re.search("hi", "hi", re.LOCALE)'
$ python3.6 -c 'import re; re.search("hi", "hi", re.LOCALE)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/re.py", line 182, in search
    return _compile(pattern, flags).search(string)
  File "/usr/lib/python3.6/re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.6/sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.6/sre_parse.py", line 866, in parse
    p.pattern.flags = fix_flags(str, p.pattern.flags)
  File "/usr/lib/python3.6/sre_parse.py", line 833, in fix_flags
    raise ValueError("cannot use LOCALE flag with a str pattern")
ValueError: cannot use LOCALE flag with a str pattern

The error message sure makes it look like an intentional API break. :(

Thanks

Revision history for this message
Christian Boltz (cboltz) wrote :

It seems to be an intentional regression :-(

I just found out that python has a "-Wall" option, so let's try it with python 3.5:

# python3 -Wall -c 'import re; re.search("hi", "hi", re.LOCALE)'
-c:1: DeprecationWarning: LOCALE flag with a str pattern is deprecated. Will be an error in 3.6

Argh. Now the python developers introduce backward-incompatible changes even in minor releases :-(

https://docs.python.org/3/library/re.html says
Changed in version 3.6: re.LOCALE can be used only with bytes patterns and is not compatible with re.ASCII.

On the positive side, it seems we only use re.LOCALE at two places in ui.py to get the (H)otkey from a text. I'll send a patch to remove the LOCALE flag and hope that this doesn't break anything ;-)

Revision history for this message
Steve Beattie (sbeattie) wrote :

This was fixed in apparmor in http://bazaar.launchpad.net/~apparmor-dev/apparmor/master/revision/3631 and will be in 3.11.1.

It also affects Ubuntu, as 17.10 now uses python 3.6 as its version of python3.

Changed in apparmor:
status: New → Fix Committed
milestone: none → 2.11.1
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apparmor - 2.11.0-2ubuntu15

---------------
apparmor (2.11.0-2ubuntu15) artful; urgency=medium

  * Correctly remove system upstart job.

 -- Dimitri John Ledkov <email address hidden> Mon, 07 Aug 2017 17:03:19 -0400

Changed in apparmor (Ubuntu):
status: New → Fix Released
Revision history for this message
intrigeri (intrigeri) wrote :

FTR Debian sid still defaults to python3 == Python 3.5, but will soon switch to 3.6 (https://release.debian.org/transitions/html/python3.6-supported.html) and will therefore be affected.

Changed in apparmor:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.