Gentoo Archives: gentoo-user

From: Etaoin Shrdlu <shrdlu@×××××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] man bash document doesn't match real life bash.
Date: Sun, 23 Sep 2007 08:40:07
Message-Id: 200709231035.43182.shrdlu@unlimitedmail.org
In Reply to: Re: [gentoo-user] man bash document doesn't match real life bash. by Mrugesh Karnik
1 On Sunday 23 September 2007, Mrugesh Karnik wrote:
2
3 > From man bash:
4 >
5 > ``When bash is invoked as an interactive login shell, or as a
6 > non-interactive shell with the --login option, it first reads and
7 > executes commands from the file /etc/profile, if that file exists.
8 > After reading that file, it looks for ~/.bash_profile, ~/.bash_login,
9 > and ~/.profile, in that order, and reads and executes commands from
10 > the first one that exists and is readable. The --noprofile option may
11 > be used when the shell is started to inhibit this behavior.
12 >
13 > <snip>
14 >
15 > When an interactive shell that is not a login shell is started, bash
16 > reads and executes commands from ~/.bashrc, if that file exists. This
17 > may be inhibited by using the --norc option. The --rcfile file option
18 > will force bash to read and execute commands from file instead of
19 > ~/.bashrc.''
20
21 And this last is the part that fails to mention that a non-login shell
22 will read /etc/bash/bashrc before ~/.bashrc, as the comments
23 inside /etc/bash/bashrc and David Harel say.
24
25 Ok, after closer inspection, it seems that the /etc/bash/ way is a
26 gentooism. Bash would normally define SYS_BASHRC and SYS_BASH_LOGOUT
27 as /etc/bash.bashrc and /etc/bash.bash_logout respectively, even though
28 it does not use them by default (they are commented in the sources).
29 Nearly all linux distros uncomment those definitions, thus making bash
30 use those files (see eg ubuntu). A gentoo patch, namely
31 bash-3.0-configs.patch, changes those into /etc/bash/bashrc
32 and /etc/bash/bash_logout. See bug #26952 (esp. from comment #52) and
33 bug #90488 for further details. Note that gentoo applies the patch
34 regardless of the vanilla USE flag.
35
36 So, it seems that, after all, the standard man page is correct, but, in
37 gentoo, it probably should be patched to reflect the way things work in
38 gentoo. Not sure whether this is enough to be worth a bug report?
39 --
40 gentoo-user@g.o mailing list