Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp668545ybk; Fri, 15 May 2020 10:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz31KiAJAbDpBdtlBJ2pMLrAXfd1zVFXoWrG0jfawS6FGzw8mm/9/PgKJbialfGCs4xSqm1 X-Received: by 2002:a17:906:81ce:: with SMTP id e14mr3769137ejx.76.1589563491200; Fri, 15 May 2020 10:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589563491; cv=none; d=google.com; s=arc-20160816; b=hdZWh9NhCOsasYemOhf8Iu/2tc23IqpQ7QsXWti1dgl1n23SuOpCFSljpfy4o2Torj cXZGlRbvEkN2aQNEmzM1CWnVxMPjd2qrBHYMYWhzTVc1set+V6YONtQrtFt4iqfP7o2G WSWMtDhLNyhdv2LDkg1P/iVnIcQLvraJyA7GlKQKGNu2DxkG9PICpKgF9gy/au6ZLyj7 sT4ZXktm3i3NFtfl3YwiUqX6rAwHDTVWg94OrxNDXb9pYeqHgwSfl+cV9Wg4X3m6I4wW br1XXmCOd6Ozk4rzmHdfJRepXxTwnDEAv5x+94Cmm9hxZeCYyu8zK2w9ZxBmRkYDYqxX +Xsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=2hOpDlkLoaF+U9CVW/sgbVeeQV3vXUk8FPABLrvVXeU=; b=xJkSZ2dQ3UEkDI/1fW6VwwbNAHCyOhAX86tXyDKUQqi67SRAie5KuePraQTAcCNHQJ UvAFX9bDrcSiTBbYvOUYu4rMDlwWgfD0kLUE10vG80msOg2I+ObludQ2vX4vfoz2OzSX qOVnHG1Gk67V8tuFAxRVJ/CEPnqdJknW9UwjMOvDjUQ7ZszQZMP2gitEzkpoTtpD1RGH BtvrPH4ymB6tKsDNBd3InYz1JA/IpJRjMiMWSD82extpZsO6a1dUCDax4BypVXFUXxbD 2vi558TZcCcNJHhUm9GxP4pb+kX4WHQTEy7VJdBTmHxta5UfQY3ovcQ8Nva7zpsvbyKB VHuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si1667125ejj.253.2020.05.15.10.24.28; Fri, 15 May 2020 10:24:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726643AbgEORWy (ORCPT + 99 others); Fri, 15 May 2020 13:22:54 -0400 Received: from smtprelay0040.hostedemail.com ([216.40.44.40]:38548 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726438AbgEORWy (ORCPT ); Fri, 15 May 2020 13:22:54 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 0812D182CED5B; Fri, 15 May 2020 17:22:53 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3653:3865:3867:3868:3870:3871:3872:3874:4321:5007:7903:10004:10400:10848:11026:11232:11658:11914:12296:12297:12555:12740:12760:12895:12986:13069:13311:13357:13439:14180:14659:14721:21060:21067:21080:21221:21324:21451:21627:30012:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: able05_3631f4c4af504 X-Filterd-Recvd-Size: 2261 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA; Fri, 15 May 2020 17:22:52 +0000 (UTC) Message-ID: Subject: Re: get_maintainer.pl: unexpected behaviour for path/to//file From: Joe Perches To: Emil Velikov Cc: linux-kernel@vger.kernel.org Date: Fri, 15 May 2020 10:22:51 -0700 In-Reply-To: <134d34de7e35861f33d3a1d9ffd8a70b0f92df33.camel@perches.com> References: <20200515105203.2792466-1-emil.l.velikov@gmail.com> <134d34de7e35861f33d3a1d9ffd8a70b0f92df33.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (!@ARGV) { 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/@;