On 20 Jul 2015, at 23:34, Hans Wennborg <h...@chromium.org> wrote:
> 
> On Sun, Jul 19, 2015 at 8:32 AM, Dimitry Andric <dimi...@andric.com> wrote:
...
>> The line can be replaced with this instead:
>> 
>>      rpath=`objdump -x $Candidate | sed -ne'/RPATH/{s/^ *RPATH *//;p;}'`
> 
> How about just guarding it with an if statement? I'm worried about
> adding non-obvious commands to the script, both for making it harder
> to understand and for portability.

It should be portable enough, as this works with with BSD and GNU sed,
but it may indeed be harder to understand.  So how about this:

Index: test-release.sh
===================================================================
--- test-release.sh     (revision 242721)
+++ test-release.sh     (working copy)
@@ -359,10 +359,12 @@ 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 [ -n "$rpath" ]; then
-        newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
-        chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
+      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

-Dimitry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
lldb-dev mailing list
lldb-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to