Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4458958ybg; Mon, 21 Oct 2019 09:18:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9sVK67Qz98G0xmllVitXyjgGXjTeSL5KngoiHHhA7Q6DkELrTPNwlxa0WL7fDL6/tNOWx X-Received: by 2002:a17:906:e090:: with SMTP id gh16mr23184103ejb.56.1571674705119; Mon, 21 Oct 2019 09:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571674705; cv=none; d=google.com; s=arc-20160816; b=VBuM9Znb7XL3ZTS1jzgSXd14gsaJftRKZdscaGt1Yv95pSmyMQhfRDZnroysxPKBlO VpxPl1XuM6QePwpBwWq2moK7BB1rEWIcJmAONUZP5l2WXuJOYxJnq+ZHIG2CodIoYNeb ltz27Gk9tdWLLUhmHdsMOrox5Ho2k+v+NNHwvdTIUIeh6j18TCx9ALjxT8wXQ9IIdgDN YH5cP6gcS+9PdDTMzxdzUjE1PiN0E5l34fA4WccpCUPCZMbdsiVWXZ/iLOUkjuZ67+5z deRkq5j2FMsdMjUeF4eCcoOhYmKB2gABzfWVoSYNPhfBzxqVcYlBiTAEtXfeBgUfVxnt LZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=RLUPmIJPLGhOvV7wzWCi61cXh7KNtreB1RayCY48X/0=; b=rxsDX2s57zZPXv3/DGX11US3R5uUEFVzaEtuU5PBwr9okHtjZLdP8ijfMNVnnBiz9s Jdcd10JdA4EPaLYCwiMoWoOxUjt+iRDI0gX2lJA+L4mii8UL5n1e1MsCNY/pAAH6fjHD Z08ptnlBGtnL5fyzIuy2Zd51Rsl/H8jkDirt47B8ivc5Pz1soTW9hwfVXreY5Tv1S6Bg uAbk+CFa6ZT/mF2zmngzI0C9ESWZnnT1pnwBKtedqXwjJAQ4WQa8rQHP1Q06q9GsGRYl Ut73VrI8lKe+hVeweni3KhY2GnUoQ+xPYlnSVutE4VDMcZNQ5JRJSXG7bKCGnkgLvKN8 o4HA== ARC-Authentication-Results: i=1; mx.google.com; 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 l1si9019291ejr.246.2019.10.21.09.18.01; Mon, 21 Oct 2019 09:18:25 -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; 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 S1729898AbfJUQOi convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Oct 2019 12:14:38 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:48101 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbfJUQOi (ORCPT ); Mon, 21 Oct 2019 12:14:38 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-164-yBUMtxjzPbGpm7yEvcnd1w-1; Mon, 21 Oct 2019 17:14:35 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 21 Oct 2019 17:14:34 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 21 Oct 2019 17:14:34 +0100 From: David Laight To: 'Jessica Yu' , "linux-kernel@vger.kernel.org" CC: Matthias Maennich , Masahiro Yamada Subject: RE: [PATCH] scripts/nsdeps: escape '/' for module source files Thread-Topic: [PATCH] scripts/nsdeps: escape '/' for module source files Thread-Index: AQHViB8egCT4CShepk2NuWs8og91m6dlRBcw Date: Mon, 21 Oct 2019 16:14:34 +0000 Message-ID: <51d0f654a1d94c7d90eb56ee8eac7209@AcuMS.aculab.com> References: <20191021145137.31672-1-jeyu@kernel.org> In-Reply-To: <20191021145137.31672-1-jeyu@kernel.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: yBUMtxjzPbGpm7yEvcnd1w-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)