From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by dpdk.org (Postfix) with ESMTP id 8FE45FEB for ; Mon, 13 Aug 2018 17:48:04 +0200 (CEST) Received: by mail-pl0-f67.google.com with SMTP id g6-v6so7042677plq.9 for ; Mon, 13 Aug 2018 08:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=bN7P3r9K+53ZIpRkC+EThHC3K4yr6TBfhtmb4vGI2As=; b=b/G3RSXMTmMbThVbuvM83kqzvOUO58Ru0HYa7OJH1SfDSix+g7VahHFOvbDpNi4cr8 /LgpCFlVBy4+foaWTgQrgxkxNp8wGxgZxg2dgxxOt+cCklw3W5ps0s9lEIDwwO+5ugeO HFzMEgvSzCm87DVlmrz97MdrRxQVC9wRhltSuiAzXIRraA96aDOCAb3pZvqPfkuu6DiW qV/TLlitxr+Q4oM06AcFshCDAKy6F41mmDnKvmunnFKZO/Yk+ZuQ5v3RwMHaDD68MglK lkoLQHkcNOmq0B2GiySIVgRCFWqw85jJwtxIb0n5xnxKQxZ6RQzcU0M0SyBoJdvIjAHd iVmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bN7P3r9K+53ZIpRkC+EThHC3K4yr6TBfhtmb4vGI2As=; b=ZXBoNzBRfpj+DcxbfoKjue1mUrx7bT88CGsCTdfB+FfDPtdFzs+re9wxkaIuFBRaRc WnyRgQQRxM8o2Tx0ZzepM5JonUZcpj2Mhmd+nid4Aw5kASGYbcLcKKta7pkKDqmgXjod +pntskRVOOjuFhDq7UPBPI+utfyzztd1DhNO/wl2nssL6FDwWFXlgEKW74VGCJuKti6W krlF2El+ak3UYcke53r1O0bPAGvvW9xhqRhwDAu3jzRyOi+ei/xGbkTqPZLfkDVXbAeC t1Un4XrpHA3wW05PzTTYNEmmUhkxuBqofB1oxFq/zjv8RiiHulHnNGIvOynhfsrmbNqe 2GBw== X-Gm-Message-State: AOUpUlHUfuT0fKZtQIvOuGHbsyuP1tbRbXS7cu5ZoxmG4ajT2/zo+0SK /o8exuNiEzuR+280sxberLmskD0AgDo= X-Google-Smtp-Source: AA+uWPyZdjVqO0pafttC2oFwbYJ58v6cQNtNKwjD/IXE8lAO/Wl+PmmhReBlfnzU8TtH21ARlBQWTA== X-Received: by 2002:a17:902:e28b:: with SMTP id cf11-v6mr17317996plb.86.1534175283354; Mon, 13 Aug 2018 08:48:03 -0700 (PDT) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d19-v6sm56735973pfe.42.2018.08.13.08.48.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 08:48:02 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 13 Aug 2018 08:47:55 -0700 Message-Id: <20180813154755.6313-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH] checkpatches: don't assume bash syntax X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2018 15:48:04 -0000 The read -d option is a bash extension and not avaiable in other shells. On Debian, /bin/sh is dash and checktpatches would fail with: ./devtools/checkpatches.sh: 52: read: Illegal option -d Fix by using awk -e and adding necessary double backslash. Fixes: 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs") Signed-off-by: Stephen Hemminger --- devtools/checkpatches.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index ba795ad1dc36..c63162678538 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -49,7 +49,7 @@ check_forbidden_additions() { # - No search is done inside comments # - Both additions and removals of the expressions are checked # A positive balance of additions fails the check - read -d '' awk_script << 'EOF' + awk -e ' BEGIN { split(FOLDERS,deny_folders," "); split(EXPRESSIONS,deny_expr," "); @@ -70,7 +70,7 @@ check_forbidden_additions() { # non comment code if (in_comment == 0) { for (i in deny_expr) { - forbidden_added = "^\+.*" deny_expr[i]; + forbidden_added = "^\\+.*" deny_expr[i]; forbidden_removed="^-.*" deny_expr[i]; current = expressions[deny_expr[i]] if ($0 ~ forbidden_added) { @@ -90,13 +90,13 @@ check_forbidden_additions() { } # switch to next file , check if the balance of add/remove # of previous filehad new additions - ($0 ~ "^\+\+\+ b/") { + ($0 ~ "^\\+\\+\\+ b/") { in_file = 0; if (count > 0) { exit; } for (i in deny_folders) { - re = "^\+\+\+ b/" deny_folders[i]; + re = "^\\+\\+\\+ b/" deny_folders[i]; if ($0 ~ deny_folders[i]) { in_file = 1 last_file = $0 @@ -115,14 +115,8 @@ check_forbidden_additions() { exit RET_ON_FAIL } } -EOF - # --------------------------------- - # refrain from new additions of rte_panic() and rte_exit() - # multiple folders and expressions are separated by spaces - awk -v FOLDERS="lib drivers" \ - -v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \ - -v RET_ON_FAIL=1 \ - "$awk_script" - +' -v FOLDERS="lib drivers" -v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \ + -v RET_ON_FAIL=1 } number=0 -- 2.18.0