0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 12764faa0a01bcc4e0ffc92ce308985dbad0d954 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Aduskett@gmail.com>
  3. Date: Thu, 7 May 2020 18:25:29 -0700
  4. Subject: [PATCH] fix regex in rc.apparmor.functions to work with busybox
  5. The following regex string in rc.apparmor.functions
  6. "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to
  7. the unescaped {. GNU grep ignores the error. However, the Busybox grep does
  8. not and throws the error "unescaped character {"
  9. Escape the "{" character to fix this issue.
  10. Note: Upstream has rewritten large sections of the rc.apparmor.functions file
  11. and the function this patch fixes will no longer be necessary after the next
  12. version is released.
  13. Signed-off-by: Adam Duskett <Aduskett@gmail.com>
  14. ---
  15. parser/rc.apparmor.functions | 2 +-
  16. 1 file changed, 1 insertion(+), 1 deletion(-)
  17. diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions
  18. index f3108f8..db0697c 100644
  19. --- a/parser/rc.apparmor.functions
  20. +++ b/parser/rc.apparmor.functions
  21. @@ -140,7 +140,7 @@ force_complain() {
  22. local profile=$1
  23. # if profile not in complain mode
  24. - if ! egrep -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" $profile ; then
  25. + if ! grep -E -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+\{" $profile ; then
  26. local link="${PROFILE_DIR}/force-complain/`basename ${profile}`"
  27. if [ -e "$link" ] ; then
  28. aa_log_warning_msg "found $link, forcing complain mode"
  29. --
  30. 2.26.2