public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* checkpatch.pl and no newline handling
@ 2007-11-12 19:46 Mike Frysinger
  2007-11-13 10:18 ` Andy Whitcroft
  2007-11-13 10:55 ` Andy Whitcroft
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2007-11-12 19:46 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: Linux Kernel Mailing List

the current checkpatch.pl does not reject new files that lack a
newline, yet rejects patches that fix newlines in files ... quite the
opposite of what we actually want

$ echo -n moo > no-newline
$ diff -Nu /dev/null no-newline
--- /dev/null   2007-11-10 20:02:36.248000000 -0500
+++ no-newline  2007-11-12 14:44:19.000000000 -0500
@@ -0,0 +1 @@
+moo
\ No newline at end of file
$ (diff -Nu /dev/null no-newline; echo Signed-off-by:) |
./scripts/checkpatch.pl -
Your patch has no obvious style problems and is ready for submission.

lies!

$ echo moo > newline
$ diff -u no-newline newline
--- no-newline  2007-11-12 14:44:19.000000000 -0500
+++ newline     2007-11-12 14:44:27.000000000 -0500
@@ -1 +1 @@
-moo
\ No newline at end of file
+moo
$ (diff -u no-newline newline; echo Signed-off-by:) | ./scripts/checkpatch.pl -
ERROR: patch seems to be corrupt (line wrapped?)
#5: FILE: newline:0:
\ No newline at end of file

total: 1 errors, 0 warnings, 3 lines checked
Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
-mike

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

* Re: checkpatch.pl and no newline handling
  2007-11-12 19:46 checkpatch.pl and no newline handling Mike Frysinger
@ 2007-11-13 10:18 ` Andy Whitcroft
  2007-11-13 10:55 ` Andy Whitcroft
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Whitcroft @ 2007-11-13 10:18 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Linux Kernel Mailing List

On Mon, Nov 12, 2007 at 02:46:30PM -0500, Mike Frysinger wrote:
> the current checkpatch.pl does not reject new files that lack a
> newline, yet rejects patches that fix newlines in files ... quite the
> opposite of what we actually want

Nice.  Just what the world needs.  I wonder what the heck that format
means.  Obviously the "corrupt" check is wrong as a "\ No newline" line
is valid not corrupt.  Now when is "\ No newline" a good thing and when
a bad thing.  It _looks_ like it is 'bound' to the line before, and if
so then its pretty simple.

Bad:
> +moo
> \ No newline at end of file

Good:
> -moo
> \ No newline at end of file

/me goes read the source for diff.  Sigh.

Thanks for the report.

-apw

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

* Re: checkpatch.pl and no newline handling
  2007-11-12 19:46 checkpatch.pl and no newline handling Mike Frysinger
  2007-11-13 10:18 ` Andy Whitcroft
@ 2007-11-13 10:55 ` Andy Whitcroft
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Whitcroft @ 2007-11-13 10:55 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Linux Kernel Mailing List

On Mon, Nov 12, 2007 at 02:46:30PM -0500, Mike Frysinger wrote:
> the current checkpatch.pl does not reject new files that lack a
> newline, yet rejects patches that fix newlines in files ... quite the
> opposite of what we actually want

apw@pinky$ echo -n "moo" >no-newline.c
apw@pinky$ diff -Nu /dev/null no-newline.c | ./checkpatch.pl -q -no-tree
--no-signoff -
WARNING: adding a line without newline at end of file
#4: FILE: no-newline.c:1:
+moo

total: 0 errors, 1 warnings, 1 lines checked
apw@pinky$ echo "moo" >newline.c
apw@pinky$ diff -Nu no-newline.c newline.c | ./checkpatch.pl -q -no-tree
--no-signoff -
total: 0 errors, 0 warnings, 3 lines checked
apw@pinky$

This should be fixed in the 0.12 release and is fixed in -next.

-apw

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

end of thread, other threads:[~2007-11-13 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-12 19:46 checkpatch.pl and no newline handling Mike Frysinger
2007-11-13 10:18 ` Andy Whitcroft
2007-11-13 10:55 ` Andy Whitcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox