RE: checkpatch warns a symbolic link has not a newline
From: Michael.Wu
Date: Wed Nov 10 2021 - 03:52:41 EST
Hi Joe,
The following is a demonstrated patch which creates a symbolic link
pointing to a existed file.
diff --git a/tools/gpio/dummy.h b/tools/gpio/dummy.h
new file mode 120000
index 000000000000..ace4df60bac6
--- /dev/null
+++ b/tools/gpio/dummy.h
@@ -0,0 +1 @@
+gpio-utils.h
\ No newline at end of file
tools/gpio/dummy.h is created by command 'ln -s gpio-utils.h dummy.h'.
scripts/checkpatch.pl returned a warning likes that:
WARNING: adding a line without newline at end of file
#22: FILE: tools/gpio/dummy.h:1:
+gpio-utils.h
command 'ln -s' creates a symbolic link which has no newline at end of
file. For a symbolic link created by 'ln -s' always get the warning.
If symbolic links are allowed, it should not be warned, is it?
Best Regards,
Michael Wu
> -----Original Message-----
> From: Joe Perches [mailto:joe@xxxxxxxxxxx]
> Sent: Wednesday, November 10, 2021 4:09 PM
> To: Michael.Wu(吳忠益)
> Subject: Re: checkpatch warns a symbolic link has not a newline
>
> On Wed, 2021-11-10 at 06:39 +0000, Michael.Wu@xxxxxxxxxx wrote:
> > Hi Andy & Joe,
> >
> > I have a commit that contains a newly created symbolic link pointing to a
> certain file. I used ./scripts/checkpatch.pl to check this commit and then I got a
> WARNING: adding a line without newline at end of file. The symbolic link was
> created by ln -s.
> >
> > I'm confused why it returned such a warning. Is the content of the patch not
> allowed to contain symbolic links? If it is allowed, I think checkpatch.pl can
> make some improvements, so that symbolic links will not be treated a
> warnings because of missing newline at end of file.
> >
> > Best Regards,
> > Michael Wu
>
> Send me an email that contains the patch that produces this message please.
>