2022-08-17 08:55:56

by Matthias May

[permalink] [raw]
Subject: False-positive in Checkpatch

Hi Checkpatch Maintainers

The selftest patch at
https://lore.kernel.org/netdev/[email protected]/T/#u
claims too long lines.
However this seems to be a misinterpretation of the indention before the printf split over 2
lines to exactly not have too long lines.
The false positive checkpatch results are also on the netdev patchwork:
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

BR
Matthias


Attachments:
OpenPGP_signature (243.00 B)
OpenPGP digital signature

2022-08-17 11:36:50

by Lukas Bulwahn

[permalink] [raw]
Subject: Re: False-positive in Checkpatch

On Wed, Aug 17, 2022 at 10:29 AM Matthias May <[email protected]> wrote:
>
> Hi Checkpatch Maintainers
>
> The selftest patch at
> https://lore.kernel.org/netdev/[email protected]/T/#u
> claims too long lines.
> However this seems to be a misinterpretation of the indention before the printf split over 2
> lines to exactly not have too long lines.
> The false positive checkpatch results are also on the netdev patchwork:
> https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
>

Hi Matthias,

Thanks for reporting. I tried checkpatch on this referred patch and
can confirm that it reports:

WARNING: line length of 132 exceeds 100 columns
#413: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:359:
+printf "┌────────┬───────┬───────┬──────────────┬"

WARNING: line length of 107 exceeds 100 columns
#414: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:360:
+printf "──────────────┬───────┬────────┐\n"

WARNING: line length of 148 exceeds 100 columns
#420: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:366:
+ printf "├────────┼───────┼───────┼──────────────┼"

WARNING: line length of 123 exceeds 100 columns
#421: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:367:
+ printf "──────────────┼───────┼────────┤\n"

WARNING: line length of 156 exceeds 100 columns
#425: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:371:
+ printf "├────────┼───────┼───────┼──────────────┼"

WARNING: line length of 131 exceeds 100 columns
#426: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:372:
+ printf "──────────────┼───────┼────────┤\n"

WARNING: line length of 132 exceeds 100 columns
#439: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:385:
+printf "└────────┴───────┴───────┴──────────────┴"

WARNING: line length of 107 exceeds 100 columns
#440: FILE: tools/testing/selftests/net/l2_tos_ttl_inherit.sh:386:
+printf "──────────────┴───────┴────────┘\n"


In my editor (vim), these lines are rather short but it seems the real
line number is much larger.

For example, in line 420, vim states "420,135-66" at the end of the
line. So, there are clearly different ways of counting the number of
characters this line has. I think that at least explains it, I really
do not know which way of counting is the best, though.

Lukas

2022-08-18 05:03:33

by Joe Perches

[permalink] [raw]
Subject: Re: False-positive in Checkpatch

On Wed, 2022-08-17 at 10:29 +0200, Matthias May wrote:
> Hi Checkpatch Maintainers
>
> The selftest patch at
> https://lore.kernel.org/netdev/[email protected]/T/#u
> claims too long lines.
> However this seems to be a misinterpretation of the indention before the printf split over 2
> lines to exactly not have too long lines.
> The false positive checkpatch results are also on the netdev patchwork:
> https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Each character in the boxing output is actually 3 ascii characters.
checkpatch doesn't interpret unicode within character strings.