From: Darrick J. Wong Date: Sat, 9 May 2020 17:11:42 +0000 (-0400) Subject: find_api_violations: fix sed expression X-Git-Tag: xfsprogs-5.7-fixes_2020-06-25~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c4d190ebb1600fabaa76d564cb545510198aed9;p=thirdparty%2Fxfsprogs-dev.git find_api_violations: fix sed expression Apparently, GNU grep version 3.4 is pickier about requiring '(' to be escaped inside range expressions. This causes a regression in xfs/437, so fix it. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig [sandeen: note grep version not OS version] Signed-off-by: Eric Sandeen --- diff --git a/tools/find-api-violations.sh b/tools/find-api-violations.sh index b175ca100..c25fccca1 100755 --- a/tools/find-api-violations.sh +++ b/tools/find-api-violations.sh @@ -18,8 +18,14 @@ check_if_api_calls() { while read f; do grep "^$f(" libxfs/*.c; done | sed -e 's/^.*:xfs_/xfs_/g' -e 's/.$//g' } +# Generate a grep search expression for troublesome API call sites. +# " foo(", ",foo(", "-foo(", and "(foo(" are examples. +grep_pattern() { + sed -e 's/^/[[:space:],-\\(]/g' -e 's/$/(/g' +} + find_libxfs_violations() { - grep -r -n -f <(find_possible_api_calls | check_if_api_calls | sed -e 's/^/[[:space:],-(]/g' -e 's/$/(/g' ) $tool_dirs + grep -r -n -f <(find_possible_api_calls | check_if_api_calls | grep_pattern) $tool_dirs } # libxfs calls without negated error codes @@ -33,7 +39,7 @@ find_possible_libxfs_api_calls() { } find_libxfs_api_violations() { - grep -r -n -f <(find_possible_libxfs_api_calls | sed -e 's/^/[[:space:],-(]/g' -e 's/$/(/g') $tool_dirs + grep -r -n -f <(find_possible_libxfs_api_calls | grep_pattern) $tool_dirs } (find_libxfs_violations ; find_errcode_violations ; find_libxfs_api_violations) | sort -g -t ':' -k 2 | sort -g -t ':' -k 1 | uniq