Re: [PATCH 1/2] kernel-shark: Execute kshark-record from same dir as kshark-su-record

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 25 Jul 2019 12:01:34 +0300
"Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote:


> I just realized that there is one problem with the patch. With this 
> modification, you can use only the installed version of the script (so 
> you more or less depend on PATH).
> 
> This will work:
>   kshark-su-record
> 
> This will work as well:
>   /usr/local/bin/kshark-su-record
> 
> However this will not work:
>   kernel-shark/bin/kshark-su-record
> 
> because you are trying to start with pkexec an executable from your $HOME

What about this patch?

-- Steve

diff --git a/kernel-shark/bin/kshark-su-record b/kernel-shark/bin/kshark-su-record
index 8c9fbd02a351..152d0cdff3e7 100755
--- a/kernel-shark/bin/kshark-su-record
+++ b/kernel-shark/bin/kshark-su-record
@@ -6,4 +6,8 @@ then
 fi
 
 THIS_DIR=`dirname $0`
+if [ "${THIS_DIR#/}" == "${THIS_DIR}" ]
+then
+    THIS_DIR=`pwd`"/$THIS_DIR"
+fi
 pkexec env DISPLAY=${DISPLAY} ${THIS_DIR}/kshark-record -o ${PWD}/trace.dat



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux