Comment 4 for bug 1510365

Revision history for this message
Park, JaeSuk (jspark99) wrote :

// for make install case:
 apparmor-related python libs are installed in /usr/lib/python2.7/site-packages/apparmor and LibAppArmor

// and this error happens.
ubuntu 14.04]$ sudo aa-complain
Traceback (most recent call last):
  File "/usr/sbin/aa-complain", line 17, in <module>
    import apparmor.tools
ImportError: No module named apparmor.tools

// when I copied like this, there was no error
/usr/lib/python2.7/site-packages/apparmor => /usr/lib/python2.7/dist-packages/apparmor
/usr/lib/python2.7/site-packages/LibApparmor=> /usr/lib/python2.7/dist-packages/LibApparmor
// No error without arguments
]$ sudo aa-complain
usage: aa-complain [-h] [-d DIR] program [program ...]
aa-complain: error: too few arguments

// But error with argument
===============================================
]$ sudo aa-complain /etc/apparmor.d/bin.ping
Traceback (most recent call last):
  File "/usr/sbin/aa-complain", line 30, in <module>
    tool.cmd_complain()
  File "/usr/lib/python2.7/dist-packages/apparmor/tools.py", line 171, in cmd_complain
    apparmor.read_profiles()
  File "/usr/lib/python2.7/dist-packages/apparmor/aa.py", line 2558, in read_profiles
    read_profile(profile_dir + '/' + file, True)
  File "/usr/lib/python2.7/dist-packages/apparmor/aa.py", line 2584, in read_profile
    profile_data = parse_profile_data(data, file, 0)
  File "/usr/lib/python2.7/dist-packages/apparmor/aa.py", line 2914, in parse_profile_data
    load_include(include_name)
  File "/usr/lib/python2.7/dist-packages/apparmor/aa.py", line 4170, in load_include
    incdata = parse_profile_data(data, incfile, True)
  File "/usr/lib/python2.7/dist-packages/apparmor/aa.py", line 3031, in parse_profile_data
    raise AppArmorException(_('Syntax Error: Unknown line found in file: %s line: %s') % (file, lineno + 1))

==when I comment out these regular expressions handling routine, it seemed to work!! ==============
/usr/lib/python2.7/dist-packages/apparmor/aa.py
RE_PROFILE_VARIABLE = re.compile('^\s*(@\{?\w+\}?)\s*(\+?=)\s*(@*.+?)\s*,?\s*(#.*)?$')