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 7F8DD4592F; Sat, 7 Sep 2024 16:54:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9103402E4; Sat, 7 Sep 2024 16:54:49 +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 91F8540269 for ; Sat, 7 Sep 2024 16:54:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725720888; 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=RqkgwBYAWluhlLpGoMAVyT/vG101Vx3MXP7hbGyxIhFV2rQVC//ToQThNw4uoAI4UrFG1H 1viE5V0IEB0QXS/RycovKiYoIy9y+1PTT504f9si46kRHf7q4iNGrpBly1R8Esl/rXrM3Y 6f667RIFQn6TZbCWLnXssirN8TGJyK4= Received: from mx-prod-mc-02.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-86-xne-Iqv0N8WcEcFr0PL8yw-1; Sat, 07 Sep 2024 10:54:46 -0400 X-MC-Unique: xne-Iqv0N8WcEcFr0PL8yw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 299E219560B0; Sat, 7 Sep 2024 14:54:45 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.226.65]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BB1BF3000236; Sat, 7 Sep 2024 14:54:42 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Thomas Monjalon , Andrzej Ostruszka , Arnon Warshavsky Subject: [PATCH 01/11] devtools: fix forbidden token check with multiple files Date: Sat, 7 Sep 2024 16:54:21 +0200 Message-ID: <20240907145433.1479091-2-david.marchand@redhat.com> In-Reply-To: <20240907145433.1479091-1-david.marchand@redhat.com> References: <20240907145433.1479091-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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