From patchwork Wed Mar 18 15:10:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrewp@carallon.com X-Patchwork-Id: 451496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 0938914008F for ; Thu, 19 Mar 2015 02:10:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4DD9030649; Wed, 18 Mar 2015 15:10:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xh02VszHRcdi; Wed, 18 Mar 2015 15:10:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id BF8D4312D1; Wed, 18 Mar 2015 15:10:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 2B0061C2605 for ; Wed, 18 Mar 2015 15:10:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 263D091AAF for ; Wed, 18 Mar 2015 15:10:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zAJ3Ji9LtqN7 for ; Wed, 18 Mar 2015 15:10:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.carallon.com (mail.carallon.com [95.177.28.122]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1D1D791A88 for ; Wed, 18 Mar 2015 15:10:39 +0000 (UTC) X-MDAV-Result: clean X-MDAV-Processed: mail.carallon.com, Wed, 18 Mar 2015 15:10:38 +0000 Received: from animal.office.carallon.com by mail.carallon.com (MDaemon PRO v14.5.3) with ESMTPA id md50001890486.msg for ; Wed, 18 Mar 2015 15:10:37 +0000 X-Spam-Processed: mail.carallon.com, Wed, 18 Mar 2015 15:10:37 +0000 (not processed: message from trusted or authenticated source) X-MDHelo: animal.office.carallon.com X-MDArrival-Date: Wed, 18 Mar 2015 15:10:37 +0000 X-Authenticated-Sender: andrewp@carallon.com X-Return-Path: prvs=15194353be=andrewp@carallon.com X-Envelope-From: andrewp@carallon.com X-MDaemon-Deliver-To: buildroot@busybox.net From: andrewp@carallon.com To: buildroot@busybox.net Date: Wed, 18 Mar 2015 15:10:29 +0000 Message-Id: <1426691429-38936-1-git-send-email-andrewp@carallon.com> X-Mailer: git-send-email 2.1.4 Subject: [Buildroot] [PATCH 1/1] target-finalize: Use NULL deliminators when stripping the target directory. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Andrew Parlane Special characters in files or directories in the rootfs can cause problems when stripping files. For example "target/some song.mp3" gets treated as two entries. "target/some" and "song.mp3" are both passed to $(STRIPCMD). This then errors saying files don't exist. Additionally a ' and possibly other special characters in a file path causes xargs to give the error: "xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option". This also has the effect of removing this entry and further entries from the list of files to strip. This can be demonstrated by having a test directory with the files: "cat" "rabbit's" "elephant". then running the command: "find -name "*" -print | xargs" To fix this we pass -print0 to find which seperates entries with a NULL character, and we pass -0 to xargs to tell it to only use NULL characters as the deliminator. Signed-off-by: Andrew Parlane --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index af043a3..33a89b1 100644 --- a/Makefile +++ b/Makefile @@ -500,7 +500,7 @@ STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \) # applications and libraries. Normally kernel modules are already excluded # by the executable permission check above, so the explicit exclusion is only # done for kernel modules with incorrect permissions. -STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print +STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0 ifeq ($(BR2_ECLIPSE_REGISTER),y) define TOOLCHAIN_ECLIPSE_REGISTER @@ -579,7 +579,7 @@ endif rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc rm -rf $(TARGET_DIR)/usr/share/gtk-doc -rmdir $(TARGET_DIR)/usr/share 2>/dev/null - $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true + $(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