build: set default att to "" when not enabled.

It fixes various issues with multiple / that are not collapsed in they canonical form in file rules

See https://gitlab.com/apparmor/apparmor/-/issues/450#note_2158840105
This commit is contained in:
Alexandre Pujol 2025-09-01 15:12:30 +02:00
parent 4f9d2703d4
commit 7c6f776757
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 2 additions and 4 deletions

View file

@ -69,7 +69,6 @@
# Default attachment path when re-attached path disconnected path is ignored. # Default attachment path when re-attached path disconnected path is ignored.
# Disabled on abi3 and Ubuntu 25.04+ # Disabled on abi3 and Ubuntu 25.04+
# See https://apparmor.pujol.io/development/internal/#re-attached-path # See https://apparmor.pujol.io/development/internal/#re-attached-path
@{att}=/ @{att}=""
alias / -> //,
# vim:syntax=apparmor # vim:syntax=apparmor

View file

@ -32,7 +32,6 @@ func (p ReAttach) Apply() ([]string, error) {
if err != nil { if err != nil {
return res, err return res, err
} }
out = strings.ReplaceAll(out, "@{att}=/", "# @{att}=/") out = strings.ReplaceAll(out, `@{att}=""`, `# @{att}=""`)
out = strings.ReplaceAll(out, "alias / -> //,", "#alias / -> //,")
return res, path.WriteFile([]byte(out)) return res, path.WriteFile([]byte(out))
} }