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
diff --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
0new file mode 1006440new file mode 100644
index 0000000..9d47cb7
--- /dev/null
+++ b/scripts/apparmor/patches/tests-force-dbus-daemon-to-generate-an-abstract-sock.patch
@@ -0,0 +1,41 @@
1From d73e244ed71b0b4f69b96a4cfe06ced399552337 Mon Sep 17 00:00:00 2001
2From: Georgia Garcia <georgia.garcia@canonical.com>
3Date: Tue, 28 Mar 2023 14:23:01 +0000
4Subject: [PATCH] Merge tests: force dbus-daemon to generate an abstract socket
5
6dbus 1.14.4 changed the behavior of unix:tmpdir to be equivalent to
7unix:dir, which cases dbus-daemon to generate path based sockets,
8instead of the previous abstract sockets. [1]
9In this change we force dbus-daemon to generate an abstract socket by
10specifying the abstract socket address in the command.
11
12[1] https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14/NEWS#L64
13
14MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/999
15Approved-by: John Johansen <john@jjmx.net>
16Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
17
18(cherry picked from commit 904b7339482765551d3039cb74313a9afef29a79)
19
2053d4e341 tests: force dbus-daemon to generate an abstract socket
21---
22 tests/regression/apparmor/dbus.inc | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25diff --git a/tests/regression/apparmor/dbus.inc b/tests/regression/apparmor/dbus.inc
26index b234a348f..8055fb733 100755
27--- a/tests/regression/apparmor/dbus.inc
28+++ b/tests/regression/apparmor/dbus.inc
29@@ -32,7 +32,8 @@ set_dbus_var()
30
31 start_bus()
32 {
33- out=$(dbus-daemon --fork --print-pid --print-address --config-file=dbus.conf)
34+ bus_addr=$(mktemp --dry-run /tmp/dbus-XXXXXX)
35+ out=$(dbus-daemon --fork --print-pid --print-address --address="unix:abstract=$bus_addr" --config-file=dbus.conf)
36 if [ $? -ne 0 ]
37 then
38 fatalerror "Failed to start DBus daemon"
39--
402.34.1
41
diff --git a/scripts/test-apparmor.py b/scripts/test-apparmor.py
index a51bba4..a5f1910 100755
--- a/scripts/test-apparmor.py
+++ b/scripts/test-apparmor.py
@@ -1813,6 +1813,13 @@ class ApparmorTestsuites(testlib.TestlibCase):
1813 if testlib.dpkg_compare_installed_version('apparmor', 'ge', '3.0.4-2ubuntu2.2'):1813 if testlib.dpkg_compare_installed_version('apparmor', 'ge', '3.0.4-2ubuntu2.2'):
1814 self._apply_patch('tests-fix-variable-type-for-getopt.patch')1814 self._apply_patch('tests-fix-variable-type-for-getopt.patch')
18151815
1816 # dbus 1.14.4 changed the behavior of unix:tmpdir to be equivalent to
1817 # unix:dir, which cases dbus-daemon to generate path based sockets,
1818 # instead of the previous abstract sockets.
1819 # https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14/NEWS#L64
1820 if testlib.dpkg_compare_installed_version('dbus', 'ge', '1.14.4') and testlib.dpkg_compare_installed_version('apparmor', 'lt', '3.1.0'):
1821 self._apply_patch('tests-force-dbus-daemon-to-generate-an-abstract-sock.patch')
1822
1816 print("done")1823 print("done")
18171824
1818 def _prepare_old_trusty_source(self):1825 def _prepare_old_trusty_source(self):

Subscribers

People subscribed via source and target branches