Skip to contentSkip to conversation

Makefile: Handle whitespace when stripping .ko

PATCH New Erico Nunes 2 participants 2 messages May 9, 2015 – May 10, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Handle whitespace when stripping .ko

It is possible to end up with a path containing spaces if the kernel localversion contains spaces.
Be it good practice or not, there are third party vendors which distribute kernel configuration files for reference platforms which have quoted strings containing whitespaces in the localversion.

There was already a fix to handle paths with whitespaces or other special characters when running strip, which consists of using the find -print0 and xargs -0 pair of arguments, but the kernel module stripping wasn't included in the fix.
This commit includes the same fix to the kernel module stripping line.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 282c7ea..b0e6915 100644
@@ -562,8 +562,8 @@ endif
 	-rmdir $(TARGET_DIR)/usr/share 2>/dev/null
 	$(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
 	if test -d $(TARGET_DIR)/lib/modules; then \
-		find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
-		xargs -r $(KSTRIPCMD); fi
+		find $(TARGET_DIR)/lib/modules -type f -name '*.ko' -print0 | \
+		xargs -0 -r $(KSTRIPCMD); fi
 
 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
 # besides the one in which crash occurred; or SIGTRAP kills my program when
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 Makefile: Handle whitespace when stripping .ko

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Erico" == Erico Nunes <[email protected]> writes:

It is possible to end up with a path containing spaces if the kernel localversion contains spaces.
Be it good practice or not, there are third party vendors which distribute kernel configuration files for reference platforms which have quoted strings containing whitespaces in the localversion.

Quoted 7 lines

There was already a fix to handle paths with whitespaces or other special characters when running strip, which consists of using the find -print0 and xargs -0 pair of arguments, but the kernel module stripping wasn't included in the fix.
This commit includes the same fix to the kernel module stripping line.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard