summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/systemd.exec.xml7
-rw-r--r--meson.build11
-rw-r--r--meson_options.txt2
-rw-r--r--src/basic/path-util.h12
-rw-r--r--src/test/test-path-util.c6
5 files changed, 26 insertions, 12 deletions
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 0d3645f19f..307913aa16 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -2384,10 +2384,9 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy
in the system manager. When compiled for systems with "unmerged /usr" (<filename>/bin</filename> is
not a symlink to <filename>/usr/bin</filename>),
<literal>:<filename>/sbin</filename>:<filename>/bin</filename></literal> is appended. In case of the
- the user manager, each <filename>bin/</filename> and <filename>sbin/</filename> pair is switched, so
- that programs from <filename>/usr/bin</filename> have higher priority than programs from
- <filename>/usr/sbin</filename>, etc. It is recommended to not rely on this in any way, and have only
- one program with a given name in <varname>$PATH</varname>.</para></listitem>
+ the user manager, a different path may be configured by the distribution. It is recommended to not
+ rely on the order of entries, and have only one program with a given name in
+ <varname>$PATH</varname>.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/meson.build b/meson.build
index 61c2d6aa95..c27deffa8e 100644
--- a/meson.build
+++ b/meson.build
@@ -834,6 +834,16 @@ conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
conf.set10('VALGRIND', get_option('valgrind'))
conf.set10('LOG_TRACE', get_option('log-trace'))
+default_user_path = get_option('user-path')
+if default_user_path != ''
+ conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
+ default_user_path_display = default_user_path
+else
+ # meson 0.49 fails when ?: is used in .format()
+ default_user_path_display = '(same as system services)'
+endif
+
+
#####################################################################
threads = dependency('threads')
@@ -3129,6 +3139,7 @@ status = [
'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
'default KillUserProcesses setting: @0@'.format(kill_user_processes),
'default locale: @0@'.format(default_locale),
+ 'default user $PATH: @0@'.format(default_user_path_display),
'systemd service watchdog: @0@'.format(watchdog_opt)]
alt_dns_servers = '\n '.join(dns_servers.split(' '))
diff --git a/meson_options.txt b/meson_options.txt
index 0919577fd7..79b09e021c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -59,6 +59,8 @@ option('valgrind', type : 'boolean', value : false,
description : 'do extra operations to avoid valgrind warnings')
option('log-trace', type : 'boolean', value : false,
description : 'enable low level debug logging')
+option('user-path', type : 'string',
+ description : '$PATH to use for user sessions')
option('utmp', type : 'boolean',
description : 'support for utmp/wtmp log handling')
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 71fb7041a3..111d85d445 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -11,41 +11,37 @@
#include "time-util.h"
#define PATH_SPLIT_SBIN_BIN(x) x "sbin:" x "bin"
-#define PATH_SPLIT_BIN_SBIN(x) x "bin:" x "sbin"
#define PATH_SPLIT_SBIN_BIN_NULSTR(x) x "sbin\0" x "bin\0"
#define PATH_NORMAL_SBIN_BIN(x) x "bin"
-#define PATH_NORMAL_BIN_SBIN(x) x "bin"
#define PATH_NORMAL_SBIN_BIN_NULSTR(x) x "bin\0"
#if HAVE_SPLIT_BIN
# define PATH_SBIN_BIN(x) PATH_SPLIT_SBIN_BIN(x)
-# define PATH_BIN_SBIN(x) PATH_SPLIT_BIN_SBIN(x)
# define PATH_SBIN_BIN_NULSTR(x) PATH_SPLIT_SBIN_BIN_NULSTR(x)
#else
# define PATH_SBIN_BIN(x) PATH_NORMAL_SBIN_BIN(x)
-# define PATH_BIN_SBIN(x) PATH_NORMAL_BIN_SBIN(x)
# define PATH_SBIN_BIN_NULSTR(x) PATH_NORMAL_SBIN_BIN_NULSTR(x)
#endif
#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
-#define DEFAULT_USER_PATH_NORMAL PATH_BIN_SBIN("/usr/local/") ":" PATH_BIN_SBIN("/usr/")
#define DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/")
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
-#define DEFAULT_USER_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_BIN_SBIN("/")
#define DEFAULT_PATH_SPLIT_USR_NULSTR DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/")
#define DEFAULT_PATH_COMPAT PATH_SPLIT_SBIN_BIN("/usr/local/") ":" PATH_SPLIT_SBIN_BIN("/usr/") ":" PATH_SPLIT_SBIN_BIN("/")
#if HAVE_SPLIT_USR
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
-# define DEFAULT_USER_PATH DEFAULT_USER_PATH_SPLIT_USR
# define DEFAULT_PATH_NULSTR DEFAULT_PATH_SPLIT_USR_NULSTR
#else
# define DEFAULT_PATH DEFAULT_PATH_NORMAL
-# define DEFAULT_USER_PATH DEFAULT_USER_PATH_NORMAL
# define DEFAULT_PATH_NULSTR DEFAULT_PATH_NORMAL_NULSTR
#endif
+#ifndef DEFAULT_USER_PATH
+# define DEFAULT_USER_PATH DEFAULT_PATH
+#endif
+
bool is_path(const char *p) _pure_;
int path_split_and_make_absolute(const char *p, char ***ret);
bool path_is_absolute(const char *p) _pure_;
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index ece3eb427c..46cdbaf5cc 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -15,6 +15,11 @@
#include "tests.h"
#include "util.h"
+static void test_print_paths(void) {
+ log_info("DEFAULT_PATH=%s", DEFAULT_PATH);
+ log_info("DEFAULT_USER_PATH=%s", DEFAULT_USER_PATH);
+}
+
#define test_path_compare(a, b, result) { \
assert_se(path_compare(a, b) == result); \
assert_se(path_compare(b, a) == -result); \
@@ -659,6 +664,7 @@ static void test_path_startswith_strv(void) {
int main(int argc, char **argv) {
test_setup_logging(LOG_DEBUG);
+ test_print_paths();
test_path();
test_path_equal_root();
test_find_binary(argv[0]);