Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp722794ybx; Tue, 5 Nov 2019 04:38:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzAXfj0vbLAx1DksQqz3vrsCO1BhBykoZZDPEj48LmNh8O7t+n1hmNuJxvSVr8vsMo+Cyq8 X-Received: by 2002:a05:6402:1850:: with SMTP id v16mr18232211edy.301.1572957489386; Tue, 05 Nov 2019 04:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572957489; cv=none; d=google.com; s=arc-20160816; b=NNEgXZzTz/OCmnfpmxyCH2j15kMCI/xNHK1G4KwMdOrAZa6g9cm2XjfJgLUopcNMJk 2hpWq84k7Q9lwcIya4HKHeqnvufVa+7M2TRKBBNHiaTAb5SlpypwiUcI5XjpPRWHDhnV w8ls8uUcdqIQ+NNluVZEQldE2OI28qFLq3cwquPi3dgZBwNaRP2axWT7RnIr3p2Ha0XK J4XfZ8oUakkjgei+OGlrsQ9hmRbYkREfNhLgocYCwvl8wHsvEGcScJl+iMSvtvEjH92r el0Mf8fjkLWTHAcnfI41++QQJhe0GsjQUBckYNRNTI3SrkcWgNBeWMQoz6S4LHTraPnB L5cw== 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=0rmIwrv4WOccxJgb1JuQiBA2NZ0NkzzD5T4PMCgtTp4=; b=MMl/TUpqf3+bhAlw21LepleN/lIM6iYMau2T4cllzyprQNXOvzXqW0pTk27/RXHMkD O+2PplG39YI8t3W0A4VrmBY/eGVgvH9INjV7+EHAv+y2s/xMGun1YDUgBsjM+KhF1KHD nejeT/haBMee61yDolRTLBJt0yU5Z39FbTccRCUEDwTctoAk04tpLLDNvZGbgwTF5eDD k5wZIN1lbhUWLLCidwu3cB+HRTr9DiJcSTNciw5QL5lPDk7sCFzG89Rpl2wCvEAJE2B7 h/W1eajs2WRg4j523+YzldIBJViltuNMM+oZPcIOvoSkm0bVoHwU2J6vgo2uicLYIUsd l54w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=abKJuiCG; 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 j25si13477311ejt.4.2019.11.05.04.37.45; Tue, 05 Nov 2019 04:38:09 -0800 (PST) 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=abKJuiCG; 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 S2388456AbfKEMhJ (ORCPT + 99 others); Tue, 5 Nov 2019 07:37:09 -0500 Received: from conssluserg-06.nifty.com ([210.131.2.91]:55578 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388033AbfKEMhJ (ORCPT ); Tue, 5 Nov 2019 07:37:09 -0500 Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) (authenticated) by conssluserg-06.nifty.com with ESMTP id xA5CapXV020211 for ; Tue, 5 Nov 2019 21:36:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com xA5CapXV020211 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572957412; bh=0rmIwrv4WOccxJgb1JuQiBA2NZ0NkzzD5T4PMCgtTp4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=abKJuiCGFJFcMlPjRkNpoftmHIm2UrRcaT4BGuXFOwXUjz1Rq2/ZlF42XmggjZmpQ RtLzRvZL5Ih96LYhiU4to75vJXiTa/WPUxiGh4S42JlTj8UOScAGVN+eo/6SEutp77 yw9YEzqze8NTK6g+jGRYh1pRCWZyz9NBgR2NHcTAoHLDCpw0LlPDMu09g+R3OaHxSW fEJ/rslPn5kEXrTQlM8wyBH0gT20XBJeqTfA3H19kJyRSLPtiAKKYcl33rWV3duWYW zxXTkOdF2rDlvlL48z47J11QuFH9yNLS5iZFy36ZzmEj6VaDFHryLJDlesu88mp/Ur 2zr5aHpi84sYw== X-Nifty-SrcIP: [209.85.222.45] Received: by mail-ua1-f45.google.com with SMTP id c16so6075842uan.0 for ; Tue, 05 Nov 2019 04:36:51 -0800 (PST) X-Gm-Message-State: APjAAAXfrx5ATPaq9vM2Ynpj5265XsOdMfRBPE1UgrkAhVZzxj0CDZx0 PqIVWpMt1opPaf1PE7ajX5vgvZN5sOLXrbQhRDU= X-Received: by 2002:a9f:2382:: with SMTP id 2mr14642498uao.95.1572957410640; Tue, 05 Nov 2019 04:36:50 -0800 (PST) MIME-Version: 1.0 References: <20191105121103.31200-1-jeyu@kernel.org> In-Reply-To: <20191105121103.31200-1-jeyu@kernel.org> From: Masahiro Yamada Date: Tue, 5 Nov 2019 21:36:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] 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, Nov 5, 2019 at 9:11 PM 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. > > In addition, put quotes in the variable assignment of mod_source_files > to prevent any shell interpretation and field splitting. > > Signed-off-by: Jessica Yu > --- Reviewed-by: Masahiro Yamada > > v2: put quotes around mod_source_files variable assignment as suggested by Masahiro. > > scripts/nsdeps | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/nsdeps b/scripts/nsdeps > index dda6fbac016e..04cea0921673 100644 > --- a/scripts/nsdeps > +++ b/scripts/nsdeps > @@ -31,12 +31,12 @@ 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 > + 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 > -- > 2.16.4 > -- Best Regards Masahiro Yamada