File 0001-test4.patch of Package systemd

From 394590cd0c97020bc5c850157486610d3f6560ef Mon Sep 17 00:00:00 2001
From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Date: Tue, 23 Dec 2025 11:09:56 +0100
Subject: [PATCH] test4

---
 src/shared/install.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/shared/install.c b/src/shared/install.c
index eee3d09206..e90faada38 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2584,13 +2584,16 @@ static int path_shall_revert(const LookupPaths *lp, const char *path) {
         /* Checks whether the path is one where the drop-in directories shall be removed. */
 
         r = path_is_config(lp, path, true);
+        log_error("ANTONIO path_shall_revert() path_is_config() path=%s r=%d", path, r);
         if (r != 0)
                 return r;
 
         r = path_is_control(lp, path);
+        log_error("ANTONIO path_shall_revert() path_is_control() path=%s r=%d", path, r);
         if (r != 0)
                 return r;
 
+        log_error("ANTONIO path_shall_revert() path_is_transient() path=%s r=%d", path, r);
         return path_is_transient(lp, path);
 }
 
@@ -2626,6 +2629,8 @@ int unit_file_revert(
         STRV_FOREACH(name, names) {
                 bool has_vendor = false;
 
+log_error("ANTONIO unit_file_revert() STRV_FOREACH name=%s", *name);
+
                 if (!unit_name_is_valid(*name, UNIT_NAME_ANY))
                         return -EINVAL;
 
@@ -2634,16 +2639,21 @@ int unit_file_revert(
                         struct stat st;
 
                         path = path_make_absolute(*name, *p);
+log_error("ANTONIO unit_file_revert() STRV_FOREACH2 path=%s", path);
                         if (!path)
                                 return -ENOMEM;
 
                         r = RET_NERRNO(lstat(path, &st));
+log_error("ANTONIO unit_file_revert() lstat(path) r=%d", r);
                         if (r < 0) {
-                                if (r != -ENOENT)
+                                if (r != -ENOENT) {
+log_error("ANTONIO unit_file_revert() r != -ENOENT");
                                         return install_changes_add(changes, n_changes, r, path, NULL);
+}
                         } else if (S_ISREG(st.st_mode)) {
                                 /* Check if there's a vendor version */
                                 r = path_is_vendor_or_generator(&lp, path);
+log_error("ANTONIO unit_file_revert() path_is_vendor_or_generator() r=%d", r);
                                 if (r < 0)
                                         return install_changes_add(changes, n_changes, r, path, NULL);
                                 if (r > 0)
@@ -2655,12 +2665,16 @@ int unit_file_revert(
                                 return -ENOMEM;
 
                         r = RET_NERRNO(lstat(dropin, &st));
+log_error("ANTONIO unit_file_revert() lstat(dropin) r=%d", r);
                         if (r < 0) {
-                                if (r != -ENOENT)
+                                if (r != -ENOENT) {
+log_error("ANTONIO unit_file_revert() r != -ENOENT");
                                         return install_changes_add(changes, n_changes, r, dropin, NULL);
+}
                         } else if (S_ISDIR(st.st_mode)) {
                                 /* Remove the drop-ins */
                                 r = path_shall_revert(&lp, dropin);
+log_error("ANTONIO unit_file_revert() path_shall_revert() r=%d", r);
                                 if (r < 0)
                                         return install_changes_add(changes, n_changes, r, dropin, NULL);
                                 if (r > 0) {
@@ -2674,21 +2688,28 @@ int unit_file_revert(
 
                 if (!has_vendor)
                         continue;
+log_error("ANTONIO unit_file_revert() has_vendor => CONTINUE");
 
                 /* OK, there's a vendor version, hence drop all configuration versions */
                 STRV_FOREACH(p, lp.search_path) {
-                        _cleanup_free_ char *path = NULL;
+                        _cleanup_free_ char *path = NULL, *target = NULL;
                         struct stat st;
 
                         path = path_make_absolute(*name, *p);
+log_error("ANTONIO unit_file_revert() STRV_FOREACH2 path=%s", path);
                         if (!path)
                                 return -ENOMEM;
 
                         r = RET_NERRNO(lstat(path, &st));
+log_error("ANTONIO unit_file_revert() lstat(path) r=%d", r);
                         if (r < 0) {
                                 if (r != -ENOENT)
                                         return install_changes_add(changes, n_changes, r, path, NULL);
                         } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+                                if (S_ISLNK(st.st_mode) && readlink_malloc(path, &target) == 0 && streq(target, "/run/systemd/preset-mask")) {
+log_error("ANTONIO unit_file_revert() CONTINUE target=%s", target);
+                                        continue;
+}
                                 r = path_is_config(&lp, path, true);
                                 if (r < 0)
                                         return install_changes_add(changes, n_changes, r, path, NULL);
-- 
2.51.0

openSUSE Build Service is sponsored by