Merge ~georgiag/qa-regression-testing:apparmor-dbus into qa-regression-testing:master

Proposed by Georgia Garcia
Status: Merged
Merged at revision: 9c7bd11b2ef2568a809273ec47b6e0e2452683ca
Proposed branch: ~georgiag/qa-regression-testing:apparmor-dbus
Merge into: qa-regression-testing:master
Diff against target: 65 lines (+48/-0)
2 files modified
scripts/apparmor/patches/tests-force-dbus-daemon-to-generate-an-abstract-sock.patch (+41/-0)
scripts/test-apparmor.py (+7/-0)
Reviewer Review Type Date Requested Status
Steve Beattie Approve
Review via email: mp+446102@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Beattie (sbeattie) wrote :

Awesome, thanks! Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/apparmor/patches/tests-force-dbus-daemon-to-generate-an-abstract-sock.patch b/scripts/apparmor/patches/tests-force-dbus-daemon-to-generate-an-abstract-sock.patch
2new file mode 100644
3index 0000000..9d47cb7
4--- /dev/null
5+++ b/scripts/apparmor/patches/tests-force-dbus-daemon-to-generate-an-abstract-sock.patch
6@@ -0,0 +1,41 @@
7+From d73e244ed71b0b4f69b96a4cfe06ced399552337 Mon Sep 17 00:00:00 2001
8+From: Georgia Garcia <georgia.garcia@canonical.com>
9+Date: Tue, 28 Mar 2023 14:23:01 +0000
10+Subject: [PATCH] Merge tests: force dbus-daemon to generate an abstract socket
11+
12+dbus 1.14.4 changed the behavior of unix:tmpdir to be equivalent to
13+unix:dir, which cases dbus-daemon to generate path based sockets,
14+instead of the previous abstract sockets. [1]
15+In this change we force dbus-daemon to generate an abstract socket by
16+specifying the abstract socket address in the command.
17+
18+[1] https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14/NEWS#L64
19+
20+MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/999
21+Approved-by: John Johansen <john@jjmx.net>
22+Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
23+
24+(cherry picked from commit 904b7339482765551d3039cb74313a9afef29a79)
25+
26+53d4e341 tests: force dbus-daemon to generate an abstract socket
27+---
28+ tests/regression/apparmor/dbus.inc | 3 ++-
29+ 1 file changed, 2 insertions(+), 1 deletion(-)
30+
31+diff --git a/tests/regression/apparmor/dbus.inc b/tests/regression/apparmor/dbus.inc
32+index b234a348f..8055fb733 100755
33+--- a/tests/regression/apparmor/dbus.inc
34++++ b/tests/regression/apparmor/dbus.inc
35+@@ -32,7 +32,8 @@ set_dbus_var()
36+
37+ start_bus()
38+ {
39+- out=$(dbus-daemon --fork --print-pid --print-address --config-file=dbus.conf)
40++ bus_addr=$(mktemp --dry-run /tmp/dbus-XXXXXX)
41++ out=$(dbus-daemon --fork --print-pid --print-address --address="unix:abstract=$bus_addr" --config-file=dbus.conf)
42+ if [ $? -ne 0 ]
43+ then
44+ fatalerror "Failed to start DBus daemon"
45+--
46+2.34.1
47+
48diff --git a/scripts/test-apparmor.py b/scripts/test-apparmor.py
49index a51bba4..a5f1910 100755
50--- a/scripts/test-apparmor.py
51+++ b/scripts/test-apparmor.py
52@@ -1813,6 +1813,13 @@ class ApparmorTestsuites(testlib.TestlibCase):
53 if testlib.dpkg_compare_installed_version('apparmor', 'ge', '3.0.4-2ubuntu2.2'):
54 self._apply_patch('tests-fix-variable-type-for-getopt.patch')
55
56+ # dbus 1.14.4 changed the behavior of unix:tmpdir to be equivalent to
57+ # unix:dir, which cases dbus-daemon to generate path based sockets,
58+ # instead of the previous abstract sockets.
59+ # https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14/NEWS#L64
60+ if testlib.dpkg_compare_installed_version('dbus', 'ge', '1.14.4') and testlib.dpkg_compare_installed_version('apparmor', 'lt', '3.1.0'):
61+ self._apply_patch('tests-force-dbus-daemon-to-generate-an-abstract-sock.patch')
62+
63 print("done")
64
65 def _prepare_old_trusty_source(self):

Subscribers

People subscribed via source and target branches