mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Geliang Tang <geliang@kernel.org>,
	Geliang Tang <tanggeliang@kylinos.cn>,
	linux-kernel@vger.kernel.org, mptcp@lists.linux.dev
Subject: Re: [RESEND PATCH v2] checkpatch: skip warnings for symbol links
Date: Tue, 8 Oct 2024 12:58:45 +0200	[thread overview]
Message-ID: <d5383c9c-995b-4d7b-aaad-07a08e3723c0@kernel.org> (raw)
In-Reply-To: <8184a4fe-ddfb-4c38-be2f-e8d808ce777b@kernel.org>

Hi Andy, Joe, Dwaipayan, Lukas,

On 05/08/2024 12:17, Matthieu Baerts wrote:
> I'm sorry to bother you about that, but it looks like the following
> patch from Geliang didn't get any review from your side. Do you mind
> having a look at this non-urgent patch when you have a bit of free time
> please?

By chance, do you have a bit of time to review and eventually apply
Geliang's small patch, please?

https://lore.kernel.org/dc502b1b45cb27fda48d72d73e3267a32db023d8.1717722648.git.tanggeliang@kylinos.cn

(This patch added MPTCP ML in Cc, and we are still tracking it in
patchwork, it's just to know what to do with it.)

Thanks!
Matt

> On 07/06/2024 03:12, Geliang Tang wrote:
>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>
>> If there is a symbol link in the given patch, like the following one:
>>
>> $ cat 0001-selftests-bpf-Add-mptcp-pm_nl_ctl-link.patch
>>
>>  '''
>>  # diff --git a/tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c \
>>  #            b/tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c
>>  # new file mode 120000
>>  # index 000000000000..5a08c255b278
>>  # --- /dev/null
>>  # +++ b/tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c
>>  # @@ -0,0 +1 @@
>>  # +../net/mptcp/pm_nl_ctl.c
>>  # \ No newline at end of file
>>  '''
>>
>> checkpatch.pl reports two inaccurate warnings:
>>
>>  '''
>>  WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
>>  #65: FILE: tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c:1:
>>  +../net/mptcp/pm_nl_ctl.c
>>
>>  WARNING: adding a line without newline at end of file
>>  #65: FILE: tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c:1:
>>  +../net/mptcp/pm_nl_ctl.c
>>  '''
>>
>> And three checks if run it with strict option:
>>
>>  '''
>>  CHECK: spaces preferred around that '/' (ctx:VxV)
>>  #65: FILE: tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c:1:
>>  +../net/mptcp/pm_nl_ctl.c
>>    ^
>>
>>  CHECK: spaces preferred around that '/' (ctx:VxV)
>>  #65: FILE: tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c:1:
>>  +../net/mptcp/pm_nl_ctl.c
>>        ^
>>
>>  CHECK: spaces preferred around that '/' (ctx:VxV)
>>  #65: FILE: tools/testing/selftests/bpf/mptcp_pm_nl_ctl.c:1:
>>  +../net/mptcp/pm_nl_ctl.c
>>  '''
>>
>> This patch fixes this by adding a new variable $symbol_link in checkpatch
>> script, set it if the new file mode is 120000. Skip "missing or malformed
>> SPDX-License-Identifier tag", "adding a line without newline at end of
>> file" and "spaces preferred around that '/'" checks if this variable is
>> set.
>>
>> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
>> ---
>> v2:
>>  - fix warnings with strict option too.
>> ---
>>  scripts/checkpatch.pl | 15 ++++++++++++---
>>  1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 2b812210b412..1f3ce5ffe914 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -2694,6 +2694,8 @@ sub process {
>>  
>>  	my $checklicenseline = 1;
>>  
>> +	my $symbol_link = 0;
>> +
>>  	sanitise_line_reset();
>>  	my $line;
>>  	foreach my $rawline (@rawlines) {
>> @@ -3564,6 +3566,11 @@ sub process {
>>  # ignore non-hunk lines and lines being removed
>>  		next if (!$hunk_line || $line =~ /^-/);
>>  
>> +# Check for symbol links
>> +		if ($line =~ /^new file mode 120000$/) {
>> +			$symbol_link = 1;
>> +		}
>> +
>>  #trailing whitespace
>>  		if ($line =~ /^\+.*\015/) {
>>  			my $herevet = "$here\n" . cat_vet($rawline) . "\n";
>> @@ -3756,7 +3763,8 @@ sub process {
>>  				}
>>  
>>  				if ($comment !~ /^$/ &&
>> -				    $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
>> +				    $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @ &&
>> +				    $symbol_link =~ 1) {
>>  					WARN("SPDX_LICENSE_TAG",
>>  					     "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
>>  				} elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
>> @@ -3867,7 +3875,8 @@ sub process {
>>  		}
>>  
>>  # check for adding lines without a newline.
>> -		if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
>> +		if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/ &&
>> +		    $symbol_link =~ 1) {
>>  			if (WARN("MISSING_EOF_NEWLINE",
>>  			         "adding a line without newline at end of file\n" . $herecurr) &&
>>  			    $fix) {
>> @@ -5293,7 +5302,7 @@ sub process {
>>  					 $op eq '*' or $op eq '/' or
>>  					 $op eq '%')
>>  				{
>> -					if ($check) {
>> +					if ($check && $symbol_link =~ 1) {
>>  						if (defined $fix_elements[$n + 2] && $ctx !~ /[EW]x[EW]/) {
>>  							if (CHK("SPACING",
>>  								"spaces preferred around that '$op' $at\n" . $hereptr)) {

      reply	other threads:[~2024-10-08 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07  1:12 Geliang Tang
2024-08-05 10:17 ` Matthieu Baerts
2024-10-08 10:58   ` Matthieu Baerts [this message]

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=d5383c9c-995b-4d7b-aaad-07a08e3723c0@kernel.org \
    --to=matttbe@kernel.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=geliang@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®