Fix regexp detection

In a case exprssion, `|` separates patterns so it needs to be quoted.
Also `\` was not actually part of the set since it was quoting another
character.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-09-29 23:48:39 +02:00
parent b7bb068b84
commit c5714bb4ea

View file

@ -862,7 +862,7 @@ need_grep=
case "$FILTER" in
'^$') simple_filter=;;
'.*') simple_filter='*';;
*[][\$^+*?{|}]*) # Regexp special characters (other than .), we need grep
*[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep
need_grep=1;;
*) # No regexp or shell-pattern special character
simple_filter="*$FILTER*";;
@ -870,7 +870,7 @@ esac
case "$EXCLUDE" in
'^$') simple_exclude=;;
'.*') simple_exclude='*';;
*[][\$^+*?{|}]*) # Regexp special characters (other than .), we need grep
*[][$+*?\\^{\|}]*) # Regexp special characters (other than .), we need grep
need_grep=1;;
*) # No regexp or shell-pattern special character
simple_exclude="*$EXCLUDE*";;