[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <134d34de7e35861f33d3a1d9ffd8a70b0f92df33.camel@perches.com>
Date: Fri, 15 May 2020 05:31:10 -0700
From: Joe Perches <joe@...ches.com>
To: Emil Velikov <emil.l.velikov@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: get_maintainer.pl: unexpected behaviour for path/to//file
On Fri, 2020-05-15 at 11:52 +0100, Emil Velikov wrote:
> Hi Joe,
>
> Recently I've noticed that get_maintainer behaves differently if there
> is a double, sequential, forward slash in the path.
>
> AFAICT there should be no distinction between the two. Or at least many
> existing applications and scripts consider them one and the same.
>
> I've tried fixing this, although my perl isn't quite up-to scratch.
> Is this some weird bug or some intended feature?
Not really an intended feature.
The code counts slashes for directory depth.
I suppose it might be simpler to do this:
---
scripts/get_maintainer.pl | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 6d973f3685f9..eaaf9373dbcf 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -538,6 +538,7 @@ foreach my $file (@ARGV) {
} elsif (!(-f $file)) {
die "$P: file '${file}' not found\n";
}
+ $file =~ s@//@/@g; # compress file double slashes
}
if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) {
$file =~ s/^\Q${cur_path}\E//; #strip any absolute path
Powered by blists - more mailing lists