Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2057447ybk; Sun, 17 May 2020 08:53:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGjVTb+GowGGAysZCoLIq3s8PcOQ4VlQKCV0GX9qZOUpjKXz8YWGGSaRyYdTN2YngYijoc X-Received: by 2002:aa7:ca48:: with SMTP id j8mr9789384edt.328.1589730832149; Sun, 17 May 2020 08:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589730832; cv=none; d=google.com; s=arc-20160816; b=jcE2GApRZkj/+X1lFxeSuJcqxYW65DGY4HungBEmHXkbYg1LLYmKmaIWs6F0QGV5nO vL1lG2aw9w+7PwAKomFfk9H32DJAhWtLmQTjrU/sOQFpw+KN4xEwu4vs60gNms+r1SUa 4YNzrsZi2E3z5cYUS3HDG3B+WJLQWj+Zx8cqhY/NyxQ4G3giIogv66NSb+Q/vAdDWFAc dmKNXGCjRSWCOzqzTI5wO3I4bJZXWTh3YwLKaCXVsyMenIF0saug95Hu6K8chX89Qt4r gWzpKwazKeQf5jdatUIw55vm1u8OKodGng3ClX9b1BXN7/E/yi5wPalZH6vdLWBsgTzI G81A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nrqyWKwX+Fo3y6zOYpSb7pR9qyYbIYzcbk9GR/Z/Ams=; b=qS7bsN8WzNyRLbbIhTVuy2ws9f16nXh2yluj8KL8j8dfsdy1Ji4+DzEwkCNA3ve/1f yNhy17qef2BC4FqaFa6uYOWR0MKLu7W7jFgo2GxNeGdH26B8gbiUvyL+Wz4m0dbzHVW9 3NBajwWyItuH0XneqfmIrdt4RsLdZoTHyMIYTDrVj5duSbKvPqNSbwCddoobRuZHUwIw PQlzjKEuR0Z6TGAiVLf0iS++NE2jIe1kw7ueYPW1Qt1YqrjbCvkR9Ypcgvljvr+iYHPa jtKGFEx338ABiMOVItZYdHc4ItLOyz7nVV/TivFRP0GqSpOwi1Z9IuSp4v2PZFtvvngl vyKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HrDveH5P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov4si4812506ejb.237.2020.05.17.08.53.12; Sun, 17 May 2020 08:53:52 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HrDveH5P; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbgEQPum (ORCPT + 99 others); Sun, 17 May 2020 11:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727981AbgEQPum (ORCPT ); Sun, 17 May 2020 11:50:42 -0400 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51405C061A0C for ; Sun, 17 May 2020 08:50:42 -0700 (PDT) Received: by mail-ua1-x931.google.com with SMTP id 14so991726uaq.11 for ; Sun, 17 May 2020 08:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nrqyWKwX+Fo3y6zOYpSb7pR9qyYbIYzcbk9GR/Z/Ams=; b=HrDveH5Pm5KAxHjik/u2RQB4xO6NSUjnWMOdvIhtxte52w5d+kAC88zVAsILxJJ/+g ezY/v3ndryuUXHH1OEVKpk23Sfy0Ohp7XyeB+gqobKrs4Jn/yLT6sgl9XBjXk8t2kOPq ag2Lbs9mYqknkLkhLQBCN4sviUplllFWTF89nUGxsTLgHQNGUCxg06E1JFteTcYFucLL fXELzo/ENJn1w8D3joljU5vgGzLEVSDP5aEvDMdfi7JaSQH5ncljsHaE2Yg2VOnXl6c2 m5j/n4kFW93CzaWJmAnbA1shVlbpnqPeyT3XFDuIb+/caoFs3Z8FZyd/TxePp060kFb4 IIIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nrqyWKwX+Fo3y6zOYpSb7pR9qyYbIYzcbk9GR/Z/Ams=; b=XgRPujcq6MYXsC/v0w5PjphKES+nJ8naIWkmsnJes3TplLzuv3lK8K8TlkvJmPQKry 3xRfYUDJDGdJMQXY3ylKb7KRDIJtJP7kPXLsD+KTtu7HhUlmNKfZ04yY7M/Iv8M4HPMV 7sEu+yMSqlej3XexRbUEuzT26tSuaLlZSC5/RoPnvqZsR8OESFs1QH5wZCY6Selna3cv Ns2920iCYjIgKUt4PWUzP4YG8+4uRXh9rrl2OoxF9xFKhwtuMfvs6VgIfMHRxIx/iMR6 qsjiYXZJEyASNtQXDRGfTuVlHfaKGKxxzJvZjezUM2y73q2Oed5gfpLvVQmt/qSkIqeZ MDpg== X-Gm-Message-State: AOAM532dbWk1gt/lx1KmdJv/HqeE0UfG79BJoqj2inY6ZXvTvJt1g4mT gEIBHHe2TT0keBIxcXiqTLsVJCoobyaCnRjv2V7DNQ== X-Received: by 2002:ab0:d97:: with SMTP id i23mr7457516uak.106.1589730641263; Sun, 17 May 2020 08:50:41 -0700 (PDT) MIME-Version: 1.0 References: <20200515105203.2792466-1-emil.l.velikov@gmail.com> <134d34de7e35861f33d3a1d9ffd8a70b0f92df33.camel@perches.com> In-Reply-To: From: Emil Velikov Date: Sun, 17 May 2020 16:47:52 +0100 Message-ID: Subject: Re: get_maintainer.pl: unexpected behaviour for path/to//file To: Joe Perches Cc: "Linux-Kernel@Vger. Kernel. Org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 May 2020 at 18:22, Joe Perches wrote: > > 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); This seems like the better option since it also handles path traversal. I would expect that people don't use it, yet who knows. Thanks for the prompt fix. -Emil