]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: remove support for ".include" stanza
authorLennart Poettering <lennart@poettering.net>
Tue, 2 Jun 2020 10:06:22 +0000 (12:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 3 Jun 2020 16:26:12 +0000 (18:26 +0200)
Six years ago we declared it obsolete and removed it from the docs
(c073a0c4a5ffbf6677dd6af02e7c7d59b2b901ab) and added a note about it in
NEWS. Two years ago we add warning messages about it, indicating the
feature will be removed (41b283d0f1f4abd85d0bbeeb7f71bb30f87cfab9) and
mentioned it in NEWS again.

Let's now kill it for good.

NEWS
man/systemd.unit.xml
src/core/load-fragment.c
src/fuzz/fuzz-unit-file.c
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/install.c

diff --git a/NEWS b/NEWS
index b27d38be77052ce98cbdd714d11f1781c0688d2e..911df9cabb227f4d1aa0f30fb131f5f0fd5797bd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -357,6 +357,11 @@ CHANGES WITH 246 in spe:
           The optional positional argument to "systemctl reboot" is now
           being deprecated in favor of this option.
 
+        * Support for the .include syntax in unit files has been removed. The
+          concept has been obsolete for 6 years and we started warning about
+          its pending removal 2 years ago (also see NEWS file below). It's
+          finally gone now.
+
 CHANGES WITH 245:
 
         * A new tool "systemd-repart" has been added, that operates as an
index cdd7572addb973ebd52ef7c83de24443d0092fb4..8c0815488b1062e9f338ddf4a4da6cda393cb908 100644 (file)
     <filename>foo-.service.d/10-override.conf</filename> would override
     <filename>service.d/10-override.conf</filename>.</para>
 
-    <!-- Note that we do not document .include here, as we consider it mostly obsolete, and want
-         people to use .d/ drop-ins instead. -->
-
     <para>Note that while systemd offers a flexible dependency system
     between units it is recommended to use this functionality only
     sparingly and instead rely on techniques such as bus-based or
index 49fdcaff7e14f573db5d34ab0f296d9f7b404529..517813986b9210c30a86312650c6615571e18605 100644 (file)
@@ -4864,7 +4864,7 @@ int unit_load_fragment(Unit *u) {
                         r = config_parse(u->id, fragment, f,
                                          UNIT_VTABLE(u)->sections,
                                          config_item_perf_lookup, load_fragment_gperf_lookup,
-                                         CONFIG_PARSE_ALLOW_INCLUDE,
+                                         0,
                                          u,
                                          NULL);
                         if (r == -ENOEXEC)
index 34f59a44372c4b07eb5d1d8cfa28e85a35a6f88f..c0661433a31588a843ae437bb9fa2f9ce4520e88 100644 (file)
@@ -74,7 +74,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
                         name, name, f,
                         UNIT_VTABLE(u)->sections,
                         config_item_perf_lookup, load_fragment_gperf_lookup,
-                        CONFIG_PARSE_ALLOW_INCLUDE,
+                        0,
                         u,
                         NULL);
 
index 21226573428f615b7d8815bfe5e55d9458568569..0a59f19e2a6bf2795ca1a5885b8f0bd1855afafa 100644 (file)
@@ -159,7 +159,7 @@ static int parse_line(
                 char *l,
                 void *userdata) {
 
-        char *e, *include;
+        char *e;
 
         assert(filename);
         assert(line > 0);
@@ -173,35 +173,6 @@ static int parse_line(
         if (*l == '\n')
                 return 0;
 
-        include = first_word(l, ".include");
-        if (include) {
-                _cleanup_free_ char *fn = NULL;
-
-                /* .includes are a bad idea, we only support them here
-                 * for historical reasons. They create cyclic include
-                 * problems and make it difficult to detect
-                 * configuration file changes with an easy
-                 * stat(). Better approaches, such as .d/ drop-in
-                 * snippets exist.
-                 *
-                 * Support for them should be eventually removed. */
-
-                if (!(flags & CONFIG_PARSE_ALLOW_INCLUDE)) {
-                        log_syntax(unit, LOG_ERR, filename, line, 0, ".include not allowed here. Ignoring.");
-                        return 0;
-                }
-
-                log_syntax(unit, LOG_WARNING, filename, line, 0,
-                           ".include directives are deprecated, and support for them will be removed in a future version of systemd. "
-                           "Please use drop-in files instead.");
-
-                fn = file_in_same_dir(filename, strstrip(include));
-                if (!fn)
-                        return -ENOMEM;
-
-                return config_parse(unit, fn, NULL, sections, lookup, table, flags, userdata, NULL);
-        }
-
         if (!utf8_is_valid(l))
                 return log_syntax_invalid_utf8(unit, LOG_WARNING, filename, line, l);
 
index 6c8c1092ea57ca0fcff620b6bddb241b2c986167..0eaff0c0e0ea1723b72360d15d0b743372fc8214 100644 (file)
@@ -16,8 +16,7 @@
 
 typedef enum ConfigParseFlags {
         CONFIG_PARSE_RELAXED       = 1 << 0, /* Do not warn about unknown non-extension fields */
-        CONFIG_PARSE_ALLOW_INCLUDE = 1 << 1, /* Allow the deprecated .include stanza */
-        CONFIG_PARSE_WARN          = 1 << 2, /* Emit non-debug messages */
+        CONFIG_PARSE_WARN          = 1 << 1, /* Emit non-debug messages */
 } ConfigParseFlags;
 
 /* Argument list for parsers of specific configuration settings. */
index 5dd5d2aa9ae23147127f4a0df2c6e7e2b1a67c53..bb2eff7387945628764c94aa9e45115e352eafdf 100644 (file)
@@ -1304,7 +1304,7 @@ static int unit_file_load(
                          "-Target\0"
                          "-Timer\0",
                          config_item_table_lookup, items,
-                         CONFIG_PARSE_ALLOW_INCLUDE, info,
+                         0, info,
                          NULL);
         if (r < 0)
                 return log_debug_errno(r, "Failed to parse %s: %m", info->name);