Avoid early pipefail exits due to grep failures in stage comparisons.

If objects or executables did not contain any RPATH, grep would return
nonzero, and the whole stage comparison loop would unexpectedly exit.
Fix this by checking the grep result explicitly.

llvm-svn: 242722
This commit is contained in:
Dimitry Andric 2015-07-20 22:24:40 +00:00
parent 424452513e
commit 52a143a5d9
1 changed files with 6 additions and 4 deletions

View File

@ -359,12 +359,14 @@ function clean_RPATH() {
local InstallPath="$1"
for Candidate in `find $InstallPath/{bin,lib} -type f`; do
if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
rpath=`objdump -x $Candidate | grep 'RPATH' | sed -e's/^ *RPATH *//'`
if rpath=`objdump -x $Candidate | grep 'RPATH'` ; then
rpath=`echo $rpath | sed -e's/^ *RPATH *//'`
if [ -n "$rpath" ]; then
newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
fi
fi
fi
done
}