From: Prasad Pandit <pjp@fedoraproject.org>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Joe Perches <joe@perches.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Greg KH <gregkh@linuxfoundation.org>,
Andy Whitcroft <apw@canonical.com>
Subject: Re: [PATCH] checkpatch: error if file terminates without a new-line
Date: Tue, 16 Apr 2024 07:04:47 +0000 (UTC) [thread overview]
Message-ID: <1568855168.5949322.1713251087824@mail.yahoo.com> (raw)
In-Reply-To: <20240330033858.3272184-1-ppandit@redhat.com>
[+linux-kernel]
On Saturday, 30 March, 2024 at 09:09:12 am IST, Prasad Pandit <ppandit@redhat.com> wrote:
From: Prasad Pandit <pjp@fedoraproject.org>
Add check to flag an error if a patch terminates a file
without a new line (\n) character.
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
-> https://lore.kernel.org/all/CAE8KmOxG=3sWKpeB5fdWTK-SCipS=JyDE-_DNgY--DtoSQZ0Qw@mail.gmail.com/T/#t
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c4c4a61bc83..df34c0709410 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2795,6 +2795,13 @@ sub process {
$is_patch = 1;
}
+# check if patch terminates file without a new line (\n)
+ if ($line =~ /^\\ No newline at end of file$/
+ and $rawlines[$linenr - 2] =~ /^\+.*$/) {
+ ERROR("NOEOL_FILE",
+ "patch terminates file without a new line (\\n).");
+ }
+
#extract the line range in the file after the patch is applied
if (!$in_commit_log &&
$line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
--
2.44.0
next parent reply other threads:[~2024-04-16 7:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240330033858.3272184-1-ppandit@redhat.com>
2024-04-16 7:04 ` Prasad Pandit [this message]
2024-04-16 8:48 ` [PATCH] checkpatch: error if file terminates without a new-line Greg KH
2024-04-16 8:59 ` Dan Carpenter
2024-04-16 9:55 ` Joe Perches
2024-04-17 6:36 ` Prasad Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1568855168.5949322.1713251087824@mail.yahoo.com \
--to=pjp@fedoraproject.org \
--cc=apw@canonical.com \
--cc=dan.carpenter@linaro.org \
--cc=dwaipayanray1@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=pj.pandit@yahoo.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.