chiark / gitweb /
conf-parser: let's explicitly deprecate .include in unit files
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Feb 2018 19:46:38 +0000 (20:46 +0100)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
.include lines are already deprecated somewhat, and for example
explicitly not mentioned in the documentation for this reason. Let's get
one step further and generatea warning when we encounter them (but still
process them).

Why are they deprecated? Because they are semantically awful — they
complicate stat() based mtime checks for configuration files and they
allow arbitrary loops we currently have zero protection against and
really shouldn't have to have.

src/shared/conf-parser.c

index ccc102ffa282f5d735db27c58b1d7488798a7ed3..8a88820a1f18f59cee6534e3db4871ac5977a373 100644 (file)
@@ -215,6 +215,10 @@ static int parse_line(
                         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 elogind. "
+                           "Please use drop-in files instead.");
+
                 fn = file_in_same_dir(filename, strstrip(l+9));
                 if (!fn)
                         return -ENOMEM;