From fbf154b8607ce5e9b751838af9d921874e0daea8 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sat, 24 Feb 2024 17:02:43 +0000 Subject: [PATCH] fix(build): ensure the build system has support for empty profile. --- pkg/prebuild/directives.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/prebuild/directives.go b/pkg/prebuild/directives.go index de45fe3e..05fbd85d 100644 --- a/pkg/prebuild/directives.go +++ b/pkg/prebuild/directives.go @@ -35,8 +35,6 @@ type DirectiveFunc func(*paths.Path, string) string // # dbus: own bus=session name=org.freedesktop.FileManager1 // # dbus: talk name=org.freedesktop.login1 label=systemd-logind func DirectiveDbus(file *paths.Path, profile string) string { - const lenHeader = 12 // len("profile {\n ") - var p *aa.AppArmorProfile for _, match := range regDbus.FindAllStringSubmatch(profile, -1) { origin := match[0] @@ -61,7 +59,7 @@ func DirectiveDbus(file *paths.Path, profile string) string { generatedDbus := p.String() lenDbus := len(generatedDbus) - generatedDbus = generatedDbus[lenHeader : lenDbus-3] + generatedDbus = generatedDbus[:lenDbus-1] profile = strings.Replace(profile, origin, generatedDbus, -1) } return profile