From 4e06ea78166c181cad37a6f9e3b8880719d6d386 Mon Sep 17 00:00:00 2001 From: Matthias Stecher Date: Tue, 20 Oct 2020 17:03:14 +0200 Subject: [PATCH] __lxc_container: no grep ERE used, switching to BRE When checking for lxc configuration that should be removed, it says to grep to use extended regular expressions (ERE). But there are no characters not covered by basic regular expressions (BRE). So switching to to BRE, as it may not match user input as regex. --- cdist/conf/type/__lxc_container/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__lxc_container/gencode-remote b/cdist/conf/type/__lxc_container/gencode-remote index 42e1e43e..6bef504e 100755 --- a/cdist/conf/type/__lxc_container/gencode-remote +++ b/cdist/conf/type/__lxc_container/gencode-remote @@ -207,10 +207,10 @@ DONE # check if smth. to be deleted # must be before adding, because it takes the content of the original file # because 'cat $file > $file' will not work (> opens before command reads it) - # will create extended regex pattern for grep with malformed spaces + # will create a basic regex pattern for grep to ignore malformed spaces if [ -s "$__object/files/config.del" ]; then cat < "\$tmpconfig" +grep -v -f - <<'ABSENT' "$container_config" > "\$tmpconfig" $(awk -v FS=' = ' -v OFS=' = ' -v blank='[[:blank:]]*' ' function ntostring(n) { ret=""; for(i=n; i<=NF; i++) ret=ret $i (i