Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 4313 - .bashrc & .bash_profile from /etc/skel not automatically sourced
Summary: .bashrc & .bash_profile from /etc/skel not automatically sourced
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-29 03:34 UTC by Glen Coates
Modified: 2003-02-04 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glen Coates 2002-06-29 03:34:15 UTC
gentoo appears to lack the /etc/bashrc and /etc/profile files of other distros,
having replaced them with /etc/skel/.bashrc and .bash_profile.  The headers in
these /etc/skel files claim that they will be automatically sourced on various
shell startups, but they aren't.

Starting a bash shell inside any X terminal does not automatically source
/etc/skel/.bashrc as far as I can tell, and logins on vc/[1-6] do not
automatically source /etc/skel/.bash_profile.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2002-06-29 10:34:50 UTC
I dont know about you, but I have a /etc/profile.  Secondly, yes we do not
have a /etc/bashrc ... you are free to have your own though.

Then, ~/.bash_profile is only sourced if it is a login shell.  ~/.bashrc on
the other hand is only sourced if it is a interactive shell (attatched to a
terminal), but not a login shell.  We do though source it in ~/.bash_profile,
so in theory, if it is an interactive login (may it be login shell or not),
~/.bashrc should alway be sourced.

Most cases that dont have any sourced is when the user do not have a shell
defined in /etc/passwd.  This can be set during user creation, or with the
"chsh" command.

As for terminals in X, most do not start as a login shell ... gnome-terminal
have an option for that in preferences, where konsole have a commandline arg.
If .bash rc do not get sourced even then, again check that the user have a 
default shell set.

Unfortunately this is a pitfall for many a new user, but learning the hard
way is sometimes the best ;-)
Comment 2 Joakim Lindblad 2002-07-11 06:49:10 UTC
As for Martin's comment about terminals in X. When starting X from a console
(startx) there is never a problem, couse I'm already logged in with a login
shell, and thus my profile stuff is already there. When using a graphical login
though (*DM), /etc/profile and ~/.bash_profile are never run, which sure is a
hassle for new users (just browse the forums and you'll see). 

One way to fix this seems to be to make the session a login shell, e.g. by
adding --login to the first line of the resp sessionfile in /etc/X11/Sessions.
Don't know if that is the *best* way to solve the problem though. 

My suggestion is to make this the deafult behaviour (in one way or another) of
Gentoo, removing the pitfall once and for all. Experienced users can remove the
login behaviour if they want to by some reason.
Comment 3 SpanKY gentoo-dev 2002-08-02 23:16:00 UTC
Similar bugs:
http://bugs.gentoo.org/show_bug.cgi?id=4313
http://bugs.gentoo.org/show_bug.cgi?id=4955
http://bugs.gentoo.org/show_bug.cgi?id=5629
http://bugs.gentoo.org/show_bug.cgi?id=5683
http://bugs.gentoo.org/show_bug.cgi?id=5699

everyone has something diff to say ... think it should all be wrapped up and 
put into 1 bundle though ;)
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-25 13:28:29 UTC
Changed the shell for /etc/X11/xdm/Xsession and /etc/X11/gdm/PreSession/Default
to "/bin/bash --login".  Please check the ChangeLogs, and then remerge them
(xfree-4.2.1-r2, gdm).