From fc8dded8e96c026d37d36140fcd00699413c564f Mon Sep 17 00:00:00 2001 From: uqam-fob Date: Fri, 29 Dec 2017 11:09:06 -0500 Subject: [PATCH] __line: Support regex beginning with an hyphen (fixes #607) (#608) If `regex` begins with an hyphen, `grep` treats it as an option and treats `file` as the regular expression. This leads to `grep` trying to read from the standard input and making it wait infinitely. This patch adds the missing argument breaker `--` and allows `regex` to begin with an hyphen (provided it is called correctly). --- cdist/conf/type/__line/explorer/state | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__line/explorer/state b/cdist/conf/type/__line/explorer/state index d04d5d09..08056c86 100755 --- a/cdist/conf/type/__line/explorer/state +++ b/cdist/conf/type/__line/explorer/state @@ -35,7 +35,7 @@ else fi # Allow missing file - thus 2>/dev/null -if grep -q $greparg "$regex" "$file" 2>/dev/null; then +if grep -q $greparg -- "$regex" "$file" 2>/dev/null; then echo present else echo absent