package/apparmor: replace deprecated egrep with grep -E
PATCH 1/5 package/apparmor: replace deprecated egrep with grep -E
From: Adam Duskett <[email protected]>
Upstream commit: 5f46dedd6e8109d845af118b36039a5d7dd05af9
--- ...replace-deprecated-egrep-with-grep-e.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 package/apparmor/0002-replace-deprecated-egrep-with-grep-e.patch
package/apparmor/0002-replace-deprecated-egrep-with-grep-e.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 5f46dedd6e8109d845af118b36039a5d7dd05af9 Mon Sep 17 00:00:00 2001 +From: Christian Boltz <[email protected]> +Date: Mon, 18 Mar 2019 19:17:16 +0100 +Subject: [PATCH] replace deprecated egrep with grep -e + +(cherry picked from commit 5f46dedd6e8109d845af118b36039a5d7dd05af9) +Signed-off-by: Christian Boltz <[email protected]> +Signed-off-by: Adam Duskett <[email protected]> +--- + parser/rc.apparmor.functions | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions +index 22e8367..f3108f8 100644 +--- a/parser/rc.apparmor.functions ++++ b/parser/rc.apparmor.functions +@@ -129,7 +129,7 @@ skip_profile() { + "${profile%.pacnew}" != "${profile}" ] ; then + return 2 + fi +- if echo "${profile}" | egrep -q '^.+\.new-[0-9\.]+_[0-9]+$'; then ++ if echo "${profile}" | grep -E -q '^.+\.new-[0-9\.]+_[0-9]+$'; then + return 2 + fi + +-- +2.26.2 +
Signature · 1 line
2.26.2
PATCH 2/5 package/apparmor: fix compatibility with busybox grep
From: Adam Duskett <[email protected]>
The following regex string in rc.apparmor.functions
"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to the unescaped { at the end of the regex pattern.
GNU grep ignors the error. However, the Busybox grep does not and throws the error "unescaped character {"
Escape the "{" character to fix this issue.
Note: Upstream has rewritten large sections of the rc.apparmor.functions file and the function this patch fixes will no longer be necessary after the next version is released. However, it is not possible to easily backport the upstream patches as the rewrite comes with new features that would not be possible with a simple patch such as this one.
--- ...apparmor.functions-to-work-with-busy.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patch
package/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patch new file +37 -0
@@ -0,0 +1,37 @@ +From 12764faa0a01bcc4e0ffc92ce308985dbad0d954 Mon Sep 17 00:00:00 2001 +From: Adam Duskett <[email protected]> +Date: Thu, 7 May 2020 18:25:29 -0700 +Subject: [PATCH] fix regex in rc.apparmor.functions to work with busybox + +The following regex string in rc.apparmor.functions +"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to +the unescaped {. GNU grep ignores the error. However, the Busybox grep does +not and throws the error "unescaped character {" + +Escape the "{" character to fix this issue. + +Note: Upstream has rewritten large sections of the rc.apparmor.functions file +and the function this patch fixes will no longer be necessary after the next +version is released. + +Signed-off-by: Adam Duskett <[email protected]> +--- + parser/rc.apparmor.functions | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions +index f3108f8..db0697c 100644 +--- a/parser/rc.apparmor.functions ++++ b/parser/rc.apparmor.functions +@@ -140,7 +140,7 @@ force_complain() { + local profile=$1 + + # if profile not in complain mode +- if ! egrep -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" $profile ; then ++ if ! grep -E -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+\{" $profile ; then + local link="${PROFILE_DIR}/force-complain/`basename ${profile}`" + if [ -e "$link" ] ; then + aa_log_warning_msg "found $link, forcing complain mode" +-- +2.26.2 +
Signature · 1 line
2.26.2
PATCH 2/5 package/apparmor: fix compatibility with busybox grep
Adam, All,
Quoted 8 lines · On Fri, May 8, 2020 at 4:00 AM <[email protected]> wrote:
From: Adam Duskett <[email protected]>
The following regex string in rc.apparmor.functions
"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to the unescaped { at the end of the regex pattern.
GNU grep ignors the error. However, the Busybox grep does not and throws the error "unescaped character {"
Indeed, my original series had:
select BR2_PACKAGE_GREP
to overcome this issue but it went somewhat missing.
Quoted 65 lines
Escape the "{" character to fix this issue.
Note: Upstream has rewritten large sections of the rc.apparmor.functions file and the function this patch fixes will no longer be necessary after the next version is released. However, it is not possible to easily backport the upstream patches as the rewrite comes with new features that would not be possible with a simple patch such as this one.
Signed-off-by Adam Duskett <[email protected]>--- ...apparmor.functions-to-work-with-busy.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patchpackage/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patch new file +37
-1@@ -0,0 +1,37 @@ +From 12764faa0a01bcc4e0ffc92ce308985dbad0d954 Mon Sep 17 00:00:00 2001 +From: Adam Duskett <[email protected]> +Date: Thu, 7 May 2020 18:25:29 -0700 +Subject: [PATCH] fix regex in rc.apparmor.functions to work with busybox + +The following regex string in rc.apparmor.functions +"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to +the unescaped {. GNU grep ignores the error. However, the Busybox grep does +not and throws the error "unescaped character {" + +Escape the "{" character to fix this issue. + +Note: Upstream has rewritten large sections of the rc.apparmor.functions file +and the function this patch fixes will no longer be necessary after the next +version is released. + +Signed-off-by: Adam Duskett <[email protected]> +--- + parser/rc.apparmor.functions | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions +index f3108f8..db0697c 100644 +--- a/parser/rc.apparmor.functions ++++ b/parser/rc.apparmor.functions +@@ -140,7 +140,7 @@ force_complain() { + local profile=$1 + + # if profile not in complain mode +- if ! egrep -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" $profile ; then ++ if ! grep -E -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+\{" $profile ; then + local link="${PROFILE_DIR}/force-complain/`basename ${profile}`" + if [ -e "$link" ] ; then + aa_log_warning_msg "found $link, forcing complain mode" +-- +2.26.2 + --2.26.2
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 2/5 package/apparmor: fix compatibility with busybox grep
Adam, Angelo, All,
On 2020-05-08 08:32 +0200, Angelo Compagnucci spake thusly:
Quoted 10 lines · On Fri, May 8, 2020 at 4:00 AM <[email protected]> wrote:
Quoted 8 lines
From: Adam Duskett <[email protected]>
The following regex string in rc.apparmor.functions
"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to the unescaped { at the end of the regex pattern.
GNU grep ignors the error. However, the Busybox grep does not and throws the error "unescaped character {"
Quoted 3 lines
Indeed, my original series had:
selectBR2_PACKAGE_GREP
to overcome this issue but it went somewhat missing.
I dropped it in my rework of the series, because there was no explanations why it was needed.
In the end, I did apply Adam's patch, because:
- it is simple enough and correct,
- we will notice it no longer applies when we bump the version, and so can drop it.
If we 'd have gone for selecting the full grep, we would not have noticed that it would no longer needed when we update, later.
Thanks.
Regards,
Yann E. MORIN.
Quoted 64 lines
Quoted 64 lines
Escape the "{" character to fix this issue.
Note: Upstream has rewritten large sections of the rc.apparmor.functions file and the function this patch fixes will no longer be necessary after the next version is released. However, it is not possible to easily backport the upstream patches as the rewrite comes with new features that would not be possible with a simple patch such as this one.
Signed-off-by Adam Duskett <[email protected]>--- ...apparmor.functions-to-work-with-busy.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patchpackage/apparmor/0003-fix-regex-in-rc.apparmor.functions-to-work-with-busy.patch new file +37
-1@@ -0,0 +1,37 @@ +From 12764faa0a01bcc4e0ffc92ce308985dbad0d954 Mon Sep 17 00:00:00 2001 +From: Adam Duskett <[email protected]> +Date: Thu, 7 May 2020 18:25:29 -0700 +Subject: [PATCH] fix regex in rc.apparmor.functions to work with busybox + +The following regex string in rc.apparmor.functions +"^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" is broken due to +the unescaped {. GNU grep ignores the error. However, the Busybox grep does +not and throws the error "unescaped character {" + +Escape the "{" character to fix this issue. + +Note: Upstream has rewritten large sections of the rc.apparmor.functions file +and the function this patch fixes will no longer be necessary after the next +version is released. + +Signed-off-by: Adam Duskett <[email protected]> +--- + parser/rc.apparmor.functions | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions +index f3108f8..db0697c 100644 +--- a/parser/rc.apparmor.functions ++++ b/parser/rc.apparmor.functions +@@ -140,7 +140,7 @@ force_complain() { + local profile=$1 + + # if profile not in complain mode +- if ! egrep -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" $profile ; then ++ if ! grep -E -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+\{" $profile ; then + local link="${PROFILE_DIR}/force-complain/`basename ${profile}`" + if [ -e "$link" ] ; then + aa_log_warning_msg "found $link, forcing complain mode" +-- +2.26.2 + --2.26.2
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 3/5 package/apparmor: fix typo in Config.in
In reply to aduskett at gmail.comFrom: Adam Duskett <[email protected]>
pyhon should be python
--- package/apparmor/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/apparmor/Config.in +1 -1
@@ -34,7 +34,7 @@ config BR2_PACKAGE_APPARMOR_UTILS depends on BR2_PACKAGE_PYTHON3 select BR2_PACKAGE_PYTHON3_READLINE help - A set of utilities (written in pyhon): + A set of utilities (written in python): aa-audit aa-disable aa-logprof aa-autodep aa-easyprof aa-mergeprof aa-cleanprof aa-enforce aa-status
Signature · 1 line
2.26.2
PATCH 4/5 package/apparmor: add a dependency on net-tools if utils is selected
In reply to aduskett at gmail.comFrom: Adam Duskett <[email protected]>
aa-unconfied requires the full version of netstat provided by the net-tools package. Without the full version, running aa-unconfined will result in the error:
netstat: invalid option -- 'p'
--- package/apparmor/Config.in | 2 ++ 1 file changed, 2 insertions(+)
package/apparmor/Config.in +2 -0
@@ -31,8 +31,10 @@ comment "utils need python3" config BR2_PACKAGE_APPARMOR_UTILS bool "utils" + depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS depends on BR2_PACKAGE_PYTHON3 select BR2_PACKAGE_PYTHON3_READLINE + select BR2_PACKAGE_NET_TOOLS # aa-unconfined help A set of utilities (written in python): aa-audit aa-disable aa-logprof
Signature · 1 line
2.26.2
PATCH 5/5 package/systemd: add support for apparmor
In reply to aduskett at gmail.comFrom: Adam Duskett <[email protected]>
If libapparmor is selected, depend on libapparmor and set -Dapparmor=true
--- package/systemd/systemd.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/systemd/systemd.mk +7 -0
@@ -49,6 +49,13 @@ else SYSTEMD_CONF_OPTS += -Dacl=false endif +ifeq ($(BR2_PACKAGE_LIBAPPARMOR),y) +SYSTEMD_DEPENDENCIES += libapparmor +SYSTEMD_CONF_OPTS += -Dapparmor=true +else +SYSTEMD_CONF_OPTS += -Dapparmor=false +endif + ifeq ($(BR2_PACKAGE_AUDIT),y) SYSTEMD_DEPENDENCIES += audit SYSTEMD_CONF_OPTS += -Daudit=true
Signature · 1 line
2.26.2
Thomas Petazzoni
AppliedPATCH 5/5 package/systemd: add support for apparmor
Quoted 8 lines · On Thu, 7 May 2020 18:59:56 -0700 aduskett at gmail.com wrote:
From: Adam Duskett <[email protected]>
If libapparmor is selected, depend on libapparmor and set -Dapparmor=true
Signed-off-by Adam Duskett <[email protected]>--- package/systemd/systemd.mk | 7 +++++++ 1 file changed, 7 insertions(+)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/5 package/apparmor: replace deprecated egrep with grep -E
In reply to aduskett at gmail.comAdam, All,
On 2020-05-07 18:59 -0700, aduskett at gmail.com spake thusly:
Quoted 5 lines
From: Adam Duskett <[email protected]>
Upstream commit:
5f46dedd6e8109d845af118b36039a5d7dd05af9Signed-off-by Adam Duskett <[email protected]>
Patches 1-4 applied to master, thanks. See a few replies to patch 2 and 4.
I've not (yet) applied patch 5, because it is sitting somewhere between being a feature-patch and being a fix. If is a feature-patch because it allows building systemnd with apparmor support, while it is a fix because it guarantees build ordering now... So saying I'm torn onthat one is a bit strong, but still I am not sure either...
Regards,
Yann E. MORIN.
Quoted 42 lines
--- ...replace-deprecated-egrep-with-grep-e.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 package/apparmor/0002-replace-deprecated-egrep-with-grep-e.patchpackage/apparmor/0002-replace-deprecated-egrep-with-grep-e.patch new file +28
-0@@ -0,0 +1,28 @@ +From 5f46dedd6e8109d845af118b36039a5d7dd05af9 Mon Sep 17 00:00:00 2001 +From: Christian Boltz <[email protected]> +Date: Mon, 18 Mar 2019 19:17:16 +0100 +Subject: [PATCH] replace deprecated egrep with grep -e + +(cherry picked from commit 5f46dedd6e8109d845af118b36039a5d7dd05af9) +Signed-off-by: Christian Boltz <[email protected]> +Signed-off-by: Adam Duskett <[email protected]> +--- + parser/rc.apparmor.functions | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions +index 22e8367..f3108f8 100644 +--- a/parser/rc.apparmor.functions ++++ b/parser/rc.apparmor.functions +@@ -129,7 +129,7 @@ skip_profile() { + "${profile%.pacnew}" != "${profile}" ] ; then + return 2 + fi +- if echo "${profile}" | egrep -q '^.+\.new-[0-9\.]+_[0-9]+$'; then ++ if echo "${profile}" | grep -E -q '^.+\.new-[0-9\.]+_[0-9]+$'; then + return 2 + fi + +-- +2.26.2 +Signature · 1 line
2.26.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/5 package/apparmor: replace deprecated egrep with grep -E
Quoted 5 lines · On Fri, 8 May 2020 10:14:49 +0200 "Yann E. MORIN" <[email protected]>…
I've not (yet) applied patch 5, because it is sitting somewhere between being a feature-patch and being a fix. If is a feature-patch because it allows building systemnd with apparmor support, while it is a fix because it guarantees build ordering now... So saying I'm torn onthat one is a bit strong, but still I am not sure either...
I've decided for you, and applied it to master :-)
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com