Where to set environment variables

Jan Kokoska kokoskaj at seznam.cz
Wed Oct 20 14:34:49 UTC 2004


> and here's the result when I type echo $PATH:
> 
> bdoetsch at basti:~ $ echo $PATH
> /usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games
> 
> So where's the error?

That I frankly do not know. What I did recently on Debian Sid when I
empirically found contents of /etc/bash.bashrc is ignored despite what
man page says is that I straced the whole session creation process.

strace -ff -o /tmp/session Eterm

Eterm being my terminal (in case bash behaves differently on different
terminals), this gives me a bunch of strace logs for all the processes
that get started:

$ ls -al session*
-rw-r--r--  1 qua qua 154724 Oct 20 15:23 session
-rw-r--r--  1 qua qua   7413 Oct 20 15:23 session.5247
-rw-r--r--  1 qua qua   2639 Oct 20 15:23 session.5248
-rw-r--r--  1 qua qua 136585 Oct 20 15:23 session.5249
-rw-r--r--  1 qua qua   2074 Oct 20 15:23 session.5250
-rw-r--r--  1 qua qua   2513 Oct 20 15:23 session.5251

$ rgrep profile session*
session.5249:open("/etc/profile", O_RDONLY|O_LARGEFILE) = 3
session.5249:read(3, "# /etc/profile: system-wide .pro"..., 379) = 379
session.5249:open("/home/qua/.bash_profile", O_RDONLY|O_LARGEFILE) = 3
session.5249:read(3, "# ~/.bash_profile: executed by b"..., 566) = 566

And voila, it does read the profile file here, so I can assume it acts
upon that (source code investigation would come next). Not needed, my
profile works.

Investigating my problem, though:

rgrep bashrc session*
session.5249:stat64("/home/qua/.bashrc", {st_mode=S_IFREG|0644,
st_size=1853, ...}) = 0
session.5249:stat64("/home/qua/.bashrc", {st_mode=S_IFREG|0644,
st_size=1853, ...}) = 0
session.5249:open("/home/qua/.bashrc", O_RDONLY|O_LARGEFILE) = 3
session.5249:read(3, "# ~/.bashrc: executed by bash(1)"..., 1853) = 1853

Oops, so /etc/bash.bashrc is despite documentation ignored in whatever
situation I have now (starting a terminal, interactive shell). Reason
for this remains to be investigated, I will probably look into the
source.

You can repeat the strace & grep procedure and post your results here.
Bash certainly seems to me to be doing something fishy when setting up a
session.

And what is your bash version?

$ bash --version
GNU bash, version 3.00.13(1)-release (i386-pc-linux-gnu)

Jan





More information about the ubuntu-users mailing list