From 96de029ad794fbdb8f8e864691463ffdcb1b5a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 1 Sep 2026 12:34:03 +0200 Subject: [PATCH] basic/path-util: stop ignoring non-absolute paths 112cfb181453e38d3ef4a74fba23abbb53392002 tried to improve handling of paths when root is specified. It said: > To avoid answering what a relative path means when called with a root > prefix path_strv_canonicalize is now path_strv_canonicalize_absolute > and only considers absolute paths. Fortunately all users of already call > path_strv_canonicalize with a list of absolute paths. Of course, other users were added later and for example now SYSTEMD_HOSTNAME_WORDLIST_PATH=build/hostname-wordlist/ ... doesn't work as expected. If root is not specified, there is really no reason to ignore relative paths. They work relative to CWD per the usual convention. It's up to the user to not use relative paths in a context where they should not be used. When root is specified, continue to ignore the relative paths, since there is no clear interpreation what they mean, but emit a debug message. --- src/basic/path-util.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index b41029b157..71486cc9e0 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -264,20 +264,20 @@ char** path_strv_resolve(char **l, const char *root) { if (strv_isempty(l)) return l; - /* Goes through every item in the string list and canonicalize - * the path. This works in place and won't rollback any - * changes on failure. */ + /* Go through every item in the string list and canonicalize the path. + * This works in place and doesn't roll back any changes on failure. */ STRV_FOREACH(s, l) { _cleanup_free_ char *orig = NULL; char *t, *u; - if (!path_is_absolute(*s)) { - free(*s); - continue; - } - if (root) { + if (!path_is_absolute(*s)) { + log_debug("Ignoring non-absolute search path '%s'.", *s); + free(*s); + continue; + } + orig = *s; t = path_join(root, orig); if (!t) {