/etc/skel/.profile does not detect bash properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH=
fi
So if I run bash in posix mode or as /bin/sh.
antarus@goats5 /etc/skel $ env -i /bin/sh -c 'echo $BASH_VERSION'
4.2.24(1)-release
antarus@goats5 /etc/skel $ env -i bash --posix -c 'echo $BASH_VERSION'
4.2.24(1)-release
This means when lightdm-
antarus@goats5 ~/antarus $ /bin/sh
sh-4.2$ source ~/.bashrc
sh: `break-posix-sh': not a valid identifier
antarus@goats5 ~/antarus $ grep 'break-posix-sh' ~/.bashrc
function break-posix-sh() {
Functions cannot have dashes in them in posix, but can in bash, for example.
If you replace the .profile login with something like:
if ! shopt -oq posix; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
It seems to work properly.
DISTRIB_
DISTRIB_
DISTRIB_ID=Ubuntu
DISTRIB_
antarus@goats5 ~/antarus $ apt-cache policy bash
bash:
Installed: 4.2-2ubuntu2
Candidate: 4.2-2ubuntu2
Version table:
If lightdm cannot source my .bashrc, I cannot login. Also, thousands of my users cannot login.
-A
Status changed to 'Confirmed' because the bug affects multiple users.