All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/nsdeps: escape '/' for module source files
@ 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:14 ` [PATCH] scripts/nsdeps: escape '/' for module source files David Laight
  0 siblings, 2 replies; 11+ messages in thread
From: Jessica Yu @ 2019-10-21 14:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthias Maennich, Masahiro Yamada, Jessica Yu

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"`
 	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
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-10-23 10:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 14:51 [PATCH] scripts/nsdeps: escape '/' for module source files 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 ` [PATCH] scripts/nsdeps: escape '/' for module source files David Laight
2019-10-22 11:05   ` Jessica Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.