Revert "tree-wide: use CONF_FILES_CHASE_BASENAME where root directory is specified"

This reverts commit 6b606f3586.

The commit was mistakenly merged without review, and has several issues.
Let's revert at least now.
This commit is contained in:
Yu Watanabe
2025-06-28 22:52:22 +09:00
parent dbe13de11c
commit b351ebdc97
5 changed files with 7 additions and 17 deletions

View File

@@ -450,9 +450,7 @@ int catalog_update(const char *database, const char *root, const char* const *di
dirs = catalog_file_dirs;
_cleanup_strv_free_ char **files = NULL;
r = conf_files_list_strv(&files, ".catalog", root,
CONF_FILES_REGULAR | CONF_FILES_CHASE_BASENAME | CONF_FILES_FILTER_MASKED,
dirs);
r = conf_files_list_strv(&files, ".catalog", root, 0, dirs);
if (r < 0)
return log_error_errno(r, "Failed to get catalog files: %m");

View File

@@ -601,9 +601,7 @@ int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool co
trie->nodes_count++;
err = conf_files_list_strv(&files, ".hwdb", root,
CONF_FILES_REGULAR | CONF_FILES_CHASE_BASENAME | CONF_FILES_FILTER_MASKED,
conf_file_dirs);
err = conf_files_list_strv(&files, ".hwdb", root, 0, conf_file_dirs);
if (err < 0)
return log_error_errno(err, "Failed to enumerate hwdb files: %m");

View File

@@ -3298,9 +3298,7 @@ static int presets_find_config(RuntimeScope scope, const char *root_dir, char **
else
assert_not_reached();
return conf_files_list_strv(files, ".preset", root_dir,
CONF_FILES_REGULAR | CONF_FILES_CHASE_BASENAME | CONF_FILES_FILTER_MASKED,
dirs);
return conf_files_list_strv(files, ".preset", root_dir, 0, dirs);
}
static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePresets *presets) {

View File

@@ -282,9 +282,7 @@ static int search_rules_file(const char *s, const char *root, char ***files) {
if (r == -EISDIR) {
_cleanup_strv_free_ char **files_in_dir = NULL;
r = conf_files_list_strv(&files_in_dir, ".rules", root,
CONF_FILES_REGULAR | CONF_FILES_CHASE_BASENAME | CONF_FILES_FILTER_MASKED,
STRV_MAKE_CONST(s));
r = conf_files_list_strv(&files_in_dir, ".rules", root, 0, (const char* const*) STRV_MAKE_CONST(s));
if (r < 0)
return log_error_errno(r, "Failed to enumerate rules files in '%s': %m", resolved);
@@ -311,9 +309,7 @@ int search_rules_files(char * const *a, const char *root, char ***ret) {
assert(ret);
if (strv_isempty(a)) {
r = conf_files_list_strv(&files, ".rules", root,
CONF_FILES_REGULAR | CONF_FILES_CHASE_BASENAME | CONF_FILES_FILTER_MASKED,
(const char* const*) CONF_PATHS_STRV("udev/rules.d"));
r = conf_files_list_strv(&files, ".rules", root, 0, (const char* const*) CONF_PATHS_STRV("udev/rules.d"));
if (r < 0)
return log_error_errno(r, "Failed to enumerate rules files: %m");

View File

@@ -130,9 +130,9 @@ assert_1 --root="${workdir}"
cp "${workdir}/output_0_files" "${exo}"
assert_0 "${rules_dir}"
# Directory with an invalid loop.
# Directory with a loop.
ln -s . "${rules_dir}/loop.rules"
assert_0 "${rules_dir}"
assert_1 "${rules_dir}"
rm "${rules_dir}/loop.rules"
# Empty rules.