From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2C3B14596C; Thu, 12 Sep 2024 10:27:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFFDA40E8A; Thu, 12 Sep 2024 10:27:06 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id EE70840E50 for ; Thu, 12 Sep 2024 10:27:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726129620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HVKz2BSCuZ+nezXYK17wP8J+/NbyCQkD1lPRA3wFDgE=; b=bVm+xQdizyXGL4MTb2NH6AE996w2it2C1s8wREiVoXsC1dG072r0BYq36qNhCpBGzq4pXE fByqKNeQVZ0BPfMkt2BaTXO0Xl+Hnmo7OF1M5PRa0EOdze8suLAMKXX2wLV/J/76o2gYhb 4p5Vh7rqGfgCpaYscnvejjgBQUXVwJ0= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-282-KHJK2A6rNJ-q_pk7nwdtJw-1; Thu, 12 Sep 2024 04:26:56 -0400 X-MC-Unique: KHJK2A6rNJ-q_pk7nwdtJw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7D0B21955F44; Thu, 12 Sep 2024 08:26:55 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.230]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6CFC919560AB; Thu, 12 Sep 2024 08:26:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Thomas Monjalon , Andrzej Ostruszka , Arnon Warshavsky Subject: [PATCH v2 01/14] devtools: fix forbidden token check with multiple files Date: Thu, 12 Sep 2024 10:26:27 +0200 Message-ID: <20240912082643.1532679-2-david.marchand@redhat.com> In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com> References: <20240907145433.1479091-1-david.marchand@redhat.com> <20240912082643.1532679-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If a patch contains multiple files, it is possible to pass through the check because the count of token mentions is not reset between file evaluation. Example with a fake patch: $ cat toto.patch --- a/drivers/plop1 +++ b/drivers/plop1 - RTE_LOG( - RTE_LOG( + RTE_LOG( --- a/drivers/plop2 +++ b/drivers/plop2 + RTE_LOG( $ awk -v FOLDERS='drivers' -v EXPRESSIONS='RTE_LOG\\(' -v MESSAGE='Prefer RTE_LOG_LINE' -f devtools/check-forbidden-tokens.awk toto.patch Besides, the expressions[] array is not used since commit b467d38284b1 ("devtools: add explicit warnings for forbidden tokens"). Fixes: 42f4d724ec27 ("devtools: move awk script ckecking forbidden tokens") Signed-off-by: David Marchand --- devtools/check-forbidden-tokens.awk | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/devtools/check-forbidden-tokens.awk b/devtools/check-forbidden-tokens.awk index 90d3a64f8e..807dad7f48 100755 --- a/devtools/check-forbidden-tokens.awk +++ b/devtools/check-forbidden-tokens.awk @@ -32,14 +32,11 @@ BEGIN { for (i in deny_expr) { forbidden_added = "^\\+.*" deny_expr[i]; forbidden_removed="^-.*" deny_expr[i]; - current = expressions[deny_expr[i]] if ($0 ~ forbidden_added) { - count = count + 1; - expressions[deny_expr[i]] = current + 1 + count = count + 1 } if ($0 ~ forbidden_removed) { - count = count - 1; - expressions[deny_expr[i]] = current - 1 + count = count - 1 } } } @@ -55,6 +52,7 @@ BEGIN { if (count > 0) { exit; } + count = 0 for (i in deny_folders) { re = "^\\+\\+\\+ b/" deny_folders[i]; if ($0 ~ re) { -- 2.46.0