/etc/environment (related with bug #28446)
I see that there is no policy described in /usr/doc/debian-policy about
/etc/environment, while I think there should be one.
/etc/environment can be used as an initialiser for login, by uncommenting
the proper line in /etc/login.defs. In this case, each line should have
the form
name=value
where value is any string, starting from the equal sign to the newline,
without any quoting. The names are exported by the login program to its
subprocesses. This mechanism is independent of the shell used and its
quoting and exporting conventions.
Another place where /etc/environment is called for is in the
/etc/X11/Xsession script:
# global Xsession file -- used by both xdm and xinit (startx)
# If /etc/environment is present, source it. It's useful to put default
# environment settings in this file, and then source it both here and in
# /etc/profile.
if [ -f /etc/environment ]; then
. /etc/environment
fi
As you see, the file is sourced, which means that the values of the
variables defined should be properly quoted. Moreover, export instructions
are needed inside /etc/environment, unless one uses the "set -o allexport"
instruction of bash or ksh, which is almost unusable as it triggers bug
#23857. The same happens if one follows the suggestion in the comment
inside Xsession, that is, if /etc/environment is sourced from within
/etc/profile.
This means that the usages suggested in login.defs and Xsession are
incompatible, and one of them should be chosen, and comments should be put
in one of those files stating that the suggested use is contrary to
Debian's policy.
Reply to: