Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp716460ybx; Tue, 5 Nov 2019 04:31:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyHxJZFqZREpDLZiNMAxqyZqmqKlPP9Dd9U2gU8vTD7egWBonvBDEj0Z+oZh2Yl2RjmMbgX X-Received: by 2002:a50:b6cb:: with SMTP id f11mr35255570ede.299.1572957117926; Tue, 05 Nov 2019 04:31:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572957117; cv=none; d=google.com; s=arc-20160816; b=hG5z3SYcp1Tlhma31g0P+MuielRgb/PoJl81p6UOItsmbTlOS5KWzqWyexeRSs8Zu9 qx1TeEa2N66R0t3gLDMJY0O1EAXyw5S83FhAVyjmLzf2PzFqGRvDb+aXd7aW+y2F9gJP ImFPJWS2tTQC4+BP5EuUrQhhT9W/wLRkUdvNLujWnxyriQwHhUhXjVuT0ygQfXYF6+8n 6R189eZaqsFW7CE2mBGy5xdrOAkmeK0oZt2tsOrsnLUPObmxMluPmPyTyqja4w5QO0Gf dKhzGH1AcXxW8+/oPpent9dKXm0Wgqgv2MPBtILbOdvw/VA4IorVf0eT3DPKwoARzZo+ cRKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=3ZD4BJKSwMpj5uVK8MnJhahAK6Z3dTrY0UQeuz1FL+Y=; b=COXN9lZf12lIB1tp70GwNBBT85+QFyITZKXaTVmhInz18MbWusrcF5TTUOeT/BGy0m +1FkCdlDKih7X6AFILVEO6G392w4fSnhU2LGJ299EbxXbLHarh2/WSyATdlNAaKQF+Wg fvC6g7pbnSMf4GA8Mq0A8p3xeIZmsGVr1QuZfE7Uls4xBbASw8r5jBhm2+dqkrTjRfca uPnyxbbBTit+P9oH3b+9is+Jl9oKLzE4xlxjskc/k79Q80GPTMYqYv51UVynq/cC7Jyl XwXkbnzq26p3OvypcgTlFMsZmkrf3WJnWZQBOUh/MR9sjWoSbq1yR4fkCB2O5IvymyCn tG+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L1gSlu2y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si9248376edv.282.2019.11.05.04.31.33; Tue, 05 Nov 2019 04:31:57 -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=@kernel.org header.s=default header.b=L1gSlu2y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387962AbfKEMLv (ORCPT + 99 others); Tue, 5 Nov 2019 07:11:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:48394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbfKEMLv (ORCPT ); Tue, 5 Nov 2019 07:11:51 -0500 Received: from linux-8ccs.suse.de (tmo-106-21.customers.d1-online.com [80.187.106.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BC53205C9; Tue, 5 Nov 2019 12:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572955910; bh=81u2VMBen3B/7k/5sAtqBanmflObbTNuEldBN2Pu/uQ=; h=From:To:Cc:Subject:Date:From; b=L1gSlu2yMnfCGlOAPLbXw8nEDWD0CGRSXmhgvCpNiwTESuZOYbvSkHdL/cEZOkQ3Z aCBc+yywUP0aYVXymIgu3Bj+jLIznsa+FjCUXKBLkau7HHKE/aRhH0+zNOaUx7Acn4 uyZWwWHd8XcwoBFkhNDMJXC/wizJqOa9uoHN/5bc= From: Jessica Yu To: linux-kernel@vger.kernel.org Cc: Matthias Maennich , Masahiro Yamada , Jessica Yu Subject: [PATCH v2] scripts/nsdeps: make sure to pass all module source files to spatch Date: Tue, 5 Nov 2019 13:11:03 +0100 Message-Id: <20191105121103.31200-1-jeyu@kernel.org> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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