Skip to contentSkip to conversation

kernel-shark: Let polkit decide the environment and path of kshark-record

PATCH In review Steven Rostedt 2 participants 5 messages Jul 25, 2019 – Jul 26, 2019

lore
Share & tools
lore
#0 lore raw

cover kernel-shark: Let polkit decide the environment and path of kshark-record

As the policy defined in the polkit actions for KernelShark Record define both the environment ($DISPLAY and $XAUTHORITY) as well as the path to the executible, no need to add hacks to the kshark-su-record that is used. Just revert the code that did so.

Steven Rostedt (VMware) (2):
kernel-shark: Revert adding environment variables to kshark-su-record
kernel-shark: Revert adding relative path to policy installation

----

 kernel-shark/bin/kshark-su-record | 3 +--
 kernel-shark/src/CMakeLists.txt   | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/2 kernel-shark: Revert adding environment variables to kshark-su-record

From: "Steven Rostedt (VMware)" <[email protected]>

This reverts:

8eb0d753e ("kernel-shark: Execute kshark-record from same dir as kshark-su-record") b084eb5aa ("kernel-shark: Set the DISPLAY environment for pkexec kshark-record")

As the policykit (when installed correctly), should handle both the path to the executable, as well as the DISPLAY and XAUTHORITY environment variables.

---
 kernel-shark/bin/kshark-su-record | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel-shark/bin/kshark-su-record +1 -2
index c14f03da9684..70d781d84335 100755
@@ -2,5 +2,4 @@
 
 xhost +si:localuser:root &>/dev/null
 
-THIS_DIR=`dirname $0`
-pkexec env DISPLAY=${DISPLAY} ${THIS_DIR}/kshark-record -o ${PWD}/trace.dat
+pkexec kshark-record -o ${PWD}/trace.dat
Signature · 1 line
2.20.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] kernel-shark: Revert adding environment variables to kshark-su-record

Quoted 11 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

This reverts:

8eb0d753e ("kernel-shark: Execute kshark-record from same dir as kshark-su-record") b084eb5aa ("kernel-shark: Set the DISPLAY environment for pkexec kshark-record")

As the policykit (when installed correctly), should handle both the path to the executable, as well as the DISPLAY and XAUTHORITY environment variables.

Quoted 16 lines
---
  kernel-shark/bin/kshark-su-record | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
kernel-shark/bin/kshark-su-record +1 -2
index c14f03da9684..70d781d84335 100755
@@ -2,5 +2,4 @@
 
  xhost +si:localuser:root &>/dev/null
 
-THIS_DIR=`dirname $0`
-pkexec env DISPLAY=${DISPLAY} ${THIS_DIR}/kshark-record -o ${PWD}/trace.dat
+pkexec kshark-record -o ${PWD}/trace.dat
#3 lore raw

PATCH 2/2 kernel-shark: Revert adding relative path to policy installation

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

This reverts the change in a45ab5a44 ("kernel-shark: Remove hard-coded install paths") that removed the full path of installing org.freedesktop.kshark-record.policy to a relative path. This means if we installed in /usr/local/bin the policy still needs to go into /usr/share/polkit-1/actions/

This does not affect DESTDIR, as installing still goes in the relative path from DESTDIR for package maintainers.

---
 kernel-shark/src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel-shark/src/CMakeLists.txt +1 -1
index d91c3650f0dd..21494cccaf55 100644
@@ -93,7 +93,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
             DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME})
 
     install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
-            DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/)
+            DESTINATION /usr/share/polkit-1/actions/)
 
     install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
             DESTINATION ${_INSTALL_PREFIX}/bin/)
Signature · 1 line
2.20.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] kernel-shark: Revert adding relative path to policy installation

Quoted 8 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

This reverts the change in a45ab5a44 ("kernel-shark: Remove hard-coded install paths") that removed the full path of installing org.freedesktop.kshark-record.policy to a relative path. This means if we installed in /usr/local/bin the policy still needs to go into /usr/share/polkit-1/actions/

Quoted 5 lines

This does not affect DESTDIR, as installing still goes in the relative path from DESTDIR for package maintainers.

Thanks!

Quoted 18 lines
---
  kernel-shark/src/CMakeLists.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel-shark/src/CMakeLists.txt +1 -1
index d91c3650f0dd..21494cccaf55 100644
@@ -93,7 +93,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
              DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME})
 
      install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
-            DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/)
+            DESTINATION /usr/share/polkit-1/actions/)
 
      install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
              DESTINATION ${_INSTALL_PREFIX}/bin/)