python - 无法运行位于android源代码中的audit2allow

标签 python android-source selinux

audit2allow python 脚本的位置是external/selinux/prebuilts/bin/audit2allow

当我尝试运行脚本时,出现以下错误:

Traceback (most recent call last):
  File "/home/shobhit/Desktop/Code/aosp/msm8909_android/external/selinux/policycoreutils/audit2allow/audit2allow", line 24, in <module>
    import sepolgen.audit as audit
  File "/home/shobhit/Desktop/Code/aosp/msm8909_android/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages/sepolgen/audit.py", line 20, in <module>
    import refpolicy
  File "/home/shobhit/Desktop/Code/aosp/msm8909_android/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages/sepolgen/refpolicy.py", line 22, in <module>
    import selinux
  File "/home/shobhit/Desktop/Code/aosp/msm8909_android/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages/selinux/__init__.py", line 28, in <module>
    _selinux = swig_import_helper()
  File "/home/shobhit/Desktop/Code/aosp/msm8909_android/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages/selinux/__init__.py", line 24, in swig_import_helper
    _mod = imp.load_module('_selinux', fp, pathname, description)
ImportError: /home/shobhit/Desktop/Code/aosp/msm8909_android/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages/selinux/_selinux.so: undefined symbol: selabel_partial_match

最佳答案

我知道这是一个老问题,但是......

是我机器上的 python 版本问题。将 python 链接更改为指向 python2 而不是 python3 并且一切正常。也许有比(临时)更改链接更优雅的解决方案,但它确实有效。

关于python - 无法运行位于android源代码中的audit2allow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50148270/

相关文章:

python - 是否可以在 python 的单元测试中跳过 setUp() 进行特定测试?

android - repo 初始化警告 : failed to restrict file handles

android - MultiChoiceModeListener android源码

android - 测试修改后的 Android 源代码的最快方法?

android - 无法 setprop - avc 被拒绝?

apache - Docker Centos 7 镜像运行 Apache2 "DocumentRoot ... is not readable"

linux - Apache 和 selinux,使用 linux 命令检索文件

python - 在 SqlAlchemy 中由自动映射创建类后是否可以声明关系

python - 连续 pdf 的 KL 散度

python - 如何将测试名称和模块添加到结果中的测试文档字符串?