Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4356270ybg; Tue, 29 Oct 2019 06:02:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaDeLvUe0eIoCPMqhA+cmUpesqZ98MPzeoRX3pjIQiEEjG5MNHWaqRMTMZ16jH5OTalK+z X-Received: by 2002:aa7:c5c5:: with SMTP id h5mr8821080eds.87.1572354172663; Tue, 29 Oct 2019 06:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572354172; cv=none; d=google.com; s=arc-20160816; b=ExkVBAtZwNsz5SrDLg2K8LfcIJJJ4X3VkhlMypIhHLz90A3YapCX68kb2umCmVD6bX i3yhb/gbONe752yWPztF7rifs69+TZl5sq5biDCWJIumpWzLb2ZE/2GhR95fsM+qSaQ2 HUPpxhBkPdOBGglVgOjeUFd9KvDAOirISOka9wFDgQkDceYCgZsQV9u+wcLvrjsQahIY 73mW+L/TUwxsyXW+p327vELFkVSM8WeqCa4iuBchL6UlyzoMjqz0R6h6QGOR06I1OfOg hIvggySJ7KIWV8IXRV7ipVPTKPiabjVhkrHJn1e5ZMZPAYIkAe+Ly/rZ0GMEM4kbPaIl XAZg== 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=HrCvaHFmrS5y9/Pm9TPIG1FtoBKHhaBS1kbDIT2tZyI=; b=X6PCdl7UBBYtm6mfKKmdyWIojkEyIcRhJMmDceW6y3EyCZ9E19oXqvgfTcSVLzM8+y ELUmWI406DV/YnFlGswHRMNYaDr6sDUN/z3ohCWNaltKOQKQoe2ZPmLLLh4sockhppGb B59/mjek4Sf2A1cv7Yfx/fhMgJ/12ilVs11hJsM6UbsEmcR//dBx6c1matFN14JUF+Wz hLMy8QPQMrKKdeSvhlnZ0i/ZBwaRBKCFnGufV5Z3f9xV7x2dYyX4lLS1dA9EP9P55Gsx sTDd0JQcMvHGAjaOM49sFdR4lI4rKVWg6Juqfxi0HhgRJ3jzlTfa0kF2f7pUdMRPoKMo jJmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="tSBY/GyL"; 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 h43si9640958edb.89.2019.10.29.06.02.23; Tue, 29 Oct 2019 06:02:52 -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="tSBY/GyL"; 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 S2388182AbfJ2M6Z (ORCPT + 99 others); Tue, 29 Oct 2019 08:58:25 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:22235 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729253AbfJ2M6Y (ORCPT ); Tue, 29 Oct 2019 08:58:24 -0400 Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) (authenticated) by conssluserg-05.nifty.com with ESMTP id x9TCw2dG012049 for ; Tue, 29 Oct 2019 21:58:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com x9TCw2dG012049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572353883; bh=HrCvaHFmrS5y9/Pm9TPIG1FtoBKHhaBS1kbDIT2tZyI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tSBY/GyL/fSzY3Hx62G6OjoSOpXFt0JDgXeC769iaR33H+gHK3UnYHOjjIZKTBLy/ dl9Iw/NRcQJL71Umqo3RLESx7n2reS4bOoz9fdhfCU8wUfN7E8m/8wb1oBZ/rT3uOB K3mFlKqek2FUF7/6dKaGnXWzocXpQijJZGE3fW71OChCORQXIxbMu8KLS9GW/MhYce Qxaw5Eu4GNqv0y63HxQM4jCBgttsYkd5f1yrCimpO0B770kwPkOF6f6z+rr6b375Po WMGSoMoZFGUr4Lrju5jdr4u5k6n2nFes7ywauKVttGdkQA9ICsF/uLxk/tzZAGqqk1 ZSkYJF964g5aA== X-Nifty-SrcIP: [209.85.222.47] Received: by mail-ua1-f47.google.com with SMTP id d19so1584790uaq.11 for ; Tue, 29 Oct 2019 05:58:03 -0700 (PDT) X-Gm-Message-State: APjAAAV36Dr8ufFdK89KDp5Ie7foXnpeN48lhzgUNugT3VF4LCwEb3PV qYPYup69B1kXKPA5Y5FdcBcaW3xT8H3BDki5NmY= X-Received: by 2002:ab0:658d:: with SMTP id v13mr4905800uam.40.1572353882089; Tue, 29 Oct 2019 05:58:02 -0700 (PDT) MIME-Version: 1.0 References: <20191028151427.31612-1-jeyu@kernel.org> <20191028151427.31612-4-jeyu@kernel.org> In-Reply-To: <20191028151427.31612-4-jeyu@kernel.org> From: Masahiro Yamada Date: Tue, 29 Oct 2019 21:57:26 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/4] scripts/nsdeps: make sure to pass all module source files to spatch 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: > > The nsdeps script passes a list of the module source files to > generate_deps_for_ns() as a space delimited string named $mod_source_files, > which then passes it to spatch. But since $mod_source_files is not encased > in quotes, each source file in that string is treated as a separate shell > function argument (as $2, $3, $4, etc.). However, the spatch invocation > only refers to $2, so only the first file out of $mod_source_files is > processed by spatch. > > This causes problems (namely, the MODULE_IMPORT_NS() statement doesn't > get inserted) when a module is composed of many source files and the > "main" module file containing the MODULE_LICENSE() statement is not the > first file listed in $mod_source_files. Fix this by encasing > $mod_source_files in quotes so that the entirety of the string is > treated as a single argument and can be referred to as $2. > > Signed-off-by: Jessica Yu > --- > scripts/nsdeps | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/nsdeps b/scripts/nsdeps > index 9ddcd5cb96b1..5055b059a81b 100644 > --- a/scripts/nsdeps > +++ b/scripts/nsdeps > @@ -36,7 +36,7 @@ generate_deps() { > | 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 > + generate_deps_for_ns $ns "$mod_source_files" > # sort the imports > for source_file in $mod_source_files; do > sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp I think this change is correct, but did you succeed in nsdeps for composite modules with this patch only? I think the following is needed too: diff --git a/scripts/nsdeps b/scripts/nsdeps index dda6fbac016e..5a23ea616446 100644 --- a/scripts/nsdeps +++ b/scripts/nsdeps @@ -31,9 +31,9 @@ generate_deps() { local mod_file=`echo $@ | sed -e 's/\.ko/\.mod/'` local ns_deps_file=`echo $@ | sed -e 's/\.ko/\.ns_deps/'` if [ ! -f "$ns_deps_file" ]; then return; fi - local mod_source_files=`cat $mod_file | sed -n 1p \ + local mod_source_files="`cat $mod_file | sed -n 1p \ | sed -e 's/\.o/\.c/g' \ - | sed "s|[^ ]* *|${srctree}/&|g"` + | sed "s|[^ ]* *|${srctree}/&|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 Without this, a module that consists of two files will be expanded to: local mod_source_files=source1.c source2.c -- Best Regards Masahiro Yamada