lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a18b611813bb409fef15bc8927adab79eb9be43.camel@perches.com>
Date:   Fri, 15 May 2020 12:06:59 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Emil Velikov <emil.l.velikov@...il.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] get_maintainer: Fix unexpected behavior for path/to//file
 (double slashes)

get_maintainer behaves differently if there is a
double sequential forward slash in a filename because
the total number of slashes in a filename is used to
match MAINTAINERS file patterns.

For example:

# (with double slash)
$ ./scripts/get_maintainer.pl -f drivers/gpu/drm//lima
David Airlie <airlied@...ux.ie> (maintainer:DRM DRIVERS)
Daniel Vetter <daniel@...ll.ch> (maintainer:DRM DRIVERS,commit_signer:3/42=7%)
Qiang Yu <yuq825@...il.com> (commit_signer:36/42=86%,authored:24/42=57%)
Vasily Khoruzhick <anarsoul@...il.com> (commit_signer:26/42=62%)
Krzysztof Kozlowski <krzk@...nel.org> (commit_signer:5/42=12%,authored:5/42=12%)
Emil Velikov <emil.velikov@...labora.com> (commit_signer:4/42=10%)
dri-devel@...ts.freedesktop.org (open list:DRM DRIVERS)
linux-kernel@...r.kernel.org (open list)

# (without double slash)
$ ./scripts/get_maintainer.pl -f drivers/gpu/drm/lima
Qiang Yu <yuq825@...il.com> (maintainer:DRM DRIVERS FOR LIMA)
David Airlie <airlied@...ux.ie> (maintainer:DRM DRIVERS)
Daniel Vetter <daniel@...ll.ch> (maintainer:DRM DRIVERS)
dri-devel@...ts.freedesktop.org (open list:DRM DRIVERS FOR LIMA)
lima@...ts.freedesktop.org (moderated list:DRM DRIVERS FOR LIMA)
linux-kernel@...r.kernel.org (open list)

So reduce consecutive double slashes to a single slash
by using File::Spec->canonpath().

from: https://perldoc.perl.org/File/Spec/Unix.html

canonpath()

No physical check on the filesystem, but a logical cleanup of a
path. On UNIX eliminates successive slashes and successive "/.".

Reported-by: Emil Velikov <emil.l.velikov@...il.com>
Signed-off-by: Joe Perches <joe@...ches.com>
---
 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ