summaryrefslogtreecommitdiffstats
path: root/debian/patches/debian/Downgrade-a-couple-of-warnings-to-debug.patch
blob: 39166cbac6e69f27fdffcfd249e33195fb90ccd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From: Michael Biebl <biebl@debian.org>
Date: Tue, 16 Feb 2021 00:18:50 +0100
Subject: Downgrade a couple of warnings to debug

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
---
 src/core/load-fragment.c            | 4 +++-
 src/sysv-generator/sysv-generator.c | 2 +-
 src/tmpfiles/tmpfiles.c             | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0baf08e..8eec584 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -544,6 +544,7 @@ static int patch_var_run(
 
         const char *e;
         char *z;
+        int log_level;
 
         e = path_startswith(*path, "/var/run/");
         if (!e)
@@ -553,7 +554,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);
 
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 4485e2e..d0e8ed8 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -762,7 +762,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",
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 4919cb7..be24b04 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -3257,6 +3257,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);
@@ -3282,7 +3283,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);