linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Print some info if no filenames are given
@ 2021-05-15  4:15 Tiezhu Yang
  2021-05-15  4:26 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Tiezhu Yang @ 2021-05-15  4:15 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn; +Cc: linux-kernel

After commit 45107ff6d526 ("checkpatch: if no filenames then read stdin"),
if no filenames are given, it will read patch from stdin rather than exit
directly, it is better to print some info about what to do next, otherwise
it is a bit confusing whether the script hangs.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23697a6..d84d4fb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -361,6 +361,8 @@ if ($^V && $^V lt $minimum_perl_version) {
 
 #if no filenames are given, push '-' to read patch from stdin
 if ($#ARGV < 0) {
+	print "$P: missing patchfile or -f file\n";
+	print "Use --help if necessary or read patch from stdin\n";
 	push(@ARGV, '-');
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: Print some info if no filenames are given
  2021-05-15  4:15 [PATCH] checkpatch: Print some info if no filenames are given Tiezhu Yang
@ 2021-05-15  4:26 ` Joe Perches
  2021-05-16  8:49   ` Lukas Bulwahn
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2021-05-15  4:26 UTC (permalink / raw)
  To: Tiezhu Yang, Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn; +Cc: linux-kernel

On Sat, 2021-05-15 at 12:15 +0800, Tiezhu Yang wrote:
> After commit 45107ff6d526 ("checkpatch: if no filenames then read stdin"),
> if no filenames are given, it will read patch from stdin rather than exit
> directly, it is better to print some info about what to do next, otherwise
> it is a bit confusing whether the script hangs.

I think this is unnecessary.
It's like trying to make cat without command line arguments emit something.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -361,6 +361,8 @@ if ($^V && $^V lt $minimum_perl_version) {
>  
> 
>  #if no filenames are given, push '-' to read patch from stdin
>  if ($#ARGV < 0) {
> +	print "$P: missing patchfile or -f file\n";
> +	print "Use --help if necessary or read patch from stdin\n";
>  	push(@ARGV, '-');
>  }
>  
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: Print some info if no filenames are given
  2021-05-15  4:26 ` Joe Perches
@ 2021-05-16  8:49   ` Lukas Bulwahn
  0 siblings, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2021-05-16  8:49 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Andy Whitcroft, Dwaipayan Ray, Linux Kernel Mailing List, Joe Perches

On Sat, May 15, 2021 at 6:26 AM Joe Perches <joe@perches.com> wrote:
>
> On Sat, 2021-05-15 at 12:15 +0800, Tiezhu Yang wrote:
> > After commit 45107ff6d526 ("checkpatch: if no filenames then read stdin"),
> > if no filenames are given, it will read patch from stdin rather than exit
> > directly, it is better to print some info about what to do next, otherwise
> > it is a bit confusing whether the script hangs.
>
> I think this is unnecessary.
> It's like trying to make cat without command line arguments emit something.
>

Tiezhu, if you think this behaviour of checkpatch needs a description
and explanation that the informed users* of checkpatch would value,
you may submit a patch to the kernel's checkpatch documentation,
./Documentation/dev-tools/checkpatch.rst (or to see a rendered
version, e.g., https://www.kernel.org/doc/html/latest/dev-tools/checkpatch.html).
You might want to add a few example invocations of checkpatch and then
explain with an example that checkpatch consumes stdin, if no patch
file is given as argument.

Looking forward to your patch to the documentation...

*informed user = "somebody that actually reads the available kernel
documentation on checkpatch"

Lukas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-16  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15  4:15 [PATCH] checkpatch: Print some info if no filenames are given Tiezhu Yang
2021-05-15  4:26 ` Joe Perches
2021-05-16  8:49   ` Lukas Bulwahn

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).