Thread (15 messages) 15 messages, 4 authors, 2023-03-31

Re: [PATCH v3 4/4] checkpatch: check for misuse of the link tags

From: Matthieu Baerts <hidden>
Date: 2023-03-31 10:21:22
Also in: dri-devel, lkml, mptcp

Hi Thorsten,

On 31/03/2023 12:09, Thorsten Leemhuis wrote:

On 31.03.23 11:44, Matthieu Baerts wrote:
quoted
Hi Thorsten,

On 31/03/2023 10:57, Thorsten Leemhuis wrote:
quoted
On 30.03.23 20:13, Matthieu Baerts wrote:
quoted
"Link:" and "Closes:" tags have to be used with public URLs.

It is difficult to make sure the link is public but at least we can
verify the tag is followed by 'http(s):'.

With that, we avoid such a tag that is not allowed [1]:

  Closes: <number>

Link: https://lore.kernel.org/linux-doc/CAHk-=wh0v1EeDV3v8TzK81nDC40=XuTdY2MCr0xy3m3FiBV3+Q@mail.gmail.com/ (local) [1]
Signed-off-by: Matthieu Baerts <redacted>
[...]
+# Check for misuse of the link tags
+		if ($in_commit_log &&
+		    $line =~ /^\s*(\w+:)\s*(\S+)/) {
+			my $tag = $1;
+			my $value = $2;
+			if ($tag =~ /^$link_tags_search$/ && $value !~ /^https?:/) {
+				WARN("COMMIT_LOG_WRONG_LINK",
+				     "'$tag' should be followed by a public http(s) link\n" . $herecurr);
+			}
+		}
+
I must be missing something here, but it looks to me like this is
checked twice now. See this line in patch2 (which is changed there, but
the check itself remains):
quoted
} elsif ($rawlines[$linenr] !~ m{^link:\s*https?://}i) {
If I'm not mistaken, we had the following checks:

- after Reported-by, there is a link tag (Link:|Closes:)

- (link tags can take more than 75 chars)
- tags followed by "http(s)://" are restricted to link ones

Then not: link tags (Link:|Closes:) are followed by "http(s):".
Not in general, afaics -- and ensuring that is likely wise, so thx for
this. But for Link: and Closes: tags after a Reported-by it is already
checked, that's what I meant (and didn't communicate well, sorry). It's
just a detail, but might be wise to do this in patch 4:

- } elsif ($rawlines[$linenr] !~ m{^$link_tags_search\s*https?://}i) {
+ } elsif ($rawlines[$linenr] !~ m{^$link_tags_search}i) {

(that's a line changed in patch2)
OK thank you. Sorry I didn't get that. Indeed, it should be enough to
just check for the tags, not for the "http(s)://" part.

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help