From: David Laight <David.Laight@ACULAB.COM>
To: 'Jessica Yu' <jeyu@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Matthias Maennich <maennich@google.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: RE: [PATCH] scripts/nsdeps: escape '/' for module source files
Date: Mon, 21 Oct 2019 16:14:34 +0000 [thread overview]
Message-ID: <51d0f654a1d94c7d90eb56ee8eac7209@AcuMS.aculab.com> (raw)
In-Reply-To: <20191021145137.31672-1-jeyu@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 <jeyu@kernel.org>
> ---
> 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)
next prev parent reply other threads:[~2019-10-21 16:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 14:51 Jessica Yu
2019-10-21 16:04 ` [PATCH v2] scripts/nsdeps: use alternative sed delimiter Jessica Yu
2019-10-21 16:16 ` Matthias Maennich
2019-10-22 4:37 ` Masahiro Yamada
2019-10-22 10:00 ` Jessica Yu
2019-10-22 11:04 ` [PATCH v3] " Jessica Yu
2019-10-23 1:23 ` Masahiro Yamada
2019-10-23 10:13 ` Matthias Maennich
2019-10-23 10:15 ` Jessica Yu
2019-10-21 16:14 ` David Laight [this message]
2019-10-22 11:05 ` [PATCH] scripts/nsdeps: escape '/' for module source files Jessica Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51d0f654a1d94c7d90eb56ee8eac7209@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maennich@google.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome