aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Daudt <kdaudt@alpinelinux.org>2022-04-30 17:02:21 +0000
committerKevin Daudt <kdaudt@alpinelinux.org>2022-05-02 04:50:59 +0000
commit754e78145f8713a959bd1fd7a681927c2cae8e37 (patch)
tree43ea85a308420247d59f068b29c452fe63bb009b
parentbf78e57395d392ca297ec9c590223f2af074d732 (diff)
downloadaports-754e78145f8713a959bd1fd7a681927c2cae8e37.tar.gz
aports-754e78145f8713a959bd1fd7a681927c2cae8e37.tar.bz2
aports-754e78145f8713a959bd1fd7a681927c2cae8e37.tar.xz
main/nginx: prevent forking in the global scope
The `_add_module` function is called in the global scope and invokes grep. We generally want to avoid forking calls in the global scope if poossible, so replace the grep call with a case statement which achieves the same. Verified that `$_extra_flags` remains the same (no duplicate entries).
-rw-r--r--main/nginx/APKBUILD7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
index dfa400008d..93f3f43fc7 100644
--- a/main/nginx/APKBUILD
+++ b/main/nginx/APKBUILD
@@ -131,7 +131,12 @@ _add_module() {
# Don't add new flag and source if it's already there, i.e. two or more
# modules share the same source (e.g. geoip2 that provides http-geoip2
# and stream-geoip2).
- if ! printf '%s\n' $_extra_flags | grep -qFw "$srcdir/$dirname"; then
+ local present=false
+ case "$_extra_flags" in
+ *="$srcdir/$dirname"*) present=true;;
+ esac
+
+ if ! $present; then
source="$source $dirname.tar.gz::$url/archive/$ver.tar.gz"
# $source must be always in-sync with $sha512sums, so we have to
# add there source of a module that is disabled on the current arch.