WIP: Preserve PATH - #1083
WIP: Preserve PATH#1083stacyharper wants to merge 2 commits into
Conversation
We already re-order them in src/shared/misc.c env_config. Here we just have to add this libexec part to have access to einfo, etc...
Before re-ordering parts, store the initial value as RC_PREV_PATH, and restore this just before stripping RC_* values on start-stop-daemon and supervise-daemon.
| export PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin:@LOCAL_PREFIX@/bin:@LOCAL_PREFIX@/sbin$(_sanitize_path)" | ||
| unset _sanitize_path | ||
| # Add libexec to PATH | ||
| export PATH="@LIBEXECDIR@/bin:$PATH" |
There was a problem hiding this comment.
maybe we also have to add LOCAL_PREFIX/{,s}bin?
There was a problem hiding this comment.
local prefix is /usr/local or /usr/pkg, if we're not adding system paths like /bin, it'd be consistent to not add /usr/local either
also, env_config already adds RC_LIBEXECDIR "/bin", /bin, /sbin, /usr/bin, and /usr/sbin to PATH
it also still reorders the path, to put those first, now that i look at it
lastly we shouldn't change functions.sh unconditionally, it can be sourced by other scripts via /etc/init.d/functions.sh, if we're removing that bit of code, probably better to guard it behind RC_OPENRC_PID being defined
| export PATH="@LIBEXECDIR@/bin:/bin:/sbin:/usr/bin:/usr/sbin:@LOCAL_PREFIX@/bin:@LOCAL_PREFIX@/sbin$(_sanitize_path)" | ||
| unset _sanitize_path | ||
| # Add libexec to PATH | ||
| export PATH="@LIBEXECDIR@/bin:$PATH" |
There was a problem hiding this comment.
also this could store RC_PREV_PATH if not set, so that we drop this LIBEXECDIR/bin later
There was a problem hiding this comment.
start-stop-daemon and supervise-daemon already strip that entry from path before starting the daemon, fwiw
Seems to works, but is it okay? Also should we now add PATH as user allow env list?