public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts: checkpatch: remove preceding dot-slash from path name
@ 2015-10-29 13:06 Christian Gromm
  2015-10-29 13:46 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Gromm @ 2015-10-29 13:06 UTC (permalink / raw)
  To: joe; +Cc: Christian Gromm, Andy Whitcroft, Andrew Morton, linux-kernel

In case checkpatch is called with a path name that starts with ./ for
the current directory not all issues are being reported since internal
path checks don't succeed. This patch removes the leading './' from
$filename. This is needed to have checkpatch report all issues found
during execution.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 scripts/checkpatch.pl |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f2a1131..44435fd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -730,6 +730,9 @@ my $fixlinenr = -1;
 my $vname;
 for my $filename (@ARGV) {
 	my $FILE;
+	if ($filename =~ /^(\.\/)/) {
+		substr($filename, 0, 2) = "";
+	}
 	if ($file) {
 		open($FILE, '-|', "diff -u /dev/null $filename") ||
 			die "$P: $filename: diff failed - $!\n";
-- 
1.7.9.5


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

* Re: [PATCH] scripts: checkpatch: remove preceding dot-slash from path name
  2015-10-29 13:06 [PATCH] scripts: checkpatch: remove preceding dot-slash from path name Christian Gromm
@ 2015-10-29 13:46 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2015-10-29 13:46 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Andy Whitcroft, Andrew Morton, linux-kernel

On Thu, 2015-10-29 at 14:06 +0100, Christian Gromm wrote:
> In case checkpatch is called with a path name that starts with ./ for
> the current directory not all issues are being reported since internal
> path checks don't succeed. This patch removes the leading './' from
> $filename. This is needed to have checkpatch report all issues found
> during execution.
> 
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  scripts/checkpatch.pl |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f2a1131..44435fd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -730,6 +730,9 @@ my $fixlinenr = -1;
>  my $vname;
>  for my $filename (@ARGV) {
>  	my $FILE;
> +	if ($filename =~ /^(\.\/)/) {
> +		substr($filename, 0, 2) = "";
> +	}

If you are going to attempt to do pathname translations,
please do it comprehensively using something like realpath.

$ cd <linux source tree path>
$ cd drivers/staging
$ <path if necessary>checkpatch.pl -f ./<file>

And it should be done for the files contained
in a patch too.

thanks.

>  	if ($file) {
>  		open($FILE, '-|', "diff -u /dev/null $filename") ||
>  			die "$P: $filename: diff failed - $!\n";




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

end of thread, other threads:[~2015-10-29 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 13:06 [PATCH] scripts: checkpatch: remove preceding dot-slash from path name Christian Gromm
2015-10-29 13:46 ` Joe Perches

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