Comment 5 for bug 1444347

Revision history for this message
Robert Schroll (rschroll) wrote : Re: /usr/bin/aa-clickhook:ImportError:/usr/bin/aa-clickhook@14:/usr/lib/python3/dist-packages/apparmor/click.py@15:/usr/lib/python3.4/ctypes/__init__.py@7

objdump doesn't exist on the device, so I copied the python3.4 binary over to my desktop. Running that command doesn't produce any output. (Just objdump -T alone does, so I assume it's working but producing nothing that grep matches.)

FWIW, it looks like the only use for ctypes in click.py is to import the nih_dbus_path() function. But you can just write it in python in about as many lines as it took to import it:

def encode_byte(b):
    if ord(b'a') <= b <= ord(b'z') or ord(b'A') <= b <= ord(b'Z') or ord(b'0') <= b <= ord(b'9'):
        return bytes([b])
    return ('_%0.2x' % b).encode()

def my_dbus_path(x, *args):
    return b'/'.join(b''.join(encode_byte(b) for b in arg) for arg in args if arg is not None)

It probably doesn't fail in the same ways, but for a few tests with valid imports, it seems to work.