← Back to team overview

desktop-packages team mailing list archive

[Bug 1468832] Re: lightdm sources .profile

 

@Myself: in my description I repeatedly used "interactive shell" when I
meant "login shell" instead.  The distinction is important, (and thus
the shell makes the distinction)--the user's .profile is only sourced in
the latter case.  On all other interactive shells it sources .bashrc
instead.  This is so that .profile can initialize the user's terminal
settings, whereas this should NOT be done for all other interactive
shells.

@Anders: it need not be .bashrc, and I explicitly addressed the case
where your shell was not BASH.  It seems you did not read the whole
report.

@Gunnar:  So your argument is basically, "This is designed wrong, but we
shouldn't fix it, because some people might have to learn the right way
to do it."  That is a pretty bad argument.  The "mess" is that some
percentage of users *might* need to modify their shell start-up files to
do it the right way.  That doesn't seem like much of a mess to me; it's
fixing a mess.

It seems clear to me that .profile and the other shell start-up files
belong to the shell, and hence no program other than the shell has any
business reading them.  Regardless, if you don't care to fix this,
what's your proposed fix for lightdm barfing on errors from terminal
commands that quite rightly belong in .profile?  At the very least,
session start-up should not be interrupted by the fact that lightdm does
this badly.   That behavior is a regression, in the sense that Ubuntu
12.x did not do this until some random update somewhere between six
months and a year ago, and no previous Ubuntu release did it.  I have
not run a pristine 14.04 Ubuntu--I've only been running it for a couple
of months with all current updates applied, so I can't say whether it
has or has not changed there.

In the past, some distributions (including Ubuntu, if I'm not mistaken)
have sourced $HOME/.profile in the system Xsession script.  That
solution is wrong too; but it has the nice property that if there are
errors caused by the shell not running on a terminal, they are silently
ignored (since there's nowhere to send them).

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

Title:
  lightdm sources .profile

Status in lightdm package in Ubuntu:
  New

Bug description:
  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.

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


References