> 文章列表 > AppArmor零知识学习八、源码构建(5)

AppArmor零知识学习八、源码构建(5)

AppArmor零知识学习八、源码构建(5)

本文内容参考:

AppArmor / apparmor · GitLab

接前一篇文章:AppArmor零知识学习七、源码构建(4)

在前一篇文章中完成了apparmor源码构建的第四步——Parser的构建和安装,本文继续往下进行。

四、源码构建

 5. Utilities构建

(1)进入utils目录

通过cd命令进入apparmor源码根目录下的utils目录。实际命令及结果如下所示

penghao@Ding-Perlis-MP260S48:~/AppArmor/apparmor$ cd utils/
penghao@Ding-Perlis-MP260S48:~/AppArmor/apparmor/utils$ ls
aa-audit          aa-complain      aa-easyprof      aa-logprof         aa-notify.pod          aa-unconfined.pod  Makefile               test
aa-audit.pod      aa-complain.pod  aa-easyprof.pod  aa-logprof.pod     aa-remove-unknown      apparmor           notify.conf            vim
aa-autodep        aa-decode        aa-enforce       aa-mergeprof       aa-remove-unknown.pod  check_po.pl        po
aa-autodep.pod    aa-decode.pod    aa-enforce.pod   aa-mergeprof.pod   aa-sandbox             easyprof           python-tools-setup.py
aa-cleanprof      aa-disable       aa-genprof       aa-notify          aa-sandbox.pod         logprof.conf       README.md
aa-cleanprof.pod  aa-disable.pod   aa-genprof.pod   aa-notify.desktop  aa-unconfined          logprof.conf.pod   severity.db

(2)编译

运行make命令进行编译。实际命令及结果如下所示:

$ make
/usr/bin/pod2man aa-easyprof.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-easyprof.8
/usr/bin/pod2man aa-genprof.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-genprof.8
/usr/bin/pod2man aa-logprof.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-logprof.8
/usr/bin/pod2man aa-cleanprof.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-cleanprof.8
/usr/bin/pod2man aa-mergeprof.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-mergeprof.8
/usr/bin/pod2man aa-autodep.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-autodep.8
/usr/bin/pod2man aa-audit.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-audit.8
/usr/bin/pod2man aa-complain.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-complain.8
/usr/bin/pod2man aa-enforce.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-enforce.8
/usr/bin/pod2man aa-disable.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-disable.8
/usr/bin/pod2man aa-notify.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-notify.8
/usr/bin/pod2man aa-unconfined.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-unconfined.8
/usr/bin/pod2man aa-decode.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-decode.8
/usr/bin/pod2man aa-remove-unknown.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-remove-unknown.8
/usr/bin/pod2man logprof.conf.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=5 > logprof.conf.5
/usr/bin/pod2html --header --css apparmor.css --infile=aa-easyprof.pod --outfile=aa-easyprof.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-genprof.pod --outfile=aa-genprof.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-logprof.pod --outfile=aa-logprof.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-cleanprof.pod --outfile=aa-cleanprof.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-mergeprof.pod --outfile=aa-mergeprof.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-autodep.pod --outfile=aa-autodep.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-audit.pod --outfile=aa-audit.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-complain.pod --outfile=aa-complain.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-enforce.pod --outfile=aa-enforce.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-disable.pod --outfile=aa-disable.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-notify.pod --outfile=aa-notify.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-unconfined.pod --outfile=aa-unconfined.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-decode.pod --outfile=aa-decode.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-remove-unknown.pod --outfile=aa-remove-unknown.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=logprof.conf.pod --outfile=logprof.conf.5.html
make -C po all
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/utils/po”
msgfmt -c -o af.mo af.po
af.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o be.mo be.po
be.po:7: 警告:文件头“Last-Translator”仍然是默认值未改变be.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o bo.mo bo.po
bo.po:7: 警告:文件头“Last-Translator”仍然是默认值未改变bo.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o bs.mo bs.po
msgfmt -c -o cs.mo cs.po
cs.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o de.mo de.po
msgfmt -c -o en_GB.mo en_GB.po
msgfmt -c -o es.mo es.po
es.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o fa.mo fa.po
fa.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o fr.mo fr.po
msgfmt -c -o gl.mo gl.po
gl.po:7: 警告:文件头“Last-Translator”仍然是默认值未改变gl.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o hi.mo hi.po
msgfmt -c -o id.mo id.po
msgfmt -c -o it.mo it.po
msgfmt -c -o ko.mo ko.po
msgfmt -c -o oc.mo oc.po
oc.po:7: 警告:文件头“Last-Translator”仍然是默认值未改变oc.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o pl.mo pl.po
msgfmt -c -o pt_BR.mo pt_BR.po
pt_BR.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o pt.mo pt.po
msgfmt -c -o ro.mo ro.po
ro.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o ru.mo ru.po
msgfmt -c -o sv.mo sv.po
msgfmt -c -o tr.mo tr.po
msgfmt -c -o ug.mo ug.po
msgfmt -c -o uk.mo uk.po
msgfmt -c -o zh_CN.mo zh_CN.po
zh_CN.po:7: 警告:头部缺少文件头“Language”
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/utils/po”
make -C vim all
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/utils/vim”
/usr/bin/python3 create-apparmor.vim.py > apparmor.vim || { rm -f apparmor.vim ; exit 1; }
/usr/bin/pod2man apparmor.vim.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=5 > apparmor.vim.5
/usr/bin/pod2html --header --css apparmor.css --infile=apparmor.vim.pod --outfile=apparmor.vim.5.html
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/utils/vim”

(3)检查

运行make check命令进行检查。实际命令及结果如下所示:

$ make check
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
/bin/sh:行3: pyflakes3:未找到命令make: *** [Makefile:94:check_lint] 错误 1

出现了错误。主要是因为没有按照官方的完全命令执行。完整命令为:

make check PYFLAKES=/usr/bin/pyflakes3

运行完整命令,实际命令及结果如下所示:

$ make check PYFLAKES=/usr/bin/pyflakes3
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
/bin/sh:行3: /usr/bin/pyflakes3: 没有那个文件或目录make: *** [Makefile:94:check_lint] 错误 1

看来系统中并不存在pyflakes3,需要进行安装。

----------------------------------------------------------------------------------------------------------------------------

知识补充 —— Pyflakes

Pyflakes是Python的一个三方包,其作用是分析代码,发现各种潜在的问题,如:引入但没有用到的模块、定义了但后面没有用到的变量等。用Pyflakes分析代码风格和寻找违法PEP-8编码规范的地方是相当简单的。Pyflakes的另一优势是分析速度快,但它能报告的错误类型是相当有限的。

Pyflakes的源码网址为:GitHub - PyCQA/pyflakes: A simple program which checks Python source files for errors

使用以下命令进行Pyflakes的下载安装:

pip install --upgrade pyflakes

python#.# -m pip install pyflakes

(for example, python3.10 -m pip install pyflakes)

实际命令及结果如下所示:

$ python3.10 -m pip install pyflakes
Defaulting to user installation because normal site-packages is not writeable
Collecting pyflakesDownloading pyflakes-3.0.1-py2.py3-none-any.whl (62 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 848.0 kB/s eta 0:00:00
Installing collected packages: pyflakesWARNING: The script pyflakes is installed in '/home/penghao/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pyflakes-3.0.1[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

安装完成后,查看/usr/bin/下pyflakes3是否已存在:

$ ls /usr/bin/pyflakes3
ls: 无法访问 '/usr/bin/pyflakes3': 没有那个文件或目录

可以看到,还是没有。为什么?是因为上边是在普通用户账户下下载的,需要在root账户下下载才可以。

执行以下命令先卸载普通用户下已经安装的pyflakes3,如下所示:

$ pip uninstall pyflakes
Found existing installation: pyflakes 3.0.1
Uninstalling pyflakes-3.0.1:Would remove:/home/penghao/.local/bin/pyflakes/home/penghao/.local/lib/python3.10/site-packages/pyflakes-3.0.1.dist-info/*/home/penghao/.local/lib/python3.10/site-packages/pyflakes/*
Proceed (Y/n)? ySuccessfully uninstalled pyflakes-3.0.1

切换到root用户或使用sudo再次下载安装pyflakes,实际命令及结果如下所示:

$ sudo pip install pyflakes
Collecting pyflakesDownloading pyflakes-3.0.1-py2.py3-none-any.whl (62 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 833.3 kB/s eta 0:00:00
Installing collected packages: pyflakes
Successfully installed pyflakes-3.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

这次再看一下/usr/bin/下pyflakes是否已存在:

$ which pyflakes 
/usr/bin/pyflakes$ ls /usr/bin/pyflakes 
/usr/bin/pyflakes

这样就完成了pyflakes的下载安装。

----------------------------------------------------------------------------------------------------------------------------

回到之前的步骤,重新运行make check完整命令进行检查。实际命令及结果如下所示:

$ make check PYFLAKES=/usr/bin/pyflakes3
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
/bin/sh:行3: /usr/bin/pyflakes3: 没有那个文件或目录make: *** [Makefile:94:check_lint] 错误 1

还是没有。这次没有的原因是/usr/bin/下只有pyflakes而没有pyflakes3,手动建立一个软链接:

$ sudo ln -s /usr/bin/pyflakes /usr/bin/pyflakes3

再来:

$ make check PYFLAKES=/usr/bin/pyflakes3
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
Checking aa-genprof
Checking aa-logprof
Checking aa-cleanprof
Checking aa-mergeprof
Checking aa-autodep
Checking aa-audit
Checking aa-complain
Checking aa-enforce
Checking aa-disable
Checking aa-notify
Checking aa-unconfined
Checking apparmor
Checking test/common_test.py
Checking test/test-aa-cli-bootstrap.py
Checking test/test-aa-decode.py
Checking test/test-aa-easyprof.py
Checking test/test-aa-notify.py
Checking test/test-aa.py
Checking test/test-aare.py
Checking test/test-abi.py
Checking test/test-alias.py
Checking test/test-baserule.py
Checking test/test-boolean.py
Checking test/test-capability.py
Checking test/test-change_profile.py
Checking test/test-common.py
Checking test/test-config.py
Checking test/test-dbus.py
Checking test/test-example.py
Checking test/test-file.py
Checking test/test-include.py
Checking test/test-libapparmor-test_multi.py
Checking test/test-logparser.py
Checking test/test-minitools.py
Checking test/test-mount_parse.py
Checking test/test-mqueue.py
Checking test/test-network.py
Checking test/test-notify.py
Checking test/test-parser-simple-tests.py
Checking test/test-pivot_root_parse.py
Checking test/test-profile-list.py
Checking test/test-profiles.py
Checking test/test-profile-storage.py
Checking test/test-ptrace.py
Checking test/test-regex_matches.py
Checking test/test-rlimit.py
Checking test/test-severity.py
Checking test/test-signal.py
Checking test/test-translations.py
Checking test/test-unix_parse.py
Checking test/test-userns.py
Checking test/test-variable.py
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/utils/test”=== test-aa-cli-bootstrap.py ===
.....
----------------------------------------------------------------------
Ran 5 tests in 0.136sOK=== test-aa-decode.py ===
..........
----------------------------------------------------------------------
Ran 10 tests in 0.305sOK=== test-aa-easyprof.py ===
.........................................
# vim:syntax=apparmor
# test-template
# AppArmor policy for foo
# ###AUTHOR###
# ###COPYRIGHT###
# ###COMMENT####include <tunables/global># No template variables specified"/opt/bin/foo" {#include <abstractions/base># No abstractions specified# No policy groups specified# No read paths specified# No write paths specified
bzzzt..........................................................................................WARN: Manifest definition is potentially unsafe
found 'user-tmp' abstraction
..WARN: Manifest definition is potentially unsafe
profile_name 'bin/*'
..WARN: Manifest definition is potentially unsafe
@{VAR1}=f*o
WARN: Manifest definition is potentially unsafe
@{VAR2}=*foo
WARN: Manifest definition is potentially unsafe
@{VAR3}=fo*
WARN: Manifest definition is potentially unsafe
@{VAR4}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR5}=b{a,r}
WARN: Manifest definition is potentially unsafe
@{VAR6}=b}ar
WARN: Manifest definition is potentially unsafe
@{VAR7}=bar[0-9]
WARN: Manifest definition is potentially unsafe
@{VAR8}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR9}=foo/bar
..
----------------------------------------------------------------------
Ran 137 tests in 1.198sOK=== test-aa-notify.py ===
FFFFF
======================================================================
FAIL: test_entries_since_100_days (__main__.AANotifyTest)
Test showing log entries since 100 days
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 190, in test_entries_since_100_daysself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2
ModuleNotFoundError: No module named 'notify2'======================================================================
FAIL: test_entries_since_login (__main__.AANotifyTest)
Test showing log entries since last login
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 205, in test_entries_since_loginself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2
ModuleNotFoundError: No module named 'notify2'======================================================================
FAIL: test_entries_since_login_verbose (__main__.AANotifyTest)
Test showing log entries since last login in verbose mode
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 281, in test_entries_since_login_verboseself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2
ModuleNotFoundError: No module named 'notify2'======================================================================
FAIL: test_help_contents (__main__.AANotifyTest)
Test output of help text
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 177, in test_help_contentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2
ModuleNotFoundError: No module named 'notify2'======================================================================
FAIL: test_no_arguments (__main__.AANotifyTest)
Test using no arguments at all
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 142, in test_no_argumentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2
ModuleNotFoundError: No module named 'notify2'----------------------------------------------------------------------
Ran 5 tests in 0.111sFAILED (failures=5)
make[1]: *** [Makefile:85:check] 错误 1
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/utils/test”
make: *** [Makefile:103:check] 错误 2

可以看到,之前的问题解决了,但是又出现了新的问题: ModuleNotFoundError: No module named 'notify2'。这说明notify2这个包不存在。如何解决?

同样是通过pip install命令进行下载安装。实际命令及结果如下:

$ sudo pip install notify2
[sudo] penghao 的密码:Collecting notify2Downloading notify2-0.3.1-py2.py3-none-any.whl (8.0 kB)
Installing collected packages: notify2
Successfully installed notify2-0.3.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

下载安装notify2包之后,重新执行完整检查命令,实际命令及结果如下所示:

$ make check PYFLAKES=/usr/bin/pyflakes
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
Checking aa-genprof
Checking aa-logprof
Checking aa-cleanprof
Checking aa-mergeprof
Checking aa-autodep
Checking aa-audit
Checking aa-complain
Checking aa-enforce
Checking aa-disable
Checking aa-notify
Checking aa-unconfined
Checking apparmor
Checking test/common_test.py
Checking test/test-aa-cli-bootstrap.py
Checking test/test-aa-decode.py
Checking test/test-aa-easyprof.py
Checking test/test-aa-notify.py
Checking test/test-aa.py
Checking test/test-aare.py
Checking test/test-abi.py
Checking test/test-alias.py
Checking test/test-baserule.py
Checking test/test-boolean.py
Checking test/test-capability.py
Checking test/test-change_profile.py
Checking test/test-common.py
Checking test/test-config.py
Checking test/test-dbus.py
Checking test/test-example.py
Checking test/test-file.py
Checking test/test-include.py
Checking test/test-libapparmor-test_multi.py
Checking test/test-logparser.py
Checking test/test-minitools.py
Checking test/test-mount_parse.py
Checking test/test-mqueue.py
Checking test/test-network.py
Checking test/test-notify.py
Checking test/test-parser-simple-tests.py
Checking test/test-pivot_root_parse.py
Checking test/test-profile-list.py
Checking test/test-profiles.py
Checking test/test-profile-storage.py
Checking test/test-ptrace.py
Checking test/test-regex_matches.py
Checking test/test-rlimit.py
Checking test/test-severity.py
Checking test/test-signal.py
Checking test/test-translations.py
Checking test/test-unix_parse.py
Checking test/test-userns.py
Checking test/test-variable.py
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/utils/test”=== test-aa-cli-bootstrap.py ===
.....
----------------------------------------------------------------------
Ran 5 tests in 0.108sOK=== test-aa-decode.py ===
..........
----------------------------------------------------------------------
Ran 10 tests in 0.305sOK=== test-aa-easyprof.py ===
.........................................
# vim:syntax=apparmor
# test-template
# AppArmor policy for foo
# ###AUTHOR###
# ###COPYRIGHT###
# ###COMMENT####include <tunables/global># No template variables specified"/opt/bin/foo" {#include <abstractions/base># No abstractions specified# No policy groups specified# No read paths specified# No write paths specified
bzzzt..........................................................................................WARN: Manifest definition is potentially unsafe
found 'user-tmp' abstraction
..WARN: Manifest definition is potentially unsafe
profile_name 'bin/*'
..WARN: Manifest definition is potentially unsafe
@{VAR1}=f*o
WARN: Manifest definition is potentially unsafe
@{VAR2}=*foo
WARN: Manifest definition is potentially unsafe
@{VAR3}=fo*
WARN: Manifest definition is potentially unsafe
@{VAR4}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR5}=b{a,r}
WARN: Manifest definition is potentially unsafe
@{VAR6}=b}ar
WARN: Manifest definition is potentially unsafe
@{VAR7}=bar[0-9]
WARN: Manifest definition is potentially unsafe
@{VAR8}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR9}=foo/bar
..
----------------------------------------------------------------------
Ran 137 tests in 1.184sOK=== test-aa-notify.py ===
FFFFF
======================================================================
FAIL: test_entries_since_100_days (__main__.AANotifyTest)
Test showing log entries since 100 days
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 190, in test_entries_since_100_daysself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_entries_since_login (__main__.AANotifyTest)
Test showing log entries since last login
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 205, in test_entries_since_loginself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_entries_since_login_verbose (__main__.AANotifyTest)
Test showing log entries since last login in verbose mode
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 281, in test_entries_since_login_verboseself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_help_contents (__main__.AANotifyTest)
Test output of help text
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 177, in test_help_contentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_no_arguments (__main__.AANotifyTest)
Test using no arguments at all
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 142, in test_no_argumentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'----------------------------------------------------------------------
Ran 5 tests in 0.112sFAILED (failures=5)
make[1]: *** [Makefile:85:check] 错误 1
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/utils/test”
make: *** [Makefile:103:check] 错误 2

可以看到,又缺了dbus这个包。继续使用pip install命令进行下载安装,实际命令及结果如下所示:

$ sudo pip install dbus
ERROR: Could not find a version that satisfies the requirement dbus (from versions: none)
ERROR: No matching distribution found for dbus[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

可以看到,并没有这个包。参考以下网址:

python - "ModuleNotFoundError: No module named 'dbus'" on macOS - Stack Overflow

通过pip install命令下载安装dbus-python而非dbus,实际命令及结果如下所示:

$ sudo pip install dbus-python
Collecting dbus-pythonUsing cached dbus-python-1.3.2.tar.gz (605 kB)Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... errorerror: subprocess-exited-with-error× Preparing metadata (pyproject.toml) did not run successfully.│ exit code: 13╰─> [165 lines of output]The Meson build systemVersion: 1.1.0Source dir: /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5cBuild dir: /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c/.mesonpy-zh9xzeuf/buildBuild type: native buildProject name: dbus-pythonProject version: 1.3.2C compiler for the host machine: cc (gcc 12.1.0 "cc (GCC) 12.1.0")C linker for the host machine: cc ld.bfd 2.38Host machine cpu family: x86_64Host machine cpu: x86_64Compiler for C supports arguments -fno-common: YESCompiler for C supports arguments -Wno-missing-field-initializers: YESCompiler for C supports arguments -Wno-declaration-after-statement: YESCompiler for C supports arguments -Wno-inline: YESCompiler for C supports arguments -Wno-redundant-decls: YESCompiler for C supports arguments -Wno-switch-default: YESCompiler for C supports arguments -Wno-write-strings: YESCompiler for C supports arguments -Wcast-align: YESCompiler for C supports arguments -Wdouble-promotion: YESCompiler for C supports arguments -Wduplicated-cond: YESCompiler for C supports arguments -Wfloat-equal: YESCompiler for C supports arguments -Wformat-nonliteral: YESCompiler for C supports arguments -Wformat-security: YESCompiler for C supports arguments -Wformat=2: YESCompiler for C supports arguments -Winit-self: YESCompiler for C supports arguments -Wlogical-op: YESCompiler for C supports arguments -Wmissing-declarations: YESCompiler for C supports arguments -Wmissing-format-attribute: YESCompiler for C supports arguments -Wmissing-include-dirs: YESCompiler for C supports arguments -Wmissing-noreturn: YESCompiler for C supports arguments -Wnull-dereference: YESCompiler for C supports arguments -Wpacked: YESCompiler for C supports arguments -Wpointer-arith: YESCompiler for C supports arguments -Wshadow: YESCompiler for C supports arguments -Wswitch-enum: YESCompiler for C supports arguments -Wundef: YESCompiler for C supports arguments -Wunused-but-set-variable: YESCompiler for C supports arguments -Wjump-misses-init: YESCompiler for C supports arguments -Wmissing-prototypes: YESCompiler for C supports arguments -Wnested-externs: YESCompiler for C supports arguments -Wold-style-definition: YESCompiler for C supports arguments -Wpointer-sign: YESCompiler for C supports arguments -Wstrict-prototypes: YESConfiguring _dbus-python-config.h using configurationExecuting subproject dbus-gmaindbus-gmain| Project name: dbus-gmaindbus-gmain| Project version: undefineddbus-gmain| C compiler for the host machine: cc (gcc 12.1.0 "cc (GCC) 12.1.0")dbus-gmain| C linker for the host machine: cc ld.bfd 2.38dbus-gmain| Compiler for C supports arguments -fno-common: YES (cached)dbus-gmain| Compiler for C supports arguments -Wno-missing-field-initializers: YES (cached)dbus-gmain| Compiler for C supports arguments -Wcast-align: YES (cached)dbus-gmain| Compiler for C supports arguments -Wdouble-promotion: YES (cached)dbus-gmain| Compiler for C supports arguments -Wduplicated-branches: YESdbus-gmain| Compiler for C supports arguments -Wduplicated-cond: YES (cached)dbus-gmain| Compiler for C supports arguments -Wfloat-equal: YES (cached)dbus-gmain| Compiler for C supports arguments -Wformat-nonliteral: YES (cached)dbus-gmain| Compiler for C supports arguments -Wformat-security: YES (cached)dbus-gmain| Compiler for C supports arguments -Wformat=2: YES (cached)dbus-gmain| Compiler for C supports arguments -Winit-self: YES (cached)dbus-gmain| Compiler for C supports arguments -Wlogical-op: YES (cached)dbus-gmain| Compiler for C supports arguments -Wmissing-declarations: YES (cached)dbus-gmain| Compiler for C supports arguments -Wmissing-format-attribute: YES (cached)dbus-gmain| Compiler for C supports arguments -Wmissing-include-dirs: YES (cached)dbus-gmain| Compiler for C supports arguments -Wmissing-noreturn: YES (cached)dbus-gmain| Compiler for C supports arguments -Wnull-dereference: YES (cached)dbus-gmain| Compiler for C supports arguments -Wpacked: YES (cached)dbus-gmain| Compiler for C supports arguments -Wpointer-arith: YES (cached)dbus-gmain| Compiler for C supports arguments -Wredundant-decls: YESdbus-gmain| Compiler for C supports arguments -Wshadow: YES (cached)dbus-gmain| Compiler for C supports arguments -Wswitch-default: YESdbus-gmain| Compiler for C supports arguments -Wswitch-enum: YES (cached)dbus-gmain| Compiler for C supports arguments -Wundef: YES (cached)dbus-gmain| Compiler for C supports arguments -Wunused-but-set-variable: YES (cached)dbus-gmain| Compiler for C supports arguments -Wwrite-strings: YESdbus-gmain| Compiler for C supports arguments -Wdeclaration-after-statement: YESdbus-gmain| Compiler for C supports arguments -Wjump-misses-init: YES (cached)dbus-gmain| Compiler for C supports arguments -Wmissing-prototypes: YES (cached)dbus-gmain| Compiler for C supports arguments -Wnested-externs: YES (cached)dbus-gmain| Compiler for C supports arguments -Wold-style-definition: YES (cached)dbus-gmain| Compiler for C supports arguments -Wpointer-sign: YES (cached)dbus-gmain| Compiler for C supports arguments -Wstrict-prototypes: YES (cached)dbus-gmain| Found pkg-config: /bin/pkg-config (0.29.2)dbus-gmain| Run-time dependency dbus-1 found: YES 1.14.0dbus-gmain| Run-time dependency glib-2.0 found: YES 2.72.3dbus-gmain| Run-time dependency gthread-2.0 found: YES 2.72.3dbus-gmain| Program dbus-run-session found: YES (/bin/dbus-run-session)dbus-gmain| Build targets in project: 1dbus-gmain| Subproject dbus-gmain finished.Program python found: YES (/usr/bin/python3.10)Dependency dbus-1 found: YES 1.14.0 (cached)Configuring TestSuitePythonService.service using configurationConfiguring tmp-session-bus.conf using configurationProgram dbus-run-session found: YES (/bin/dbus-run-session)Build targets in project: 5dbus-python 1.3.2Subprojectsdbus-gmain  : YESUser defined optionsNative files: /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c/.mesonpy-native-file.inidebug       : falseoptimization: 2prefix      : /usrFound ninja-1.11.1.git.kitware.jobserver-1 at /tmp/pip-build-env-jin8naml/overlay/bin/ninja[1/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_debug.c.o[2/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_bytes.c.o[3/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_bus.c.o[4/32] Compiling C object subprojects/dbus-gmain/libdbus-gmain.a.p/dbus-gmain.c.o[5/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_float.c.o[6/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_conn.c.o[7/32] Linking static target subprojects/dbus-gmain/libdbus-gmain.a[8/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_exceptions.c.o[9/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_generic.c.o[10/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_abstract.c.o[11/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_containers.c.o[12/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_conn-methods.c.o[13/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_unixfd.c.o[14/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_libdbusconn.c.o[15/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_mainloop.c.o[16/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_int.c.o[17/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_module.c.o[18/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_pending-call.c.o[19/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message-get-args.c.o[20/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_validation.c.o[21/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message.c.o[22/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_signature.c.o[23/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_string.c.o[24/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message-append.c.o[25/32] Compiling C object test/test-import-repeatedly.p/import-repeatedly.c.o[26/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_server.c.o[27/32] Linking target test/test-import-repeatedly[28/32] Compiling C object test/dbus_py_test.cpython-310-x86_64-linux-gnu.so.p/dbus_py_test.c.o[29/32] Linking target _dbus_bindings.cpython-310-x86_64-linux-gnu.so[30/32] Linking target test/dbus_py_test.cpython-310-x86_64-linux-gnu.so[31/32] Compiling C object _dbus_glib_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_glib_bindings_module.c.o[32/32] Linking target _dbus_glib_bindings.cpython-310-x86_64-linux-gnu.soINFO: autodetecting backend as ninjaINFO: calculating backend command to run: /tmp/pip-build-env-jin8naml/overlay/bin/ninjaTraceback (most recent call last):File "/tmp/pip-build-env-jin8naml/overlay/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 194, in runreturn options.run_func(options)File "/tmp/pip-build-env-jin8naml/overlay/lib/python3.10/site-packages/mesonbuild/minstall.py", line 823, in runif not rebuild_all(opts.wd, backend):File "/tmp/pip-build-env-jin8naml/overlay/lib/python3.10/site-packages/mesonbuild/minstall.py", line 804, in rebuild_allret = subprocess.run(ninja + ['-C', wd], env=env, preexec_fn=preexec_fn).returncodeFile "/usr/lib/python3.10/subprocess.py", line 501, in runwith Popen(*popenargs, **kwargs) as process:File "/usr/lib/python3.10/subprocess.py", line 969, in __init__self._execute_child(args, executable, preexec_fn, close_fds,File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_childraise child_exception_type(errno_num, err_msg, err_filename)PermissionError: [Errno 13] Permission denied: '/tmp/pip-build-env-jin8naml/overlay/bin/ninja'ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment.+ meson setup --prefix=/usr /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c/.mesonpy-zh9xzeuf/build --native-file=/tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2+ meson compile+ meson install --destdir /tmp/pip-install-wm8urrwk/dbus-python_b7d929241c044e5085e96a45175dbc5c/.mesonpy-zh9xzeuf/install[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

参考以下网址中的内容:

pip无法安装dbus-python - 问答 - 腾讯云开发者社区-腾讯云

下载安装dbus-next而非dus-python,实际命令及结果如下所示:

$ sudo pip install dbus-next
Collecting dbus-nextDownloading dbus_next-0.2.3-py3-none-any.whl (57 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.9/57.9 kB 422.9 kB/s eta 0:00:00
Installing collected packages: dbus-next
Successfully installed dbus-next-0.2.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv[notice] A new release of pip is available: 23.0 -> 23.1
[notice] To update, run: pip install --upgrade pip

再次重新执行完成检查命令,实际命令及结果如下所示:

$ make check PYFLAKES=/usr/bin/pyflakes
LANG=C podchecker -warning -warning *.pod
aa-audit.pod pod syntax OK.
aa-autodep.pod pod syntax OK.
aa-cleanprof.pod pod syntax OK.
aa-complain.pod pod syntax OK.
aa-decode.pod pod syntax OK.
aa-disable.pod pod syntax OK.
aa-easyprof.pod pod syntax OK.
aa-enforce.pod pod syntax OK.
aa-genprof.pod pod syntax OK.
aa-logprof.pod pod syntax OK.
aa-mergeprof.pod pod syntax OK.
aa-notify.pod pod syntax OK.
aa-remove-unknown.pod pod syntax OK.
aa-sandbox.pod pod syntax OK.
aa-unconfined.pod pod syntax OK.
logprof.conf.pod pod syntax OK.
Checking aa-easyprof
Checking aa-genprof
Checking aa-logprof
Checking aa-cleanprof
Checking aa-mergeprof
Checking aa-autodep
Checking aa-audit
Checking aa-complain
Checking aa-enforce
Checking aa-disable
Checking aa-notify
Checking aa-unconfined
Checking apparmor
Checking test/common_test.py
Checking test/test-aa-cli-bootstrap.py
Checking test/test-aa-decode.py
Checking test/test-aa-easyprof.py
Checking test/test-aa-notify.py
Checking test/test-aa.py
Checking test/test-aare.py
Checking test/test-abi.py
Checking test/test-alias.py
Checking test/test-baserule.py
Checking test/test-boolean.py
Checking test/test-capability.py
Checking test/test-change_profile.py
Checking test/test-common.py
Checking test/test-config.py
Checking test/test-dbus.py
Checking test/test-example.py
Checking test/test-file.py
Checking test/test-include.py
Checking test/test-libapparmor-test_multi.py
Checking test/test-logparser.py
Checking test/test-minitools.py
Checking test/test-mount_parse.py
Checking test/test-mqueue.py
Checking test/test-network.py
Checking test/test-notify.py
Checking test/test-parser-simple-tests.py
Checking test/test-pivot_root_parse.py
Checking test/test-profile-list.py
Checking test/test-profiles.py
Checking test/test-profile-storage.py
Checking test/test-ptrace.py
Checking test/test-regex_matches.py
Checking test/test-rlimit.py
Checking test/test-severity.py
Checking test/test-signal.py
Checking test/test-translations.py
Checking test/test-unix_parse.py
Checking test/test-userns.py
Checking test/test-variable.py
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/utils/test”=== test-aa-cli-bootstrap.py ===
.....
----------------------------------------------------------------------
Ran 5 tests in 0.109sOK=== test-aa-decode.py ===
..........
----------------------------------------------------------------------
Ran 10 tests in 0.306sOK=== test-aa-easyprof.py ===
.........................................
# vim:syntax=apparmor
# test-template
# AppArmor policy for foo
# ###AUTHOR###
# ###COPYRIGHT###
# ###COMMENT####include <tunables/global># No template variables specified"/opt/bin/foo" {#include <abstractions/base># No abstractions specified# No policy groups specified# No read paths specified# No write paths specified
bzzzt..........................................................................................WARN: Manifest definition is potentially unsafe
found 'user-tmp' abstraction
..WARN: Manifest definition is potentially unsafe
profile_name 'bin/*'
..WARN: Manifest definition is potentially unsafe
@{VAR1}=f*o
WARN: Manifest definition is potentially unsafe
@{VAR2}=*foo
WARN: Manifest definition is potentially unsafe
@{VAR3}=fo*
WARN: Manifest definition is potentially unsafe
@{VAR4}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR5}=b{a,r}
WARN: Manifest definition is potentially unsafe
@{VAR6}=b}ar
WARN: Manifest definition is potentially unsafe
@{VAR7}=bar[0-9]
WARN: Manifest definition is potentially unsafe
@{VAR8}=b{ar
WARN: Manifest definition is potentially unsafe
@{VAR9}=foo/bar
..
----------------------------------------------------------------------
Ran 137 tests in 1.185sOK=== test-aa-notify.py ===
FFFFF
======================================================================
FAIL: test_entries_since_100_days (__main__.AANotifyTest)
Test showing log entries since 100 days
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 190, in test_entries_since_100_daysself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_entries_since_login (__main__.AANotifyTest)
Test showing log entries since last login
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 205, in test_entries_since_loginself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_entries_since_login_verbose (__main__.AANotifyTest)
Test showing log entries since last login in verbose mode
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 281, in test_entries_since_login_verboseself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_help_contents (__main__.AANotifyTest)
Test output of help text
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 177, in test_help_contentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'======================================================================
FAIL: test_no_arguments (__main__.AANotifyTest)
Test using no arguments at all
----------------------------------------------------------------------
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/test-aa-notify.py", line 142, in test_no_argumentsself.assertEqual(expected_return_code, return_code, result + output)
AssertionError: 0 != 1 : Got return code 1, expected 0
Traceback (most recent call last):File "/home/penghao/AppArmor/apparmor/utils/test/../aa-notify", line 42, in <module>import notify2File "/usr/lib/python3.10/site-packages/notify2.py", line 39, in <module>import dbus
ModuleNotFoundError: No module named 'dbus'----------------------------------------------------------------------
Ran 5 tests in 0.112sFAILED (failures=5)
make[1]: *** [Makefile:85:check] 错误 1
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/utils/test”
make: *** [Makefile:103:check] 错误 2

仍然是之前的问题,dbus-next不管用。还是要回到安装dbus-python这一步来。如何解决或者绕过pip install安装dbus-python失败的问题?本篇文章比较长了,放到下一篇文章中详述。