All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/3] find_api_violations: fix sed expression
Date: Sat, 09 May 2020 09:29:43 -0700	[thread overview]
Message-ID: <158904178381.982835.124483584305094681.stgit@magnolia> (raw)
In-Reply-To: <158904177147.982835.3876574696663645345.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Apparently, the grep program in Ubuntu 20.04 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 <darrick.wong@oracle.com>
---
 tools/find-api-violations.sh |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)


diff --git a/tools/find-api-violations.sh b/tools/find-api-violations.sh
index b175ca10..c25fccca 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


  parent reply	other threads:[~2020-05-09 16:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 16:29 [PATCH 0/3] xfsprogs: random fixes Darrick J. Wong
2020-05-09 16:29 ` [PATCH 1/3] libxcmd: don't crash if el_gets returns null Darrick J. Wong
2020-05-09 16:36   ` Christoph Hellwig
2020-05-09 16:29 ` Darrick J. Wong [this message]
2020-05-09 16:36   ` [PATCH 2/3] find_api_violations: fix sed expression Christoph Hellwig
2020-05-09 16:38     ` Darrick J. Wong
2020-05-09 16:44       ` Christoph Hellwig
2020-05-09 17:10         ` Eric Sandeen
2020-05-09 16:29 ` [PATCH 3/3] xfs_db: bounds-check access to the dbmap array Darrick J. Wong
2020-05-09 16:37   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158904178381.982835.124483584305094681.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.