]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "pretty-print: also chase symlinks in the last component"
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 28 Jun 2025 13:54:04 +0000 (22:54 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 29 Jun 2025 01:15:56 +0000 (10:15 +0900)
This reverts commit 2f2977cab8ee94e5479d86c93c7a4346789a920a.

The commit was mistakenly merged without review. Also as pointed at
https://github.com/systemd/systemd/pull/37972#discussion_r2173234198
now the output is confusing. Let's revert at least now.

src/shared/pretty-print.c

index 55bc585b833a7aa9165fea3d25ab7815482087ed..8be99a8d3f4cf6ab5cb19002d952491c18d51f94 100644 (file)
@@ -6,7 +6,6 @@
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "chase.h"
 #include "color-util.h"
 #include "conf-files.h"
 #include "constants.h"
@@ -419,16 +418,12 @@ int conf_files_cat(const char *root, const char *name, CatFlags flags) {
         /* First locate the main config file, if any */
         if (!is_collection) {
                 STRV_FOREACH(prefix, prefixes) {
-                        _cleanup_free_ char *p = path_join(*prefix, name);
-                        if (!p)
+                        path = path_join(root, *prefix, name);
+                        if (!path)
                                 return log_oom();
-
-                        r = chase_and_access(p, root, CHASE_PREFIX_ROOT, F_OK, &path);
-                        if (r < 0) {
-                                if (r != -ENOENT)
-                                        log_debug_errno(r, "Failed to chase %s%s, ignoring: %m", strempty(root), p);
-                                continue;
-                        }
+                        if (access(path, F_OK) == 0)
+                                break;
+                        path = mfree(path);
                 }
 
                 if (!path)
@@ -439,7 +434,7 @@ int conf_files_cat(const char *root, const char *name, CatFlags flags) {
         }
 
         /* Then locate the drop-ins, if any */
-        r = conf_files_list_strv(&files, extension, root, CONF_FILES_CHASE_BASENAME, (const char* const*) dirs);
+        r = conf_files_list_strv(&files, extension, root, 0, (const char* const*) dirs);
         if (r < 0)
                 return log_error_errno(r, "Failed to query file list: %m");