summaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-01-03 22:26:52 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-01-19 14:18:34 +0100
commit30927a24848c4d727f7619cc74b878f098cdd724 (patch)
tree5deb8cf9fa92762406f4ee25447e6a312b3f4ed0 /man
parentsystemctl: print a warning when trying to import a nonexistent variable (diff)
downloadsystemd-30927a24848c4d727f7619cc74b878f098cdd724.tar.xz
systemd-30927a24848c4d727f7619cc74b878f098cdd724.zip
Allow control characters in environment variable values
So far, we would allow certain control characters (NL since b4346b9a77bc6129dd3e, TAB since 6294aa76d818e831de45), but not others. Having other control characters in environment variable *value* is expected and widely used, for various prompts like $LESS, $LESS_TERMCAP_*, and other similar variables. The typical environment exported by bash already contains a dozen or so such variables, so programs need to handle them. We handle then correctly too, for example in 'systemctl show-environment', since 804ee07c1370d49aa9a. But we would still disallow setting such variables by the user, in unit file Environment= and in set-environment/import-environment operations. This is unexpected and confusing and doesn't help with anything because such variables are present in the environment through other means. When printing such variables, 'show-environment' escapes all special characters, so variables with control characters are plainly visible. In other uses, e.g. 'cat -v' can be used in similar fashion. This would already need to be done to suppress color codes starting with \[. Note that we still forbid invalid utf-8 with this patch. (Control characters are valid, since they are valid 7-bit ascii.) I'm not sure if we should do that, but since people haven't been actually asking for invalid utf-8, and only for control characters, and invalid utf-8 causes other issues, I think it's OK to leave this unchanged. Fixes #4446, https://gitlab.gnome.org/GNOME/gnome-session/-/issues/45.
Diffstat (limited to 'man')
-rw-r--r--man/systemctl.xml6
1 files changed, 4 insertions, 2 deletions
diff --git a/man/systemctl.xml b/man/systemctl.xml
index a954e8727b..6177d1a0dd 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -1080,8 +1080,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<para><command>systemd</command> supports an environment block that is passed to processes the manager
spawns. The names of the variables can contain ASCII letters, digits, and the underscore
character. Variable names cannot be empty or start with a digit. In variable values, most characters
- are allowed, but non-printable characters are currently rejected. The total length of the environment
- block is limited to <constant>_SC_ARG_MAX</constant> value defined by
+ are allowed, but the whole sequence must be valid UTF-8. (Note that control characters like newline
+ (<constant>NL</constant>), tab (<constant>TAB</constant>), or the escape character
+ (<constant>ESC</constant>), <emphasis>are</emphasis> valid ASCII and thus valid UTF-8). The total
+ length of the environment block is limited to <constant>_SC_ARG_MAX</constant> value defined by
<citerefentry project='man-pages'><refentrytitle>sysconf</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>