From 2d2ba482a77ac385b318afe2f4db22ceaad70d76 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 27 Jul 2012 17:38:37 +0000 Subject: backported from rpm.org (Jeff Tickle , 2011-09-06) $RPM_BUILD_ROOT breaks brp-* scripts if it contains spaces (ticket #843) - This patch adds quotes around $RPM_BUILD_ROOT in places that I noticed they were missing, and attempts to handle some of the problems that can occur when looping over the output of find. --- NEWS | 2 ++ brp-compress | 2 +- brp-strip | 2 +- brp-strip-comment-note | 2 +- brp-strip-static-archive | 2 +- find-debuginfo.sh | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index c0dbe4c..17725b5 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ o add -r flag to find-debuginfo.sh to invoke eu-strip --reloc-debug-sections o drop useless rpm5 bits (less divergence with upstream) - kill unused find-provides.perl.in +- prevent RPM_BUILD_ROOT to break brp-* scripts if it contains spaces + (rpm.org#843) Version 1.151 - 26 Jul 2012, by Thierry Vignaud - fix %_libexecdir that changed to %_libdir when mga forked mdv diff --git a/brp-compress b/brp-compress index b1bf0dc..6912d66 100755 --- a/brp-compress +++ b/brp-compress @@ -7,7 +7,7 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then exit 0 fi -cd $RPM_BUILD_ROOT +cd "$RPM_BUILD_ROOT" # Compress man pages COMPRESS="bzip2 -9" diff --git a/brp-strip b/brp-strip index 6f0388c..7f52ed1 100755 --- a/brp-strip +++ b/brp-strip @@ -5,7 +5,7 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then fi # Strip ELF binaries -for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ +for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \ grep -v ' shared object,' | \ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do diff --git a/brp-strip-comment-note b/brp-strip-comment-note index 0985795..3d7ad4e 100755 --- a/brp-strip-comment-note +++ b/brp-strip-comment-note @@ -6,7 +6,7 @@ fi # Strip .comment and .note sections (the latter only if it is not allocated) # for already stripped elf files in the build root -for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ +for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \ sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do note="-R .note" diff --git a/brp-strip-static-archive b/brp-strip-static-archive index 6831239..366d597 100755 --- a/brp-strip-static-archive +++ b/brp-strip-static-archive @@ -5,7 +5,7 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then fi # Strip static libraries. -for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \ +for f in `find "$RPM_BUILD_ROOT" -type f -a -exec file {} \; | \ grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \ grep 'current ar archive' | \ sed -n -e 's/^\(.*\):[ ]*current ar archive/\1/p'`; do diff --git a/find-debuginfo.sh b/find-debuginfo.sh index ef2c5c4..a0a83e4 100755 --- a/find-debuginfo.sh +++ b/find-debuginfo.sh @@ -253,7 +253,7 @@ done || exit # For each symlink whose target has a .debug file, # make a .debug symlink to that file. -find $RPM_BUILD_ROOT ! -path "${debugdir}/*" -type l -print | +find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print | while read f do t=$(readlink -m "$f").debug -- cgit v1.2.1