Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5438880imu; Sun, 20 Jan 2019 10:52:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN5usmvbhV2Ynxc4vDEqUJM4wbIzdWO1ZZDO6AqcfwmjBafHTylLNtJIiUtJDshedCDGGAs4 X-Received: by 2002:a63:c503:: with SMTP id f3mr24711405pgd.431.1548010353248; Sun, 20 Jan 2019 10:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548010353; cv=none; d=google.com; s=arc-20160816; b=hN0+3oq6Maplq0JjLVUrHlU8RrXWgYa6pZ5cvepWn7zjkCL7W9sOMIqurXk9G8dQOU 7YG/nO0cRr07pb0gFQkZ4hQ3MUSO8jlszBt+gUZNPaaXzEdIrmgRC00AsBpxc1tvZ9kY M98tIiNeSi+r/PijhObARgDwYd2gv4Sbuo8xCYLvjZ/pY8Usw8P00U4Vdul3XaoRpR2v r+HKXLz3ly+S+APELGTEoTHsH6eWVysJm4JwQ/Fcw7WE2Y1z/wxkCyvYpT+X9O+aaogZ cv6VN2MHdRjAKIBsR577/IUqJYCQyv0ANkMz2p0z4CqX7RhM4tGEgvvuigFKRCf34aTL d2YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=xiZ1aEAEkjN7KZM9pWcqjIdrgaklUZ+I6AgmUkFLdAw=; b=hOiXWSqwe6Gt0aKD1jy0QT+jlXXZZkHAL8iAvJvtfPV3Ox0V185RumQGjvXUSwJ0hU XeUxUX2Wr2XVaOm9ubhL7HTzHDK26AlocC/xRIUORVu/lwlveedYEVOQ33vHZKm11sVN Z6V+iq1oWddxPWZ6M72okkyU6QogG2bzJ8zf5AcKHW+fpmt8xp5azeMy5AC/Mz1eYZId hFTNdWDa3IZxzbHn8jK+w/T/YhwrHdbDpZSCV6YwVoCNNflqQZ6BwwDXVLQUxXD4hXki zaNgl32W25ezRuE0pWN6eXoHFnEkjRdaJq4LSM1wOyHSqQFmggpNUhzPdQ4cFVKJQlpX 0Lvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si10603252plb.366.2019.01.20.10.52.16; Sun, 20 Jan 2019 10:52:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727568AbfATSkB (ORCPT + 99 others); Sun, 20 Jan 2019 13:40:01 -0500 Received: from smtprelay0069.hostedemail.com ([216.40.44.69]:53973 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727363AbfATSkA (ORCPT ); Sun, 20 Jan 2019 13:40:00 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 5E0BC182CED2A; Sun, 20 Jan 2019 18:39:59 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:305:355:379:599:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:1801:2197:2198:2199:2200:2393:2551:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3653:3865:3866:3867:3868:3870:3871:3872:4250:4321:4605:5007:6117:7550:7903:9010:10004:10400:10848:11026:11232:11473:11658:11914:12043:12050:12438:12555:12679:12740:12760:12895:12986:13439:14093:14097:14181:14659:14721:21080:21221:21451:21627:30012:30054:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:29,LUA_SUMMARY:none X-HE-Tag: twist62_56eff55b7df4f X-Filterd-Recvd-Size: 4062 Received: from XPS-9350 (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Sun, 20 Jan 2019 18:39:57 +0000 (UTC) Message-ID: Subject: Re: [patch 2/2] scripts/spdxcheck.py: Handle special quotation mark comments From: Joe Perches To: Sven Eckelmann , Thomas Gleixner Cc: LKML , Kuninori Morimoto , Simon Horman , Yoshinori Sato , Rich Felker , Andrew Morton , Kate Stewart , Greg Kroah-Hartman , Jonathan Corbet , b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 20 Jan 2019 10:39:55 -0800 In-Reply-To: <3904432.cpar7GfAiZ@sven-edge> References: <20190116102651.489113812@linutronix.de> <20190116104127.698565432@linutronix.de> <3904432.cpar7GfAiZ@sven-edge> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2019-01-20 at 16:32 +0100, Sven Eckelmann wrote: > On Wednesday, 16 January 2019 11.26.53 CET Thomas Gleixner wrote: > > The SuperH boot code files use a magic format for the SPDX identifier > > comment: > > > > LIST "SPDX-License-Identifier: .... " > > > > The trailing quotation mark is not stripped before the token parser is > > invoked and causes the scan to fail. Handle it gracefully. > [...] > > This patch introduces a false positive when checking files with an ANSI-C > style /* SPDX-License-Identifier: .... */ comment line. > > $ ./scripts/checkpatch.pl -q -f include/linux/bug.h > WARNING: 'SPDX-License-Identifier: GPL-2.0 */' is not supported in LICENSES/... > #1: FILE: include/linux/bug.h:1: > +/* SPDX-License-Identifier: GPL-2.0 */ > > total: 0 errors, 1 warnings, 79 lines checked > > checkpatch.pl is already stripping the "/* " prefix and only sends the > remaining "SPDX-License-Identifier: GPL-2.0 */" via stdin to > scripts/spdxcheck.py. Thus the newly introduced check > > > + # Remove trailing comment closure > > + if line.startswith('/*'): > > + expr = expr.rstrip('*/').strip() > > doesn't match and thus the code doesn't remove the " */" at the end of the > line. Well, maybe checkpatch should remove the comment trailer. --- Miscellanea: o Indent a block properly too scripts/checkpatch.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 155fa9305166..e0b542008256 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3029,8 +3029,10 @@ sub process { $checklicenseline = 2; } elsif ($rawline =~ /^\+/) { my $comment = ""; + my $trailer = ""; if ($realfile =~ /\.(h|s|S)$/) { $comment = '/*'; + $trailer = '*/'; } elsif ($realfile =~ /\.(c|dts|dtsi)$/) { $comment = '//'; } elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) { @@ -3044,11 +3046,12 @@ sub process { WARN("SPDX_LICENSE_TAG", "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr); } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) { - my $spdx_license = $1; - if (!is_SPDX_License_valid($spdx_license)) { - WARN("SPDX_LICENSE_TAG", - "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr); - } + my $spdx_license = rtrim($1); + $spdx_license =~ s/\s*\Q$trailer\E$//; + if (!is_SPDX_License_valid($spdx_license)) { + WARN("SPDX_LICENSE_TAG", + "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr); + } } } }