Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 90998 - bash-3.0-r11 only sources /etc/bash/bashrc for non-login shells
Summary: bash-3.0-r11 only sources /etc/bash/bashrc for non-login shells
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 All
: Normal minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-30 15:34 UTC by Matt Whitlock
Modified: 2005-05-02 23:08 UTC (History)
0 users

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


Attachments
/etc/bash/bashrc (bashrc,1.54 KB, text/plain)
2005-04-30 15:35 UTC, Matt Whitlock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2005-04-30 15:34:02 UTC
Bash does not source /etc/bash/bashrc for login shells.

Steps to reproduce:
1. Connect to Gentoo system via SSH and log in.
2. Notice prompt does not display in color.
3. "su -" (the hyphen means login shell). Prompt still not in color.
4. Exit from su -.
5. "su" (without the hyphen means non-login shell). Prompt is now in color.

I have also thrown in variable exports before and after the test for interactive shell in /etc/bash/bashrc.  Neither before or after variable is set for login shells.  Both variables are set for non-login shells.

Expected result:
Bash always sources /etc/bash/bashrc regardless of whether it is invoked as a login shell.
Comment 1 Matt Whitlock 2005-04-30 15:35:45 UTC
Created attachment 57693 [details]
/etc/bash/bashrc

This should be identical to the distributed /etc/bash/bashrc.
Comment 2 Matt Whitlock 2005-04-30 15:40:51 UTC
mattw@gentoo ~ $ echo ${use_color}

mattw@gentoo ~ $ su - mattw
Password:
mattw@gentoo ~ $ echo ${use_color}

mattw@gentoo ~ $ logout

mattw@gentoo ~ $ su mattw
Password:
mattw@gentoo ~ $ echo ${use_color}
true
Comment 3 SpanKY gentoo-dev 2005-04-30 21:37:02 UTC
sounds like your /etc/profile still refers to /etc/bashrc
Comment 4 Matt Whitlock 2005-05-01 00:20:27 UTC
Indeed my /etc/profile was still referring to /etc/bashrc.  I remerged baselayout and now it uses /etc/bash/bashrc.  I have no clue why /etc/profile wasn't updated when I originally updated to baselayout-1.11.11-r3.  I hasn't touched it.  Thanks though!
Comment 5 SpanKY gentoo-dev 2005-05-01 00:44:37 UTC
that is weird ... i put 1.11.11-r3 in specifically to update /etc/profile :x
Comment 6 Hiel Van Campen 2005-05-02 22:20:02 UTC
Im haveing the exact same problem. since updateing to emerge bash baselayout -p

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] app-shells/bash-3.0-r11  
[ebuild   R   ] sys-apps/baselayout-1.11.11-r3 
I have no color prompt
 I have " . /etc/profile " and I have .bash_profile and .bashrc in home. ANd I just noticed this.

root@tester ~ # . .bashrc
root@tester ~ # . /etc/profile
root@tester ~ # emerge baselayout -p

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] sys-apps/baselayout-1.11.11-r3  
root@tester ~ # cat /etc/proflie
cat: /etc/proflie: No such file or directory
root@tester ~ # which cat
/usr/bin/cat
root@tester ~ # /usr/bin/cat /etc/proflie
/usr/bin/cat: /etc/proflie: No such file or directory

Also this 
root@tester ~ # ls /etc/bash*
bash_logout  bashrc
root@tester ~ # cat /etc/bashrc
cat: /etc/bashrc: No such file or directory
root@tester ~ # ll /etc/bashrc
ls: /etc/bashrc: No such file or directory
root@tester ~ # ll /etc/bash* 
total 8.0K
-rw-r--r--  1 root root  132 May  2 15:59 bash_logout
-rw-r--r--  1 root root 1.7K May  2 15:59 bashrc
root@tester ~ # less /etc/bashrc
/etc/bashrc: No such file or directory

This happening in multi-gnome terminal and in my consules. Whats strange to me is I start X with "startxfce4" and that worked but as above source /etc/profile and "set PS1="blah from profile" doesnt.
Comment 7 Hiel Van Campen 2005-05-02 22:41:22 UTC
If I su as root or usr and give the root password im returened to the origianl usr with color prompt. I also re-emerged baselayout and bash with no change. :(
Comment 8 Hiel Van Campen 2005-05-02 23:08:14 UTC
Ok to clarify my last comment when I su I do change to root. Before su PS1='\u@\h \w \$ ' after su PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'. After su if I exit back to user PS1 is set correctly. Its late and my brain is shuting down. Its /etc/bash/bashrc not /etc/bashrc which from /etc/profile
if [ -n "${BASH_VERSION}" ]; then
	# Newer bash ebuilds include /etc/bashrc which will setup PS1
	# including color.  We leave out color here because not all
	# terminals support it.
====>	if [ -f /etc/bashrc ]; then
		# Bash login shells run only /etc/profile
and		# Bash non-login shells run only /etc/bashrc
below		# Since we want to run /etc/bashrc always we source it
		# from here.  It is unfortunate that there is no way to do
		# this *after* the user's .bash_profile runs (without putting
		# it in the user's dot-files), but it shouldn't make any
		# difference.
 ==========>    . /etc/bashrc <=========
	else
		PS1='\u@\h \w \$ '
	fi
should be ". /etc/bash/bashrc"