Downgrade a couple of warnings to debug
authorMichael Biebl <biebl@debian.org>
Mon, 15 Feb 2021 23:18:50 +0000 (00:18 +0100)
committerLuca Boccassi <bluca@debian.org>
Sat, 30 Sep 2023 10:34:39 +0000 (11:34 +0100)
If a package still ships only a SysV init script or if a service file or
tmpfile uses /var/run, downgrade those messages to debug. We can use
lintian to detect those issues.
For service files and tmpfiles in /etc, keep the warning, as those files
are typically added locally and aren't checked by lintian.

Closes: #981407
Gbp-Pq: Topic debian
Gbp-Pq: Name Downgrade-a-couple-of-warnings-to-debug.patch

src/core/load-fragment.c
src/sysv-generator/sysv-generator.c
src/tmpfiles/tmpfiles.c

index 219a84a234df7e280b40ff2bad1bceb5ea0fbe86..5fe6ae239b6077aee82036119986c0994bea8a15 100644 (file)
@@ -546,6 +546,7 @@ static int patch_var_run(
 
         const char *e;
         char *z;
+        int log_level;
 
         e = path_startswith(*path, "/var/run/");
         if (!e)
@@ -555,7 +556,8 @@ static int patch_var_run(
         if (!z)
                 return log_oom();
 
-        log_syntax(unit, LOG_NOTICE, filename, line, 0,
+        log_level = path_startswith(filename, "/etc") ? LOG_NOTICE : LOG_DEBUG;
+        log_syntax(unit, log_level, filename, line, 0,
                    "%s= references a path below legacy directory /var/run/, updating %s → %s; "
                    "please update the unit file accordingly.", lvalue, *path, z);
 
index 30f82d573699d3ed4902ede2ea0024f39d82d3f9..2e0e90d7cd2ab3fc6c2bdb41c2a1d18df3927e5a 100644 (file)
@@ -764,7 +764,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
                         if (!fpath)
                                 return log_oom();
 
-                        log_struct(LOG_WARNING,
+                        log_struct(LOG_DEBUG,
                                    LOG_MESSAGE("SysV service '%s' lacks a native systemd unit file. "
                                                "%s Automatically generating a unit file for compatibility. Please update package to include a native systemd unit file, in order to make it safe, robust and future-proof. "
                                                "%s This compatibility logic is deprecated, expect removal soon. %s",
index 2a34d2e5312159222f8a788a3fac67a5a64373a0..52490211e2902f4e91e64f62471c1577c03678fa 100644 (file)
@@ -3158,6 +3158,7 @@ static int specifier_expansion_from_arg(const Specifier *specifier_table, Item *
 static int patch_var_run(const char *fname, unsigned line, char **path) {
         const char *k;
         char *n;
+        int log_level;
 
         assert(path);
         assert(*path);
@@ -3183,7 +3184,8 @@ static int patch_var_run(const char *fname, unsigned line, char **path) {
         /* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence
          * there's no immediate need for action by the user. However, in the interest of making things less confusing
          * to the user, let's still inform the user that these snippets should really be updated. */
-        log_syntax(NULL, LOG_NOTICE, fname, line, 0,
+        log_level = path_startswith(fname, "/etc") ? LOG_NOTICE : LOG_DEBUG;
+        log_syntax(NULL, log_level, fname, line, 0,
                    "Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.",
                    *path, n);