Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1258777 > unrolled thread

[PATCH] scripts: checkpatch: remove preceding dot-slash from path name

Started byChristian Gromm <christian.gromm@microchip.com>
First post2015-10-29 14:10 +0100
Last post2015-10-29 14:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] scripts: checkpatch: remove preceding dot-slash from path name Christian Gromm <christian.gromm@microchip.com> - 2015-10-29 14:10 +0100
    Re: [PATCH] scripts: checkpatch: remove preceding dot-slash from  path name Joe Perches <joe@perches.com> - 2015-10-29 14:50 +0100

#1258777 — [PATCH] scripts: checkpatch: remove preceding dot-slash from path name

FromChristian Gromm <christian.gromm@microchip.com>
Date2015-10-29 14:10 +0100
Subject[PATCH] scripts: checkpatch: remove preceding dot-slash from path name
Message-ID<qoV7P-Ao-15@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1258795 — Re: [PATCH] scripts: checkpatch: remove preceding dot-slash from path name

FromJoe Perches <joe@perches.com>
Date2015-10-29 14:50 +0100
SubjectRe: [PATCH] scripts: checkpatch: remove preceding dot-slash from path name
Message-ID<qoVKy-Od-3@gated-at.bofh.it>
In reply to#1258777
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";



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web