Skip to content
Commit 7c5beb97 authored by Konstantinos Smanis's avatar Konstantinos Smanis
Browse files

Properly handle the $PATH environment variable in the helper.

D-Bus activation erases most environment variables, but we need at least
$PATH set for the scripts we execute, or else they malfuntion.

In the past, we used to pass the $PATH from the main application to the
helper but this was just a crude workaround.

What we do now is launch a login shell (1) and 'echo $PATH' in it.
This way:
1. We don't miss paths which are not available to the user
   (e.g. /sbin/, /usr/sbin/, /usr/local/sbin/).
2. We honor the precedence of paths as set in $PATH by the user.
3. We only use the user's $PATH (D-Bus activation works for non-root
   users too).

There are still certain shortcomings (such as some shells not being
compliant) but this is the best we can do. Ideas on how best handle
this issue are most welcome.

(1) The reason why we need a login shell is documented in the code.
parent a13dc8ae
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment