conf-parser: let's explicitly deprecate .include in unit files

.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.
This commit is contained in:
Lennart Poettering 2018-02-23 20:46:38 +01:00
parent 37cbc1d579
commit 41b283d0f1
1 changed files with 4 additions and 0 deletions

View File

@ -211,6 +211,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 systemd. "
"Please use drop-in files instead.");
fn = file_in_same_dir(filename, strstrip(l+9));
if (!fn)
return -ENOMEM;