* Re: [PATCH] checkpatch/coding-style: Allow 100 column lines
@ 2020-05-30 11:40 Markus Elfring
0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-05-30 11:40 UTC (permalink / raw)
To: Joe Perches, kernel-janitors, linux-fsdevel,
linux-security-module, netfilter-devel
Cc: linux-kernel, Al Viro, Casey Schaufler, Christoph Hellwig,
David Howells, David Laight, Ian Kent, Linus Torvalds
> Change the maximum allowed line length to 100 from 80.
>
> Miscellanea:
>
> o to avoid unnecessary whitespace changes in files,
> checkpatch will no longer emit a warning about line length
> when scanning files unless --strict is also used
> o Add a bit to coding-style about alignment to open parenthesis
I suggest to convert this patch into a patch series with three update steps.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=86852175b016f0c6873dcbc24b93d12b7b246612#n138
…
> +++ b/Documentation/process/coding-style.rst
> @@ -84,15 +84,22 @@ …
…
> +… and are
> +are placed …
Please avoid a word duplication here.
> +… to a function open parenthesis.
Wording alternatives:
+is to align descendants to an open parenthesis of a function call.
> +These same rules are …
+The same rules are applied to function headers with a long argument list.
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clean up kernel_{read,write} & friends v2
2020-05-28 5:40 ` Christoph Hellwig
@ 2020-05-28 18:51 Linus Torvalds
2020-05-28 5:40 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2020-05-28 18:51 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Al Viro, Ian Kent, David Howells, Linux Kernel Mailing List,
linux-fsdevel, LSM List, NetFilter
On Wed, May 27, 2020 at 10:40 PM Christoph Hellwig <hch@lst.de> wrote:
>
> this series fixes a few issues and cleans up the helpers that read from
> or write to kernel space buffers, and ensures that we don't change the
> address limit if we are using the ->read_iter and ->write_iter methods
> that don't need the changed address limit.
Apart from the "please don't mix irrelevant whitespace changes with
other changes" comment, this looks fine to me.
And a rant related to that change: I'm really inclined to remove the
checkpatch check for 80 columns entirely, but it shouldn't have been
triggering for old lines even now.
Or maybe make it check for something more reasonable, like 100 characters.
I find it ironic and annoying how "checkpatch" warns about that silly
legacy limit, when checkpatch itself then on the very next few lines
has a line that is 124 columns wide
And yes, that 124 character line has a good reason for it. But that's
kind of the point. There are lots of perfectly fine reasons for longer
lines.
I'd much rather check for "no deep indentation" or "no unnecessarily
complex conditionals" or other issues that are more likely to be
_real_ problems. But do we really have 80x25 terminals any more that
we'd care about?
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
* clean up kernel_{read,write} & friends v2
@ 2020-05-28 5:40 ` Christoph Hellwig
2020-05-28 20:17 ` David Howells
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2020-05-28 5:40 UTC (permalink / raw)
To: Al Viro
Cc: Linus Torvalds, Ian Kent, David Howells, linux-kernel,
linux-fsdevel, linux-security-module, netfilter-devel
Hi Al,
this series fixes a few issues and cleans up the helpers that read from
or write to kernel space buffers, and ensures that we don't change the
address limit if we are using the ->read_iter and ->write_iter methods
that don't need the changed address limit.
Changes since v2:
- picked up a few ACKs
Changes since v1:
- __kernel_write must not take sb_writers
- unexport __kernel_write
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clean up kernel_{read,write} & friends v2
2020-05-28 5:40 ` Christoph Hellwig
@ 2020-05-28 20:17 ` David Howells
2020-05-28 21:20 ` Casey Schaufler
0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2020-05-28 20:17 UTC (permalink / raw)
To: Linus Torvalds
Cc: dhowells, Christoph Hellwig, Al Viro, Ian Kent,
Linux Kernel Mailing List, linux-fsdevel, LSM List, NetFilter
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> Or maybe make it check for something more reasonable, like 100 characters.
Yes please!
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clean up kernel_{read,write} & friends v2
2020-05-28 20:17 ` David Howells
@ 2020-05-28 21:20 ` Casey Schaufler
2020-05-29 13:08 ` David Laight
0 siblings, 1 reply; 4+ messages in thread
From: Casey Schaufler @ 2020-05-28 21:20 UTC (permalink / raw)
To: David Howells, Linus Torvalds
Cc: Christoph Hellwig, Al Viro, Ian Kent, Linux Kernel Mailing List,
linux-fsdevel, LSM List, NetFilter
On 5/28/2020 1:17 PM, David Howells wrote:
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>> Or maybe make it check for something more reasonable, like 100 characters.
> Yes please!
No, thank you!
C is a symbolic language, not a text language. Encouraging newbies to declare
int iterator;
instead of
int i;
does the language a disservice.
It's true, nobody uses a TTY33 anymore. Those of us who have done so
understand how "{" is preferable to "BEGIN" and why tabs are better than
multiple spaces. A narrow "terminal" requires less neck and mouse movement.
Any width limit is arbitrary, so to the extent anyone might care, I advocate
80 forever.
> David
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: clean up kernel_{read,write} & friends v2
2020-05-28 21:20 ` Casey Schaufler
@ 2020-05-29 13:08 ` David Laight
2020-05-29 19:19 ` Linus Torvalds
0 siblings, 1 reply; 4+ messages in thread
From: David Laight @ 2020-05-29 13:08 UTC (permalink / raw)
To: 'Casey Schaufler', David Howells, Linus Torvalds
Cc: Christoph Hellwig, Al Viro, Ian Kent, Linux Kernel Mailing List,
linux-fsdevel, LSM List, NetFilter
From: Casey Schaufler
> Sent: 28 May 2020 22:21
> It's true, nobody uses a TTY33 anymore. Those of us who have done so
> understand how "{" is preferable to "BEGIN" and why tabs are better than
> multiple spaces. A narrow "terminal" requires less neck and mouse movement.
> Any width limit is arbitrary, so to the extent anyone might care, I advocate
> 80 forever.
A wide monitor is for looking at lots of files.
Not dead space because of deep intents and very long variable names.
Although i don't understand the 'indent continuations under "("' rule.
It hides some indents and makes other excessive.
A simple 'double indent' (or half indent) makes code more readable.
A different rule for function definitions would make real sense.
They only need a single indent - the '{' marks the end.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: clean up kernel_{read,write} & friends v2
2020-05-29 13:08 ` David Laight
@ 2020-05-29 19:19 ` Linus Torvalds
2020-05-29 23:12 ` [PATCH] checkpatch/coding-style: Allow 100 column lines Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2020-05-29 19:19 UTC (permalink / raw)
To: David Laight
Cc: Casey Schaufler, David Howells, Christoph Hellwig, Al Viro,
Ian Kent, Linux Kernel Mailing List, linux-fsdevel, LSM List,
NetFilter
On Fri, May 29, 2020 at 6:08 AM David Laight <David.Laight@aculab.com> wrote:
>
> A wide monitor is for looking at lots of files.
Not necessarily.
Excessive line breaks are BAD. They cause real and every-day problems.
They cause problems for things like "grep" both in the patterns and in
the output, since grep (and a lot of other very basic unix utilities)
is fundamentally line-based.
So the fact is, many of us have long long since skipped the whole
"80-column terminal" model, for the same reason that we have many more
lines than 25 lines visible at a time.
And honestly, I don't want to see patches that make the kernel reading
experience worse for me and likely for the vast majority of people,
based on the argument that some odd people have small terminal
windows.
If you or Christoph have 80 character lines, you'll get possibly ugly
wrapped output. Tough. That's _your_ choice. Your hardware limitations
shouldn't be a pain for the rest of us.
Longer lines are fundamentally useful. My monitor is not only a lot
wider than it is tall, my fonts are universally narrower than they are
tall. Long lines are natural.
When I tile my terminal windows on my display, I can have 6 terminals
visible at one time, and that's because I have them three wide. And I
could still fit 80% of a fourth one side-by-side.
And guess what? That's with my default "100x50" terminal window (go to
your gnome terminal settings, you'll find that the 80x25 thing is just
an initial default that you can change), not with some 80x25 one. And
that's with a font that has anti-aliasing and isn't some pixelated
mess.
And most of my terminals actually end up being dragged wider and
taller than that. I checked, and my main one is 142x76 characters
right now, because it turns out that wider (and taller) terminals are
useful not just for source code.
Have you looked at "ps ax" output lately? Or used "top"? Or done "git
diff --stat" or any number of things where it turns out that 80x25 is
really really limiting, and is simply NO LONGER RELEVANT to most of
us.
So no. I do not care about somebody with a 80x25 terminal window
getting line wrapping.
For exactly the same reason I find it completely irrelevant if
somebody says that their kernel compile takes 10 hours because they
are doing kernel development on a Raspberry PI with 4GB of RAM.
People with restrictive hardware shouldn't make it more inconvenient
for people who have better resources. Yes, we'll accommodate things to
within reasonable limits. But no, 80-column terminals in 2020 isn't
"reasonable" any more as far as I'm concerned. People commonly used
132-column terminals even back in the 80's, for chrissake, don't try
to make 80 columns some immovable standard.
If you choose to use a 80-column terminal, you can live with the line
wrapping. It's just that simple.
And longer lines are simply useful. Part of that is that we aren't
programming in the 80's any more, and our source code is fundamentally
wider as a result.
Yes, local iteration variables are still called 'i', because more
context just isn't helpful for some anonymous counter. Being concise
is still a good thing, and overly verbose names are not inherently
better.
But still - it's entirely reasonable to have variable names that are
10-15 characters and it makes the code more legible. Writing things
out instead of using abbreviations etc.
And yes, we do use wide tabs, because that makes indentation something
you can visually see in the structure at a glance and on a
whole-function basis, rather than something you have to try to
visually "line up" things for or count spaces.
So we have lots of fairly fundamental issues that fairly easily make
for longer lines in many circumstances.
And yes, we do line breaks at some point. But there really isn't any
reason to make that point be 80 columns any more.
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] checkpatch/coding-style: Allow 100 column lines
2020-05-29 19:19 ` Linus Torvalds
@ 2020-05-29 23:12 ` Joe Perches
2020-05-30 22:14 ` Andreas Dilger
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2020-05-29 23:12 UTC (permalink / raw)
To: Linus Torvalds, David Laight
Cc: Casey Schaufler, David Howells, Christoph Hellwig, Al Viro,
Ian Kent, Linux Kernel Mailing List, linux-fsdevel, LSM List,
NetFilter
Change the maximum allowed line length to 100 from 80.
Miscellanea:
o to avoid unnecessary whitespace changes in files,
checkpatch will no longer emit a warning about line length
when scanning files unless --strict is also used
o Add a bit to coding-style about alignment to open parenthesis
Signed-off-by: Joe Perches <joe@perches.com>
---
Documentation/process/coding-style.rst | 25 ++++++++++++++++---------
scripts/checkpatch.pl | 14 +++++++++-----
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index acb2f1b36350..55b148e9c6b8 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -84,15 +84,22 @@ Get a decent editor and don't leave whitespace at the end of lines.
Coding style is all about readability and maintainability using commonly
available tools.
-The limit on the length of lines is 80 columns and this is a strongly
-preferred limit.
-
-Statements longer than 80 columns will be broken into sensible chunks, unless
-exceeding 80 columns significantly increases readability and does not hide
-information. Descendants are always substantially shorter than the parent and
-are placed substantially to the right. The same applies to function headers
-with a long argument list. However, never break user-visible strings such as
-printk messages, because that breaks the ability to grep for them.
+The preferred limit on the length of a single line is 80 columns.
+
+Statements longer than 80 columns should be broken into sensible chunks,
+unless exceeding 80 columns significantly increases readability and does
+not hide information.
+
+Statements may be up to 100 columns when appropriate.
+
+Descendants are always substantially shorter than the parent and are
+are placed substantially to the right. A very commonly used style
+is to align descendants to a function open parenthesis.
+
+These same rules are applied to function headers with a long argument list.
+
+However, never break user-visible strings such as printk messages because
+that breaks the ability to grep for them.
3) Placing Braces and Spaces
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd750241958b..5f00df2c3f59 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -53,7 +53,7 @@ my %ignore_type = ();
my @ignore = ();
my $help = 0;
my $configuration_file = ".checkpatch.conf";
-my $max_line_length = 80;
+my $max_line_length = 100;
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
@@ -99,9 +99,11 @@ Options:
--types TYPE(,TYPE2...) show only these comma separated message types
--ignore TYPE(,TYPE2...) ignore various comma separated message types
--show-types show the specific message type in the output
- --max-line-length=n set the maximum line length, if exceeded, warn
+ --max-line-length=n set the maximum line length, (default $max_line_length)
+ if exceeded, warn on patches
+ requires --strict for use with --file
--min-conf-desc-length=n set the min description length, if shorter, warn
- --tab-size=n set the number of spaces for tab (default 8)
+ --tab-size=n set the number of spaces for tab (default $tabsize)
--root=PATH PATH to the kernel tree root
--no-summary suppress the per-file summary
--mailback only produce a report in case of warnings/errors
@@ -3282,8 +3284,10 @@ sub process {
if ($msg_type ne "" &&
(show_type("LONG_LINE") || show_type($msg_type))) {
- WARN($msg_type,
- "line over $max_line_length characters\n" . $herecurr);
+ my $msg_level = \&WARN;
+ $msg_level = \&CHK if ($file);
+ &{$msg_level}($msg_type,
+ "line length of $length exceeds $max_line_length columns\n" . $herecurr);
}
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch/coding-style: Allow 100 column lines
2020-05-29 23:12 ` [PATCH] checkpatch/coding-style: Allow 100 column lines Joe Perches
@ 2020-05-30 22:14 ` Andreas Dilger
2020-05-30 23:15 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2020-05-30 22:14 UTC (permalink / raw)
To: Joe Perches
Cc: Linus Torvalds, David Laight, Casey Schaufler, David Howells,
Christoph Hellwig, Al Viro, Ian Kent, Linux Kernel Mailing List,
linux-fsdevel, LSM List, NetFilter
[-- Attachment #1: Type: text/plain, Size: 4648 bytes --]
On May 29, 2020, at 5:12 PM, Joe Perches <joe@perches.com> wrote:
>
> Change the maximum allowed line length to 100 from 80.
What is the benefit/motivation for changing this? The vast majority
of files are wrapped at 80 columns, and if some files start being
wrapped at 100 columns they will either display poorly on 80-column
terminals, or a lot of dead space will show in 100-column terminals.
> Miscellanea:
>
> o to avoid unnecessary whitespace changes in files,
> checkpatch will no longer emit a warning about line length
> when scanning files unless --strict is also used
> o Add a bit to coding-style about alignment to open parenthesis
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> Documentation/process/coding-style.rst | 25 ++++++++++++++++---------
> scripts/checkpatch.pl | 14 +++++++++-----
> 2 files changed, 25 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index acb2f1b36350..55b148e9c6b8 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -84,15 +84,22 @@ Get a decent editor and don't leave whitespace at the end of lines.
> Coding style is all about readability and maintainability using commonly
> available tools.
>
> -The limit on the length of lines is 80 columns and this is a strongly
> -preferred limit.
> -
> -Statements longer than 80 columns will be broken into sensible chunks, unless
> -exceeding 80 columns significantly increases readability and does not hide
> -information. Descendants are always substantially shorter than the parent and
> -are placed substantially to the right. The same applies to function headers
> -with a long argument list. However, never break user-visible strings such as
> -printk messages, because that breaks the ability to grep for them.
> +The preferred limit on the length of a single line is 80 columns.
> +
> +Statements longer than 80 columns should be broken into sensible chunks,
> +unless exceeding 80 columns significantly increases readability and does
> +not hide information.
> +
> +Statements may be up to 100 columns when appropriate.
> +
> +Descendants are always substantially shorter than the parent and are
> +are placed substantially to the right. A very commonly used style
> +is to align descendants to a function open parenthesis.
> +
> +These same rules are applied to function headers with a long argument list.
> +
> +However, never break user-visible strings such as printk messages because
> +that breaks the ability to grep for them.
>
>
> 3) Placing Braces and Spaces
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index dd750241958b..5f00df2c3f59 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -53,7 +53,7 @@ my %ignore_type = ();
> my @ignore = ();
> my $help = 0;
> my $configuration_file = ".checkpatch.conf";
> -my $max_line_length = 80;
> +my $max_line_length = 100;
> my $ignore_perl_version = 0;
> my $minimum_perl_version = 5.10.0;
> my $min_conf_desc_length = 4;
> @@ -99,9 +99,11 @@ Options:
> --types TYPE(,TYPE2...) show only these comma separated message types
> --ignore TYPE(,TYPE2...) ignore various comma separated message types
> --show-types show the specific message type in the output
> - --max-line-length=n set the maximum line length, if exceeded, warn
> + --max-line-length=n set the maximum line length, (default $max_line_length)
> + if exceeded, warn on patches
> + requires --strict for use with --file
> --min-conf-desc-length=n set the min description length, if shorter, warn
> - --tab-size=n set the number of spaces for tab (default 8)
> + --tab-size=n set the number of spaces for tab (default $tabsize)
> --root=PATH PATH to the kernel tree root
> --no-summary suppress the per-file summary
> --mailback only produce a report in case of warnings/errors
> @@ -3282,8 +3284,10 @@ sub process {
>
> if ($msg_type ne "" &&
> (show_type("LONG_LINE") || show_type($msg_type))) {
> - WARN($msg_type,
> - "line over $max_line_length characters\n" . $herecurr);
> + my $msg_level = \&WARN;
> + $msg_level = \&CHK if ($file);
> + &{$msg_level}($msg_type,
> + "line length of $length exceeds $max_line_length columns\n" . $herecurr);
> }
> }
>
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checkpatch/coding-style: Allow 100 column lines
2020-05-30 22:14 ` Andreas Dilger
@ 2020-05-30 23:15 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-05-30 23:15 UTC (permalink / raw)
To: Andreas Dilger
Cc: Linus Torvalds, David Laight, Casey Schaufler, David Howells,
Christoph Hellwig, Al Viro, Ian Kent, Linux Kernel Mailing List,
linux-fsdevel, LSM List, NetFilter
On Sat, 2020-05-30 at 16:14 -0600, Andreas Dilger wrote:
> On May 29, 2020, at 5:12 PM, Joe Perches <joe@perches.com> wrote:
> > Change the maximum allowed line length to 100 from 80.
>
> What is the benefit/motivation for changing this? The vast majority
> of files are wrapped at 80 columns, and if some files start being
> wrapped at 100 columns they will either display poorly on 80-column
> terminals, or a lot of dead space will show in 100-column terminals.
YA Linus bleat in this thread.
I don't much care one way or any other.
https://lore.kernel.org/lkml/CAHk-=wj3iGQqjpvc+gf6+C29Jo4COj6OQQFzdY0h5qvYKTdCow@mail.gmail.com/
and
https://lore.kernel.org/lkml/CAHk-=wjR0H3+2ba0UUWwoYzYBH0GX9yTf5dj2MZyo0xvyzvJnA@mail.gmail.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-30 23:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 11:40 [PATCH] checkpatch/coding-style: Allow 100 column lines Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-05-28 18:51 clean up kernel_{read,write} & friends v2 Linus Torvalds
2020-05-28 5:40 ` Christoph Hellwig
2020-05-28 20:17 ` David Howells
2020-05-28 21:20 ` Casey Schaufler
2020-05-29 13:08 ` David Laight
2020-05-29 19:19 ` Linus Torvalds
2020-05-29 23:12 ` [PATCH] checkpatch/coding-style: Allow 100 column lines Joe Perches
2020-05-30 22:14 ` Andreas Dilger
2020-05-30 23:15 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).