Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5796281ybg; Tue, 22 Oct 2019 08:30:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2Hapz1HPQanW3QGe+Yw7gQzVk/j0CHKPB88CiZzXj8C8XD4PhT8Es1WqWAeDQ497/hFp1 X-Received: by 2002:a17:906:c2d8:: with SMTP id ch24mr16717422ejb.105.1571758226183; Tue, 22 Oct 2019 08:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571758226; cv=none; d=google.com; s=arc-20160816; b=dkuG3dgI/Ywgk1vBVTDjQehXEH4sAswEf8+B8USnCwexfdt6/izkt5LGKlX3Bu97Qv JlPKwvJNwJ4Tlqy/WeSwL/d1FVSo8mrYcjEP36rA06X5akp+uPx6p9TM1vBzp229aGsb 2ps7KxrztjFqPLycAvAvd9/57pYvfp0CTscXhjxb1eq7S4HNwJzifHz0mWipPeAoU0L+ SX4RaxOeTf2iAxuGDEp1h+/v6WGuPqeZtoetu3EYz7/J8d6MWuC6JgT866HvdNNZ4Rb0 0kbgD2zM4z+2gj2K0ScPArhOjyhmvnOx5ItwJlDXkfxbxUxntbKEcZUe2tFfthtt0QEk /XDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=N8crc7qhnYMfrKcyHR03v0rXNKQ977jPYidCHY7c5H0=; b=wip13CaNAcEg+g/D7z8qn7B27FlWOaTMU0wpZXweLuoDjRC5gKW0f5woSnmwiFVVse xwNrXO+JOZb9RRosdoyaJgTtZw1nK/dMDndlRlOfn2P0ytK9bhwSxoLVwgmxjdQ/dkdy REXmPI58ObQ88Mq/EfGN02QoC1YZL5AE2SbL1x2/ZgvcCzw0RtONJpCioVgY5QyMu7MH xy36pwSgIinVcIuQMdwa/KAymUUBVA22wZwPLAyK93D/GKDadVZvje/0S3iR+Fg/JTh4 A2JXLoOqg34gq3QbTxwjLUY1UBzwx/kt6jI9qufNo3LBs+fu+Q487K34hpQYK6Rsh8a5 mfkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=15osuNyR; 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 q18si7987086eda.291.2019.10.22.08.30.01; Tue, 22 Oct 2019 08:30:26 -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=@kernel.org header.s=default header.b=15osuNyR; 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 S1730768AbfJVLFn (ORCPT + 99 others); Tue, 22 Oct 2019 07:05:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:53322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730718AbfJVLFn (ORCPT ); Tue, 22 Oct 2019 07:05:43 -0400 Received: from linux-8ccs (ip5f5ade81.dynamic.kabel-deutschland.de [95.90.222.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4DA12184C; Tue, 22 Oct 2019 11:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571742342; bh=dwIMSlnuYx3Xbr72RF9B+7TOlYhW4NUL37tzRmG6lCM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=15osuNyRo14dz2IxnQRPk3dvXs1YvmzcoxOAjG8I3ef/cPX8TMT3vwhy0SIFUtjUi kVEHW34OBv6ocaAcwdrNTx6ooIvNVpBjBb5Sav1vvDQPFWObuM4mhHi9iDh9sqBJJm G0PJlBfCcI0EGsWgOmltSaEL6CIWzYgZkM+Ax/UE= Date: Tue, 22 Oct 2019 13:05:33 +0200 From: Jessica Yu To: David Laight Cc: "linux-kernel@vger.kernel.org" , Matthias Maennich , Masahiro Yamada Subject: Re: [PATCH] scripts/nsdeps: escape '/' for module source files Message-ID: <20191022110533.GA16208@linux-8ccs> References: <20191021145137.31672-1-jeyu@kernel.org> <51d0f654a1d94c7d90eb56ee8eac7209@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <51d0f654a1d94c7d90eb56ee8eac7209@AcuMS.aculab.com> X-OS: Linux linux-8ccs 4.12.14-lp150.12.28-default x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ David Laight [21/10/19 16:14 +0000]: >From Jessica Yu >> Sent: 21 October 2019 15:52 >> When doing an out of tree build with O=, the nsdeps script constructs >> the absolute pathname of the module source file so that it can insert >> MODULE_IMPORT_NS statements in the right place. However, ${srctree} >> contains an unescaped path to the source tree, which, when used in a sed >> substitution, makes sed complain: >> >> ++ sed 's/[^ ]* *//home/jeyu/jeyu-linux\/&/g' >> sed: -e expression #1, char 12: unknown option to `s' >> >> The sed substitution command 's' ends prematurely with the forward >> slashes in the pathname, and sed errors out when it encounters the 'h', >> which is an invalid sed substitution option. So use bash in-variable >> substitution to escape all forward slashes for sed. >> >> Signed-off-by: Jessica Yu >> --- >> scripts/nsdeps | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/scripts/nsdeps b/scripts/nsdeps >> index 3754dac13b31..79f96e596a0b 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 "s/[^ ]* */${srctree//\//\\\/}\/&/g"` > >Rather than adding a bashism - which might bight back later, just change the >command to use (say) ; instead of / as the separator. >I think that makes it: > sed "s;[^ ]* *;${srctree}/&;g > > David Thanks David! Matthias suggested this as well and so I've sent a v3.