[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba9cbced1ccb0e7da5593b587bb179328cecd80e.camel@perches.com>
Date: Fri, 15 May 2020 10:22:51 -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 05:31 -0700, Joe Perches wrote:
> 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:
Or perhaps a better alternative is:
---
scripts/get_maintainer.pl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 6d973f3685f9..484d2fbf5921 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -19,6 +19,7 @@ my $V = '0.26';
use Getopt::Long qw(:config no_auto_abbrev);
use Cwd;
use File::Find;
+use File::Spec::Functions;
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
@@ -532,6 +533,7 @@ if (!@...V) {
foreach my $file (@ARGV) {
if ($file ne "&STDIN") {
+ $file = canonpath($file);
##if $file is a directory and it lacks a trailing slash, add one
if ((-d $file)) {
$file =~ s@([^/])$@$1/@;
Powered by blists - more mailing lists