.xsession is sourced within /bin/sh, not /bin/bash. It wouldn’t make
sense to source .bashrc from it (unless you happened to write a .bashrc
that doesn’t use any bash features).

Also, .bashrc is sourced by _every_ interactive shell, so if you were to add 
things to environment variables from .bashrc, e.g.
  PATH="$HOME/bin:$PATH"
then they would show up multiple times in shells launched inside shells. This 
is just an annoyance for $PATH, but it might be an important problem for other 
variables, so you would need to add code to test whether the variable had 
already been changed, etc.

This is why Ubuntu’s default .profile (see /etc/skel/.profile) sets up
$PATH and the default .bashrc (see /etc/skel/.bashrc) does not.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded 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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to