Run callbacks in a subshell to protect variables

This commit is contained in:
Pierre Pronchery 2019-03-28 15:31:34 +01:00
parent 3e2dab6aa0
commit f5151f322a

View File

@ -74,7 +74,7 @@ _fixme()
;; ;;
esac esac
[ -n "$callback" ] || continue [ -n "$callback" ] || continue
$callback "$filename" 2>&1 ($callback "$filename") 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "$PROGNAME: $filename: FAIL" 1>&2 echo "$PROGNAME: $filename: FAIL" 1>&2
ret=2 ret=2
@ -86,31 +86,31 @@ _fixme()
_fixme_asm() _fixme_asm()
{ {
retc=0 ret=0
filename="$1" filename="$1"
#warnings #warnings
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename" $GREP -nH '/\*.*\(TODO\|XXX\)' "$filename"
#failures #failures
$GREP -nH '/\*.*FIXME' "$filename" && retc=2 $GREP -nH '/\*.*FIXME' "$filename" && ret=2
return $retc return $ret
} }
_fixme_c() _fixme_c()
{ {
retc=0 ret=0
filename="$1" filename="$1"
#warnings #warnings
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename" $GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename"
#failures #failures
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && retc=2 $GREP -nH '/\(/\|\*\).*FIXME' "$filename" && ret=2
return $retc return $ret
} }
_fixme_sh() _fixme_sh()
{ {
retsh=0 ret=0
filename="$1" filename="$1"
#XXX avoid matching the regexp #XXX avoid matching the regexp
comment="#" comment="#"
@ -118,8 +118,8 @@ _fixme_sh()
#warnings #warnings
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename" $GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename"
#failures #failures
$GREP -nH "$comment.*FIXME" "$filename" && retsh=2 $GREP -nH "$comment.*FIXME" "$filename" && ret=2
return $retsh return $ret
} }