Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4171714ybg; Tue, 29 Oct 2019 03:16:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8tpJpVymVbY5hvL9hHyXfKhb3Slu3mwBrM2/vlbfTeXhwpt8M4BRi7y/LE0c3hMOWmLFH X-Received: by 2002:a05:6402:1212:: with SMTP id c18mr25230609edw.166.1572344187426; Tue, 29 Oct 2019 03:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572344187; cv=none; d=google.com; s=arc-20160816; b=Ss17v11OhO/6WC6W6rHHEvn9frqB3tC80YVEWUKadWOs3RgD7t2BqFCzRNa37ycWjq BmrNsFJ7kbVXB5le0SuJQm6Vr/rPk9fsQYpasqX9FQTxWOolvsYyI+hegCNpMCd2i30U Lq2nycl2Gc7QSTNFMeLJHNuf2lnxsbh3iX0XpzEpof2U+lId11AtbS6tv8FyvQrMxA2J /dX611cYvhDL3HiIDQ3O0LanfO24/xR/gBXAK7CtmGRW7E5syymfm91g+cJ9u4C9oTtz c5Lm35Q68RT0uIm+D4HAo88qr17tQHmrXBTxpH1LyOuOVpQndAInRt9RFB6ivc0/1MO9 iUrA== 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:dkim-filter; bh=+/K1RqI9siavtLEr0TWeAkjkdDG3eqQS0XFehoqiblU=; b=jNDPX09tX714scGsB/EIvWepERezDtnEvRmDHNmzbApdug2u5kshQ+7XRQN3kot+mJ cmr7+wYeqrN/Eg4h8SrJ48pDXQu0LtARu9+phoZD+QYj9PwixsfBCSEyM8TRsDoL2V5t ITDVOPXGGy6CeDEgQpSCki5qpaPKtyJWRq443S8w7/blfZSCGeUJg40M5jixCR0WWn2A asvec8PK672SIIBalCgtGXpNupDygzkegbX0zuRZgeGPqstB8mf+HE0IR+JgQtCmY5e4 hhuGaVPqkyb/Vys3pkCBJmwRFvZpoa/jIYP43jRTrBPbxUphLUcp8E/+X0wzp7W1R7pk Sa5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=TEd1HyK7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k16si1210274eji.401.2019.10.29.03.16.04; Tue, 29 Oct 2019 03:16:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=TEd1HyK7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730362AbfJ2JAj (ORCPT + 99 others); Tue, 29 Oct 2019 05:00:39 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:46954 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730295AbfJ2JAj (ORCPT ); Tue, 29 Oct 2019 05:00:39 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x9T90I6e018762 for ; Tue, 29 Oct 2019 18:00:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x9T90I6e018762 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572339619; bh=+/K1RqI9siavtLEr0TWeAkjkdDG3eqQS0XFehoqiblU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TEd1HyK7gcvoQcmz0wBWMxh+fgtGxNDT8l07Tg2aFlAdy8W3SFiRtiM2yzWumfu6N 995bqtnTiMj/ntRL5SOg48q9kO3S4Jwnx0vAv9oqnYp7HfYriLOPJD6TtO0yd7grsV Ai8c3SC+obHSUIGCJENxaDy4sd+VmGFuuXmZgOmx4ntzqXzK5Q8FzjVFy+JBpv53Tk APGTv5RxKNFsUdpb2GKgXJLS+vb3Ytky7DxfoVzGK4lnJPvfnPPcTM3O2Ivp7ggGiG IKUyhVc3x59ZCR38NGKu2DliCDKvECvP0KvLM4NoeCZyz4cBbcovaPExtdZkQ38//m P5avVDBlTozZA== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id a143so7413497vsd.9 for ; Tue, 29 Oct 2019 02:00:18 -0700 (PDT) X-Gm-Message-State: APjAAAUjvghShOoRIS6epPpjomp0rxL0aVsnksigxfZXd1GqhXoL1wwy nn3B9V+jQryyIpQBzDkjmBGwsKHKWjMgpctC+Eo= X-Received: by 2002:a67:d091:: with SMTP id s17mr1021583vsi.215.1572339617763; Tue, 29 Oct 2019 02:00:17 -0700 (PDT) MIME-Version: 1.0 References: <20191028151427.31612-1-jeyu@kernel.org> <20191028151427.31612-2-jeyu@kernel.org> In-Reply-To: <20191028151427.31612-2-jeyu@kernel.org> From: Masahiro Yamada Date: Tue, 29 Oct 2019 17:59:41 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/4] scripts/nsdeps: don't prepend $srctree if *.mod already contains full paths To: Jessica Yu Cc: Linux Kernel Mailing List , Matthias Maennich 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 Tue, Oct 29, 2019 at 12:14 AM Jessica Yu wrote: > > When building in-tree modules, the *.mod file contains relative paths. > When building external modules, the resulting *.mod file contains absolute > paths. Not necessarily true. Kbuild does not impose any restriction about absolute/relative path. M= can be a relative path. > Allow for the nsdeps script to account for both types of paths and > only prepend $srctree in the case of relative paths. Otherwise, the script > will append $srctree to the path regardless and it will error out with file > not found errors if the path was already absolute to begin with. > > Signed-off-by: Jessica Yu > --- > > The sed regex is getting more ugly. It's not my strong point :/ If anyone > has a better regex to prepend $srctree for every relative path encountered > while ignoring absolute paths, I'm all ears. It is not the problem of sed regex ugliness. You can prefix $srctree/ unlesss building external modules. if [ "$KBUILD_EXTMOD" ]; then src_prefix= else src_prefix=$srctree/ fi Then, sed "s|[^ ]* *|${src_prefix}&|g"` Caution: not tested at all > scripts/nsdeps | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/nsdeps b/scripts/nsdeps > index 54d2ab8f9e5c..9ddcd5cb96b1 100644 > --- a/scripts/nsdeps > +++ b/scripts/nsdeps > @@ -33,7 +33,7 @@ generate_deps() { > if [ ! -f "$ns_deps_file" ]; then return; fi > local mod_source_files=`cat $mod_file | sed -n 1p \ > | sed -e 's/\.o/\.c/g' \ > - | sed "s|[^ ]* *|${srctree}/&|g"` > + | sed -E "s%(^|\s)([^/][^ ]*)%\1$srctree/\2%g"` > for ns in `cat $ns_deps_file`; do > echo "Adding namespace $ns to module $mod_name (if needed)." > generate_deps_for_ns $ns $mod_source_files > -- > 2.16.4 > -- Best Regards Masahiro Yamada