richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
d0811f
From 625a164069aff9efb61dcc5916c572f53c2a7ab0 Mon Sep 17 00:00:00 2001
d0811f
From: Lennart Poettering <lennart@poettering.net>
d0811f
Date: Thu, 20 Aug 2020 13:43:00 +0200
d0811f
Subject: [PATCH 1/3] analyze: rework condition testing
d0811f
d0811f
Let's drop the private table and just use the generic concepts we have
d0811f
in place already that make the same information available.
d0811f
d0811f
Fixes: #16781
d0811f
---
d0811f
 src/analyze/analyze-condition.c | 105 +++++++++-----------------------
d0811f
 1 file changed, 28 insertions(+), 77 deletions(-)
d0811f
d0811f
diff --git a/src/analyze/analyze-condition.c b/src/analyze/analyze-condition.c
d0811f
index 52ad382637f..13f75e813a2 100644
d0811f
--- a/src/analyze/analyze-condition.c
d0811f
+++ b/src/analyze/analyze-condition.c
d0811f
@@ -8,83 +8,27 @@
d0811f
 #include "load-fragment.h"
d0811f
 #include "service.h"
d0811f
 
d0811f
-typedef struct condition_definition {
d0811f
-        const char *name;
d0811f
-        ConfigParserCallback parser;
d0811f
-        ConditionType type;
d0811f
-} condition_definition;
d0811f
-
d0811f
-static const condition_definition condition_definitions[] = {
d0811f
-        { "ConditionPathExists",             config_parse_unit_condition_path,   CONDITION_PATH_EXISTS              },
d0811f
-        { "ConditionPathExistsGlob",         config_parse_unit_condition_path,   CONDITION_PATH_EXISTS_GLOB         },
d0811f
-        { "ConditionPathIsDirectory",        config_parse_unit_condition_path,   CONDITION_PATH_IS_DIRECTORY        },
d0811f
-        { "ConditionPathIsSymbolicLink",     config_parse_unit_condition_path,   CONDITION_PATH_IS_SYMBOLIC_LINK    },
d0811f
-        { "ConditionPathIsMountPoint",       config_parse_unit_condition_path,   CONDITION_PATH_IS_MOUNT_POINT      },
d0811f
-        { "ConditionPathIsReadWrite",        config_parse_unit_condition_path,   CONDITION_PATH_IS_READ_WRITE       },
d0811f
-        { "ConditionPathIsEncrypted",        config_parse_unit_condition_path,   CONDITION_PATH_IS_ENCRYPTED        },
d0811f
-        { "ConditionDirectoryNotEmpty",      config_parse_unit_condition_path,   CONDITION_DIRECTORY_NOT_EMPTY      },
d0811f
-        { "ConditionFileNotEmpty",           config_parse_unit_condition_path,   CONDITION_FILE_NOT_EMPTY           },
d0811f
-        { "ConditionFileIsExecutable",       config_parse_unit_condition_path,   CONDITION_FILE_IS_EXECUTABLE       },
d0811f
-        { "ConditionNeedsUpdate",            config_parse_unit_condition_path,   CONDITION_NEEDS_UPDATE             },
d0811f
-        { "ConditionFirstBoot",              config_parse_unit_condition_string, CONDITION_FIRST_BOOT               },
d0811f
-        { "ConditionKernelCommandLine",      config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE      },
d0811f
-        { "ConditionKernelVersion",          config_parse_unit_condition_string, CONDITION_KERNEL_VERSION           },
d0811f
-        { "ConditionArchitecture",           config_parse_unit_condition_string, CONDITION_ARCHITECTURE             },
d0811f
-        { "ConditionVirtualization",         config_parse_unit_condition_string, CONDITION_VIRTUALIZATION           },
d0811f
-        { "ConditionSecurity",               config_parse_unit_condition_string, CONDITION_SECURITY                 },
d0811f
-        { "ConditionCapability",             config_parse_unit_condition_string, CONDITION_CAPABILITY               },
d0811f
-        { "ConditionHost",                   config_parse_unit_condition_string, CONDITION_HOST                     },
d0811f
-        { "ConditionACPower",                config_parse_unit_condition_string, CONDITION_AC_POWER                 },
d0811f
-        { "ConditionUser",                   config_parse_unit_condition_string, CONDITION_USER                     },
d0811f
-        { "ConditionGroup",                  config_parse_unit_condition_string, CONDITION_GROUP                    },
d0811f
-        { "ConditionControlGroupController", config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER },
d0811f
-
d0811f
-        { "AssertPathExists",                config_parse_unit_condition_path,   CONDITION_PATH_EXISTS              },
d0811f
-        { "AssertPathExistsGlob",            config_parse_unit_condition_path,   CONDITION_PATH_EXISTS_GLOB         },
d0811f
-        { "AssertPathIsDirectory",           config_parse_unit_condition_path,   CONDITION_PATH_IS_DIRECTORY        },
d0811f
-        { "AssertPathIsSymbolicLink",        config_parse_unit_condition_path,   CONDITION_PATH_IS_SYMBOLIC_LINK    },
d0811f
-        { "AssertPathIsMountPoint",          config_parse_unit_condition_path,   CONDITION_PATH_IS_MOUNT_POINT      },
d0811f
-        { "AssertPathIsReadWrite",           config_parse_unit_condition_path,   CONDITION_PATH_IS_READ_WRITE       },
d0811f
-        { "AssertPathIsEncrypted",           config_parse_unit_condition_path,   CONDITION_PATH_IS_ENCRYPTED        },
d0811f
-        { "AssertDirectoryNotEmpty",         config_parse_unit_condition_path,   CONDITION_DIRECTORY_NOT_EMPTY      },
d0811f
-        { "AssertFileNotEmpty",              config_parse_unit_condition_path,   CONDITION_FILE_NOT_EMPTY           },
d0811f
-        { "AssertFileIsExecutable",          config_parse_unit_condition_path,   CONDITION_FILE_IS_EXECUTABLE       },
d0811f
-        { "AssertNeedsUpdate",               config_parse_unit_condition_path,   CONDITION_NEEDS_UPDATE             },
d0811f
-        { "AssertFirstBoot",                 config_parse_unit_condition_string, CONDITION_FIRST_BOOT               },
d0811f
-        { "AssertKernelCommandLine",         config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE      },
d0811f
-        { "AssertKernelVersion",             config_parse_unit_condition_string, CONDITION_KERNEL_VERSION           },
d0811f
-        { "AssertArchitecture",              config_parse_unit_condition_string, CONDITION_ARCHITECTURE             },
d0811f
-        { "AssertVirtualization",            config_parse_unit_condition_string, CONDITION_VIRTUALIZATION           },
d0811f
-        { "AssertSecurity",                  config_parse_unit_condition_string, CONDITION_SECURITY                 },
d0811f
-        { "AssertCapability",                config_parse_unit_condition_string, CONDITION_CAPABILITY               },
d0811f
-        { "AssertHost",                      config_parse_unit_condition_string, CONDITION_HOST                     },
d0811f
-        { "AssertACPower",                   config_parse_unit_condition_string, CONDITION_AC_POWER                 },
d0811f
-        { "AssertUser",                      config_parse_unit_condition_string, CONDITION_USER                     },
d0811f
-        { "AssertGroup",                     config_parse_unit_condition_string, CONDITION_GROUP                    },
d0811f
-        { "AssertControlGroupController",    config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER },
d0811f
-
d0811f
-        /* deprecated, but we should still parse them */
d0811f
-        { "ConditionNull",                   config_parse_unit_condition_null,   0                                  },
d0811f
-        { "AssertNull",                      config_parse_unit_condition_null,   0                                  },
d0811f
-};
d0811f
-
d0811f
 static int parse_condition(Unit *u, const char *line) {
d0811f
-        const char *p;
d0811f
-        Condition **target;
d0811f
-
d0811f
-        if ((p = startswith(line, "Condition")))
d0811f
-                target = &u->conditions;
d0811f
-        else if ((p = startswith(line, "Assert")))
d0811f
-                target = &u->asserts;
d0811f
-        else
d0811f
-                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot parse \"%s\".", line);
d0811f
-
d0811f
-        for (size_t i = 0; i < ELEMENTSOF(condition_definitions); i++) {
d0811f
-                const condition_definition *c = &condition_definitions[i];
d0811f
-
d0811f
-                p = startswith(line, c->name);
d0811f
-                if (!p)
d0811f
-                        continue;
d0811f
+        assert(u);
d0811f
+        assert(line);
d0811f
+
d0811f
+        for (ConditionType t = 0; t < _CONDITION_TYPE_MAX; t++) {
d0811f
+                ConfigParserCallback callback;
d0811f
+                Condition **target;
d0811f
+                const char *p, *name;
d0811f
+
d0811f
+                name = condition_type_to_string(t);
d0811f
+                p = startswith(line, name);
d0811f
+                if (p)
d0811f
+                        target = &u->conditions;
d0811f
+                else {
d0811f
+                        name = assert_type_to_string(t);
d0811f
+                        p = startswith(line, name);
d0811f
+                        if (!p)
d0811f
+                                continue;
d0811f
+
d0811f
+                        target = &u->asserts;
d0811f
+                }
d0811f
 
d0811f
                 p += strspn(p, WHITESPACE);
d0811f
 
d0811f
@@ -94,7 +38,14 @@ static int parse_condition(Unit *u, const char *line) {
d0811f
 
d0811f
                 p += strspn(p, WHITESPACE);
d0811f
 
d0811f
-                return c->parser(NULL, "(stdin)", 0, NULL, 0, c->name, c->type, p, target, u);
d0811f
+                if (t == CONDITION_NULL) /* deprecated, but we should still parse this for now */
d0811f
+                        callback = config_parse_unit_condition_null;
d0811f
+                else if (condition_takes_path(t))
d0811f
+                        callback = config_parse_unit_condition_path;
d0811f
+                else
d0811f
+                        callback = config_parse_unit_condition_string;
d0811f
+
d0811f
+                return callback(NULL, "(cmdline)", 0, NULL, 0, name, t, p, target, u);
d0811f
         }
d0811f
 
d0811f
         return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot parse \"%s\".", line);
d0811f
d0811f
From 4f55a5b0bf1e68e4595120d8ac4b518654355fc3 Mon Sep 17 00:00:00 2001
d0811f
From: Lennart Poettering <lennart@poettering.net>
d0811f
Date: Thu, 20 Aug 2020 13:44:12 +0200
d0811f
Subject: [PATCH 2/3] core: add missing conditions/asserts to unit file parsing
d0811f
d0811f
---
d0811f
 src/core/load-fragment-gperf.gperf.m4 | 24 ++++++++++++++++--------
d0811f
 1 file changed, 16 insertions(+), 8 deletions(-)
d0811f
d0811f
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
d0811f
index b9e7769e4e3..1e6bd6483c2 100644
d0811f
--- a/src/core/load-fragment-gperf.gperf.m4
d0811f
+++ b/src/core/load-fragment-gperf.gperf.m4
d0811f
@@ -272,22 +272,26 @@ Unit.ConditionPathIsDirectory,   config_parse_unit_condition_path,   CONDITION_P
d0811f
 Unit.ConditionPathIsSymbolicLink,config_parse_unit_condition_path,   CONDITION_PATH_IS_SYMBOLIC_LINK,offsetof(Unit, conditions)
d0811f
 Unit.ConditionPathIsMountPoint,  config_parse_unit_condition_path,   CONDITION_PATH_IS_MOUNT_POINT, offsetof(Unit, conditions)
d0811f
 Unit.ConditionPathIsReadWrite,   config_parse_unit_condition_path,   CONDITION_PATH_IS_READ_WRITE,  offsetof(Unit, conditions)
d0811f
+Unit.ConditionPathIsEncrypted,   config_parse_unit_condition_path,   CONDITION_PATH_IS_ENCRYPTED,   offsetof(Unit, conditions)
d0811f
 Unit.ConditionDirectoryNotEmpty, config_parse_unit_condition_path,   CONDITION_DIRECTORY_NOT_EMPTY, offsetof(Unit, conditions)
d0811f
 Unit.ConditionFileNotEmpty,      config_parse_unit_condition_path,   CONDITION_FILE_NOT_EMPTY,      offsetof(Unit, conditions)
d0811f
 Unit.ConditionFileIsExecutable,  config_parse_unit_condition_path,   CONDITION_FILE_IS_EXECUTABLE,  offsetof(Unit, conditions)
d0811f
 Unit.ConditionNeedsUpdate,       config_parse_unit_condition_path,   CONDITION_NEEDS_UPDATE,        offsetof(Unit, conditions)
d0811f
 Unit.ConditionFirstBoot,         config_parse_unit_condition_string, CONDITION_FIRST_BOOT,          offsetof(Unit, conditions)
d0811f
-Unit.ConditionKernelCommandLine, config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE, offsetof(Unit, conditions)
d0811f
-Unit.ConditionKernelVersion,     config_parse_unit_condition_string, CONDITION_KERNEL_VERSION,      offsetof(Unit, conditions)
d0811f
 Unit.ConditionArchitecture,      config_parse_unit_condition_string, CONDITION_ARCHITECTURE,        offsetof(Unit, conditions)
d0811f
 Unit.ConditionVirtualization,    config_parse_unit_condition_string, CONDITION_VIRTUALIZATION,      offsetof(Unit, conditions)
d0811f
+Unit.ConditionHost,              config_parse_unit_condition_string, CONDITION_HOST,                offsetof(Unit, conditions)
d0811f
+Unit.ConditionKernelCommandLine, config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE, offsetof(Unit, conditions)
d0811f
+Unit.ConditionKernelVersion,     config_parse_unit_condition_string, CONDITION_KERNEL_VERSION,      offsetof(Unit, conditions)
d0811f
 Unit.ConditionSecurity,          config_parse_unit_condition_string, CONDITION_SECURITY,            offsetof(Unit, conditions)
d0811f
 Unit.ConditionCapability,        config_parse_unit_condition_string, CONDITION_CAPABILITY,          offsetof(Unit, conditions)
d0811f
-Unit.ConditionHost,              config_parse_unit_condition_string, CONDITION_HOST,                offsetof(Unit, conditions)
d0811f
 Unit.ConditionACPower,           config_parse_unit_condition_string, CONDITION_AC_POWER,            offsetof(Unit, conditions)
d0811f
+Unit.ConditionMemory,            config_parse_unit_condition_string, CONDITION_MEMORY,              offsetof(Unit, conditions)
d0811f
+Unit.ConditionCPUs,              config_parse_unit_condition_string, CONDITION_CPUS,                offsetof(Unit, conditions)
d0811f
+Unit.ConditionEnvironment,       config_parse_unit_condition_string, CONDITION_ENVIRONMENT,         offsetof(Unit, conditions)
d0811f
 Unit.ConditionUser,              config_parse_unit_condition_string, CONDITION_USER,                offsetof(Unit, conditions)
d0811f
 Unit.ConditionGroup,             config_parse_unit_condition_string, CONDITION_GROUP,               offsetof(Unit, conditions)
d0811f
-Unit.ConditionControlGroupController,  config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER,   offsetof(Unit, conditions)
d0811f
+Unit.ConditionControlGroupController, config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER, offsetof(Unit, conditions)
d0811f
 Unit.ConditionNull,              config_parse_unit_condition_null,   0,                             offsetof(Unit, conditions)
d0811f
 Unit.AssertPathExists,           config_parse_unit_condition_path,   CONDITION_PATH_EXISTS,         offsetof(Unit, asserts)
d0811f
 Unit.AssertPathExistsGlob,       config_parse_unit_condition_path,   CONDITION_PATH_EXISTS_GLOB,    offsetof(Unit, asserts)
d0811f
@@ -295,22 +299,26 @@ Unit.AssertPathIsDirectory,      config_parse_unit_condition_path,   CONDITION_P
d0811f
 Unit.AssertPathIsSymbolicLink,   config_parse_unit_condition_path,   CONDITION_PATH_IS_SYMBOLIC_LINK,offsetof(Unit, asserts)
d0811f
 Unit.AssertPathIsMountPoint,     config_parse_unit_condition_path,   CONDITION_PATH_IS_MOUNT_POINT, offsetof(Unit, asserts)
d0811f
 Unit.AssertPathIsReadWrite,      config_parse_unit_condition_path,   CONDITION_PATH_IS_READ_WRITE,  offsetof(Unit, asserts)
d0811f
+Unit.AssertPathIsEncrypted,      config_parse_unit_condition_path,   CONDITION_PATH_IS_ENCRYPTED,   offsetof(Unit, asserts)
d0811f
 Unit.AssertDirectoryNotEmpty,    config_parse_unit_condition_path,   CONDITION_DIRECTORY_NOT_EMPTY, offsetof(Unit, asserts)
d0811f
 Unit.AssertFileNotEmpty,         config_parse_unit_condition_path,   CONDITION_FILE_NOT_EMPTY,      offsetof(Unit, asserts)
d0811f
 Unit.AssertFileIsExecutable,     config_parse_unit_condition_path,   CONDITION_FILE_IS_EXECUTABLE,  offsetof(Unit, asserts)
d0811f
 Unit.AssertNeedsUpdate,          config_parse_unit_condition_path,   CONDITION_NEEDS_UPDATE,        offsetof(Unit, asserts)
d0811f
 Unit.AssertFirstBoot,            config_parse_unit_condition_string, CONDITION_FIRST_BOOT,          offsetof(Unit, asserts)
d0811f
-Unit.AssertKernelCommandLine,    config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE, offsetof(Unit, asserts)
d0811f
-Unit.AssertKernelVersion,        config_parse_unit_condition_string, CONDITION_KERNEL_VERSION,      offsetof(Unit, asserts)
d0811f
 Unit.AssertArchitecture,         config_parse_unit_condition_string, CONDITION_ARCHITECTURE,        offsetof(Unit, asserts)
d0811f
 Unit.AssertVirtualization,       config_parse_unit_condition_string, CONDITION_VIRTUALIZATION,      offsetof(Unit, asserts)
d0811f
+Unit.AssertHost,                 config_parse_unit_condition_string, CONDITION_HOST,                offsetof(Unit, asserts)
d0811f
+Unit.AssertKernelCommandLine,    config_parse_unit_condition_string, CONDITION_KERNEL_COMMAND_LINE, offsetof(Unit, asserts)
d0811f
+Unit.AssertKernelVersion,        config_parse_unit_condition_string, CONDITION_KERNEL_VERSION,      offsetof(Unit, asserts)
d0811f
 Unit.AssertSecurity,             config_parse_unit_condition_string, CONDITION_SECURITY,            offsetof(Unit, asserts)
d0811f
 Unit.AssertCapability,           config_parse_unit_condition_string, CONDITION_CAPABILITY,          offsetof(Unit, asserts)
d0811f
-Unit.AssertHost,                 config_parse_unit_condition_string, CONDITION_HOST,                offsetof(Unit, asserts)
d0811f
 Unit.AssertACPower,              config_parse_unit_condition_string, CONDITION_AC_POWER,            offsetof(Unit, asserts)
d0811f
+Unit.AssertMemory,               config_parse_unit_condition_string, CONDITION_MEMORY,              offsetof(Unit, asserts)
d0811f
+Unit.AssertCPUs,                 config_parse_unit_condition_string, CONDITION_CPUS,                offsetof(Unit, asserts)
d0811f
+Unit.AssertEnvironment,          config_parse_unit_condition_string, CONDITION_ENVIRONMENT,         offsetof(Unit, asserts)
d0811f
 Unit.AssertUser,                 config_parse_unit_condition_string, CONDITION_USER,                offsetof(Unit, asserts)
d0811f
 Unit.AssertGroup,                config_parse_unit_condition_string, CONDITION_GROUP,               offsetof(Unit, asserts)
d0811f
-Unit.AssertControlGroupController,     config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER,   offsetof(Unit, asserts)
d0811f
+Unit.AssertControlGroupController, config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER, offsetof(Unit, asserts)
d0811f
 Unit.AssertNull,                 config_parse_unit_condition_null,   0,                             offsetof(Unit, asserts)
d0811f
 Unit.CollectMode,                config_parse_collect_mode,          0,                             offsetof(Unit, collect_mode)
d0811f
 m4_dnl
d0811f
d0811f
From 476cfe626dac41bb9879116c701333caa2ccec24 Mon Sep 17 00:00:00 2001
d0811f
From: Lennart Poettering <lennart@poettering.net>
d0811f
Date: Thu, 20 Aug 2020 14:01:25 +0200
d0811f
Subject: [PATCH 3/3] core: remove support for ConditionNull=
d0811f
d0811f
The concept is flawed, and mostly useless. Let's finally remove it.
d0811f
d0811f
It has been deprecated since 90a2ec10f2d43a8530aae856013518eb567c4039 (6
d0811f
years ago) and we started to warn since
d0811f
55dadc5c57ef1379dbc984938d124508a454be55 (1.5 years ago).
d0811f
d0811f
Let's get rid of it altogether.
d0811f
---
d0811f
 man/systemd.unit.xml                          |  3 -
d0811f
 src/analyze/analyze-condition.c               |  4 +-
d0811f
 src/core/dbus-unit.c                          | 22 +++-----
d0811f
 src/core/load-fragment-gperf.gperf.m4         |  2 -
d0811f
 src/core/load-fragment.c                      | 55 -------------------
d0811f
 src/core/load-fragment.h                      |  1 -
d0811f
 src/shared/condition.c                        | 21 +------
d0811f
 src/shared/condition.h                        |  2 -
d0811f
 src/test/test-condition.c                     | 15 -----
d0811f
 .../fuzz-unit-file/systemd-machined.service   |  3 -
d0811f
 10 files changed, 11 insertions(+), 117 deletions(-)
d0811f
d0811f
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
d0811f
index 7ef6080237e..50f35aaa3cc 100644
d0811f
--- a/man/systemd.unit.xml
d0811f
+++ b/man/systemd.unit.xml
d0811f
@@ -1092,9 +1092,6 @@
d0811f
       <para>Except for <varname>ConditionPathIsSymbolicLink=</varname>, all path checks follow symlinks.</para>
d0811f
 
d0811f
       <variablelist class='unit-directives'>
d0811f
-        
d0811f
-             confusing. -->
d0811f
-
d0811f
         <varlistentry>
d0811f
           <term><varname>ConditionArchitecture=</varname></term>
d0811f
 
d0811f
diff --git a/src/analyze/analyze-condition.c b/src/analyze/analyze-condition.c
d0811f
index 13f75e813a2..e1365e18056 100644
d0811f
--- a/src/analyze/analyze-condition.c
d0811f
+++ b/src/analyze/analyze-condition.c
d0811f
@@ -38,9 +38,7 @@ static int parse_condition(Unit *u, const char *line) {
d0811f
 
d0811f
                 p += strspn(p, WHITESPACE);
d0811f
 
d0811f
-                if (t == CONDITION_NULL) /* deprecated, but we should still parse this for now */
d0811f
-                        callback = config_parse_unit_condition_null;
d0811f
-                else if (condition_takes_path(t))
d0811f
+                if (condition_takes_path(t))
d0811f
                         callback = config_parse_unit_condition_path;
d0811f
                 else
d0811f
                         callback = config_parse_unit_condition_string;
d0811f
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
d0811f
index 9e9d3b101e5..e799771c220 100644
d0811f
--- a/src/core/dbus-unit.c
d0811f
+++ b/src/core/dbus-unit.c
d0811f
@@ -1974,14 +1974,11 @@ static int bus_set_transient_conditions(
d0811f
                 if (t < 0)
d0811f
                         return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid condition type: %s", type_name);
d0811f
 
d0811f
-                if (t != CONDITION_NULL) {
d0811f
-                        if (isempty(param))
d0811f
-                                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Condition parameter in %s is empty", type_name);
d0811f
+                if (isempty(param))
d0811f
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Condition parameter in %s is empty", type_name);
d0811f
 
d0811f
-                        if (condition_takes_path(t) && !path_is_absolute(param))
d0811f
-                                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in condition %s is not absolute: %s", type_name, param);
d0811f
-                } else
d0811f
-                        param = NULL;
d0811f
+                if (condition_takes_path(t) && !path_is_absolute(param))
d0811f
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path in condition %s is not absolute: %s", type_name, param);
d0811f
 
d0811f
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
d0811f
                         Condition *c;
d0811f
@@ -1992,14 +1989,9 @@ static int bus_set_transient_conditions(
d0811f
 
d0811f
                         LIST_PREPEND(conditions, *list, c);
d0811f
 
d0811f
-                        if (t != CONDITION_NULL)
d0811f
-                                unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name,
d0811f
-                                                    "%s=%s%s%s", type_name,
d0811f
-                                                    trigger ? "|" : "", negate ? "!" : "", param);
d0811f
-                        else
d0811f
-                                unit_write_settingf(u, flags, name,
d0811f
-                                                    "%s=%s%s", type_name,
d0811f
-                                                    trigger ? "|" : "", yes_no(!negate));
d0811f
+                        unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name,
d0811f
+                                            "%s=%s%s%s", type_name,
d0811f
+                                            trigger ? "|" : "", negate ? "!" : "", param);
d0811f
                 }
d0811f
 
d0811f
                 empty = false;
d0811f
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
d0811f
index 1e6bd6483c2..a191de62af3 100644
d0811f
--- a/src/core/load-fragment-gperf.gperf.m4
d0811f
+++ b/src/core/load-fragment-gperf.gperf.m4
d0811f
@@ -292,7 +292,6 @@ Unit.ConditionEnvironment,       config_parse_unit_condition_string, CONDITION_E
d0811f
 Unit.ConditionUser,              config_parse_unit_condition_string, CONDITION_USER,                offsetof(Unit, conditions)
d0811f
 Unit.ConditionGroup,             config_parse_unit_condition_string, CONDITION_GROUP,               offsetof(Unit, conditions)
d0811f
 Unit.ConditionControlGroupController, config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER, offsetof(Unit, conditions)
d0811f
-Unit.ConditionNull,              config_parse_unit_condition_null,   0,                             offsetof(Unit, conditions)
d0811f
 Unit.AssertPathExists,           config_parse_unit_condition_path,   CONDITION_PATH_EXISTS,         offsetof(Unit, asserts)
d0811f
 Unit.AssertPathExistsGlob,       config_parse_unit_condition_path,   CONDITION_PATH_EXISTS_GLOB,    offsetof(Unit, asserts)
d0811f
 Unit.AssertPathIsDirectory,      config_parse_unit_condition_path,   CONDITION_PATH_IS_DIRECTORY,   offsetof(Unit, asserts)
d0811f
@@ -319,7 +318,6 @@ Unit.AssertEnvironment,          config_parse_unit_condition_string, CONDITION_E
d0811f
 Unit.AssertUser,                 config_parse_unit_condition_string, CONDITION_USER,                offsetof(Unit, asserts)
d0811f
 Unit.AssertGroup,                config_parse_unit_condition_string, CONDITION_GROUP,               offsetof(Unit, asserts)
d0811f
 Unit.AssertControlGroupController, config_parse_unit_condition_string, CONDITION_CONTROL_GROUP_CONTROLLER, offsetof(Unit, asserts)
d0811f
-Unit.AssertNull,                 config_parse_unit_condition_null,   0,                             offsetof(Unit, asserts)
d0811f
 Unit.CollectMode,                config_parse_collect_mode,          0,                             offsetof(Unit, collect_mode)
d0811f
 m4_dnl
d0811f
 Service.PIDFile,                 config_parse_pid_file,              0,                             offsetof(Service, pid_file)
d0811f
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
d0811f
index 266382c84c7..cfd04f3b49f 100644
d0811f
--- a/src/core/load-fragment.c
d0811f
+++ b/src/core/load-fragment.c
d0811f
@@ -2999,60 +2999,6 @@ int config_parse_unit_condition_string(
d0811f
         return 0;
d0811f
 }
d0811f
 
d0811f
-int config_parse_unit_condition_null(
d0811f
-                const char *unit,
d0811f
-                const char *filename,
d0811f
-                unsigned line,
d0811f
-                const char *section,
d0811f
-                unsigned section_line,
d0811f
-                const char *lvalue,
d0811f
-                int ltype,
d0811f
-                const char *rvalue,
d0811f
-                void *data,
d0811f
-                void *userdata) {
d0811f
-
d0811f
-        Condition **list = data, *c;
d0811f
-        bool trigger, negate;
d0811f
-        int b;
d0811f
-
d0811f
-        assert(filename);
d0811f
-        assert(lvalue);
d0811f
-        assert(rvalue);
d0811f
-        assert(data);
d0811f
-
d0811f
-        log_syntax(unit, LOG_WARNING, filename, line, 0, "%s= is deprecated, please do not use.", lvalue);
d0811f
-
d0811f
-        if (isempty(rvalue)) {
d0811f
-                /* Empty assignment resets the list */
d0811f
-                *list = condition_free_list(*list);
d0811f
-                return 0;
d0811f
-        }
d0811f
-
d0811f
-        trigger = rvalue[0] == '|';
d0811f
-        if (trigger)
d0811f
-                rvalue++;
d0811f
-
d0811f
-        negate = rvalue[0] == '!';
d0811f
-        if (negate)
d0811f
-                rvalue++;
d0811f
-
d0811f
-        b = parse_boolean(rvalue);
d0811f
-        if (b < 0) {
d0811f
-                log_syntax(unit, LOG_ERR, filename, line, b, "Failed to parse boolean value in condition, ignoring: %s", rvalue);
d0811f
-                return 0;
d0811f
-        }
d0811f
-
d0811f
-        if (!b)
d0811f
-                negate = !negate;
d0811f
-
d0811f
-        c = condition_new(CONDITION_NULL, NULL, trigger, negate);
d0811f
-        if (!c)
d0811f
-                return log_oom();
d0811f
-
d0811f
-        LIST_PREPEND(conditions, *list, c);
d0811f
-        return 0;
d0811f
-}
d0811f
-
d0811f
 int config_parse_unit_requires_mounts_for(
d0811f
                 const char *unit,
d0811f
                 const char *filename,
d0811f
@@ -5266,7 +5212,6 @@ void unit_dump_config_items(FILE *f) {
d0811f
                 { config_parse_ip_tos,                "TOS" },
d0811f
                 { config_parse_unit_condition_path,   "CONDITION" },
d0811f
                 { config_parse_unit_condition_string, "CONDITION" },
d0811f
-                { config_parse_unit_condition_null,   "CONDITION" },
d0811f
                 { config_parse_unit_slice,            "SLICE" },
d0811f
                 { config_parse_documentation,         "URL" },
d0811f
                 { config_parse_service_timeout,       "SECONDS" },
d0811f
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
d0811f
index 2672db5ace2..cee5717d0fb 100644
d0811f
--- a/src/core/load-fragment.h
d0811f
+++ b/src/core/load-fragment.h
d0811f
@@ -58,7 +58,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_unit_env_file);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_ip_tos);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_unit_condition_path);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_unit_condition_string);
d0811f
-CONFIG_PARSER_PROTOTYPE(config_parse_unit_condition_null);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_kill_mode);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_notify_access);
d0811f
 CONFIG_PARSER_PROTOTYPE(config_parse_emergency_action);
d0811f
diff --git a/src/shared/condition.c b/src/shared/condition.c
d0811f
index bf3b5fa1622..1f6105622a5 100644
d0811f
--- a/src/shared/condition.c
d0811f
+++ b/src/shared/condition.c
d0811f
@@ -52,7 +52,7 @@ Condition* condition_new(ConditionType type, const char *parameter, bool trigger
d0811f
 
d0811f
         assert(type >= 0);
d0811f
         assert(type < _CONDITION_TYPE_MAX);
d0811f
-        assert((!parameter) == (type == CONDITION_NULL));
d0811f
+        assert(parameter);
d0811f
 
d0811f
         c = new(Condition, 1);
d0811f
         if (!c)
d0811f
@@ -776,15 +776,6 @@ static int condition_test_file_is_executable(Condition *c, char **env) {
d0811f
                 (st.st_mode & 0111));
d0811f
 }
d0811f
 
d0811f
-static int condition_test_null(Condition *c, char **env) {
d0811f
-        assert(c);
d0811f
-        assert(c->type == CONDITION_NULL);
d0811f
-
d0811f
-        /* Note that during parsing we already evaluate the string and
d0811f
-         * store it in c->negate */
d0811f
-        return true;
d0811f
-}
d0811f
-
d0811f
 int condition_test(Condition *c, char **env) {
d0811f
 
d0811f
         static int (*const condition_tests[_CONDITION_TYPE_MAX])(Condition *c, char **env) = {
d0811f
@@ -811,7 +802,6 @@ int condition_test(Condition *c, char **env) {
d0811f
                 [CONDITION_USER]                     = condition_test_user,
d0811f
                 [CONDITION_GROUP]                    = condition_test_group,
d0811f
                 [CONDITION_CONTROL_GROUP_CONTROLLER] = condition_test_control_group_controller,
d0811f
-                [CONDITION_NULL]                     = condition_test_null,
d0811f
                 [CONDITION_CPUS]                     = condition_test_cpus,
d0811f
                 [CONDITION_MEMORY]                   = condition_test_memory,
d0811f
                 [CONDITION_ENVIRONMENT]              = condition_test_environment,
d0811f
@@ -859,23 +849,20 @@ bool condition_test_list(
d0811f
                 r = condition_test(c, env);
d0811f
 
d0811f
                 if (logger) {
d0811f
-                        const char *p = c->type == CONDITION_NULL ? "true" : c->parameter;
d0811f
-                        assert(p);
d0811f
-
d0811f
                         if (r < 0)
d0811f
                                 logger(userdata, LOG_WARNING, r, PROJECT_FILE, __LINE__, __func__,
d0811f
                                        "Couldn't determine result for %s=%s%s%s, assuming failed: %m",
d0811f
                                        to_string(c->type),
d0811f
                                        c->trigger ? "|" : "",
d0811f
                                        c->negate ? "!" : "",
d0811f
-                                       p);
d0811f
+                                       c->parameter);
d0811f
                         else
d0811f
                                 logger(userdata, LOG_DEBUG, 0, PROJECT_FILE, __LINE__, __func__,
d0811f
                                        "%s=%s%s%s %s.",
d0811f
                                        to_string(c->type),
d0811f
                                        c->trigger ? "|" : "",
d0811f
                                        c->negate ? "!" : "",
d0811f
-                                       p,
d0811f
+                                       c->parameter,
d0811f
                                        condition_result_to_string(c->result));
d0811f
                 }
d0811f
 
d0811f
@@ -937,7 +924,6 @@ static const char* const condition_type_table[_CONDITION_TYPE_MAX] = {
d0811f
         [CONDITION_USER] = "ConditionUser",
d0811f
         [CONDITION_GROUP] = "ConditionGroup",
d0811f
         [CONDITION_CONTROL_GROUP_CONTROLLER] = "ConditionControlGroupController",
d0811f
-        [CONDITION_NULL] = "ConditionNull",
d0811f
         [CONDITION_CPUS] = "ConditionCPUs",
d0811f
         [CONDITION_MEMORY] = "ConditionMemory",
d0811f
         [CONDITION_ENVIRONMENT] = "ConditionEnvironment",
d0811f
@@ -969,7 +955,6 @@ static const char* const assert_type_table[_CONDITION_TYPE_MAX] = {
d0811f
         [CONDITION_USER] = "AssertUser",
d0811f
         [CONDITION_GROUP] = "AssertGroup",
d0811f
         [CONDITION_CONTROL_GROUP_CONTROLLER] = "AssertControlGroupController",
d0811f
-        [CONDITION_NULL] = "AssertNull",
d0811f
         [CONDITION_CPUS] = "AssertCPUs",
d0811f
         [CONDITION_MEMORY] = "AssertMemory",
d0811f
         [CONDITION_ENVIRONMENT] = "AssertEnvironment",
d0811f
diff --git a/src/shared/condition.h b/src/shared/condition.h
d0811f
index fea74d228d8..e5ad43f945b 100644
d0811f
--- a/src/shared/condition.h
d0811f
+++ b/src/shared/condition.h
d0811f
@@ -34,8 +34,6 @@ typedef enum ConditionType {
d0811f
         CONDITION_FILE_NOT_EMPTY,
d0811f
         CONDITION_FILE_IS_EXECUTABLE,
d0811f
 
d0811f
-        CONDITION_NULL,
d0811f
-
d0811f
         CONDITION_USER,
d0811f
         CONDITION_GROUP,
d0811f
 
d0811f
diff --git a/src/test/test-condition.c b/src/test/test-condition.c
d0811f
index ddf2e669c03..d209c1304c8 100644
d0811f
--- a/src/test/test-condition.c
d0811f
+++ b/src/test/test-condition.c
d0811f
@@ -438,20 +438,6 @@ static void test_condition_test_kernel_version(void) {
d0811f
         condition_free(condition);
d0811f
 }
d0811f
 
d0811f
-static void test_condition_test_null(void) {
d0811f
-        Condition *condition;
d0811f
-
d0811f
-        condition = condition_new(CONDITION_NULL, NULL, false, false);
d0811f
-        assert_se(condition);
d0811f
-        assert_se(condition_test(condition, environ) > 0);
d0811f
-        condition_free(condition);
d0811f
-
d0811f
-        condition = condition_new(CONDITION_NULL, NULL, false, true);
d0811f
-        assert_se(condition);
d0811f
-        assert_se(condition_test(condition, environ) == 0);
d0811f
-        condition_free(condition);
d0811f
-}
d0811f
-
d0811f
 static void test_condition_test_security(void) {
d0811f
         Condition *condition;
d0811f
 
d0811f
@@ -868,7 +854,6 @@ int main(int argc, char *argv[]) {
d0811f
         test_condition_test_architecture();
d0811f
         test_condition_test_kernel_command_line();
d0811f
         test_condition_test_kernel_version();
d0811f
-        test_condition_test_null();
d0811f
         test_condition_test_security();
d0811f
         print_securities();
d0811f
         test_condition_test_virtualization();
d0811f
diff --git a/test/fuzz/fuzz-unit-file/systemd-machined.service b/test/fuzz/fuzz-unit-file/systemd-machined.service
d0811f
index 70b627c5f40..79ee9861d8e 100644
d0811f
--- a/test/fuzz/fuzz-unit-file/systemd-machined.service
d0811f
+++ b/test/fuzz/fuzz-unit-file/systemd-machined.service
d0811f
@@ -15,9 +15,6 @@ Documentation=https://www.freedesktop.org/wiki/Software/systemd/machined
d0811f
 Wants=machine.slice
d0811f
 After=machine.slice
d0811f
 RequiresMountsFor=/var/lib/machines
d0811f
-ConditionNull=true
d0811f
-ConditionNull=
d0811f
-ConditionNull=|!false
d0811f
 OnFailureIsolate=false
d0811f
 FailureActionExitStatus=222
d0811f
 FailureActionExitStatus=