Public bug reported:

It is a bug for any display manager to read .profile--you guys are
absolutely killing me with this.  The user's .profile is to be read by
the shell, on interactive shell (i.e. terminal) logins ONLY.  The man
page for bash explains this in detail; it's also discussed in the dash
man page.  The problem with display managers reading .profile is that it
is the place where commands to set up your terminal (i.e. stty) go--this
is the entire point of differentiating interactive shells from non-
interactive shells, and it's the reason only interactive shells read
.profile at all.  Currently, if you have any such commands in your
.profile, lightdm barfs on them, delaying the login session and forcing
you to click on a prompt.  This is extremely annoying (and wrong)!

It would be satisfactory to make lightdm not display the errors, but
that's the wrong solution.  There's already a decades-established method
of getting X display managers to source your environment settings: the
.xsession file.  It should be read by ALL display managers (or the
session file that starts them).  If you have common environment settings
you want set in all your shells, the correct way to handle this is:

.bashrc:
# set all common environment vars here
ENV_VAR=foo
...

.profile:
# set up terminal
stty erase
# BASH already sources .bashrc by default on interactive sessions

.xsession:
if [ -f .bashrc ] source .bashrc

If you're not using BASH, you can still use this method without changing
anything, except in .profile you need to explicitly source the .bashrc
file.  Of course you can change the name of the file that contains the
common settings to reflect that your shell is not BASH; since the file
is sourced by your other files explicitly, it does not matter what the
user calls it.

** Affects: lightdm (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1468832

Title:
  lightdm sources .profile

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1468832/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to