Skip to content

Commit 1c68232

Browse files
committed
core: rework how we treat specifiers in Environment= of transient units
Let's validate the data passed in after resolving specifiers, but let's write out to the unit snippet the list without specifiers applied. This way the pre-existing comment actually starts matching what is actually implemented.
1 parent 41de9cc commit 1c68232

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/dbus-execute.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,13 +1817,13 @@ int bus_exec_context_set_transient_property(
18171817
if (r < 0)
18181818
return r;
18191819

1820-
if (!strv_env_is_valid(l))
1821-
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment block.");
1822-
18231820
r = unit_full_printf_strv(u, l, &q);
18241821
if (r < 0)
18251822
return r;
18261823

1824+
if (!strv_env_is_valid(q))
1825+
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment block.");
1826+
18271827
if (mode != UNIT_CHECK) {
18281828
if (strv_length(q) == 0) {
18291829
c->environment = strv_free(c->environment);
@@ -1840,7 +1840,7 @@ int bus_exec_context_set_transient_property(
18401840
c->environment = e;
18411841

18421842
/* We write just the new settings out to file, with unresolved specifiers */
1843-
joined = strv_join_quoted(q);
1843+
joined = strv_join_quoted(l);
18441844
if (!joined)
18451845
return -ENOMEM;
18461846

0 commit comments

Comments
 (0)