From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030807 Description of problem: When you start a shell that is not a login shell (starting gnome-terminal with default settings for example) then the /etc/bashrc fails to understand that this is not a login shell and the /etc/profile.d/*.sh files are not sourced as they should be. One of the consequences of this is that ls doesn't have colors. The problem is in every redhat version from at least 6.2 till 9. A patch to fix this is included below. --- bashrc_original Tue Sep 16 14:52:11 2003 +++ bashrc Tue Sep 16 14:51:59 2003 @@ -39,7 +39,7 @@ esac [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " - if [ "x$SHLVL" != "x1" ]; then # We're not a login shell + if [ `shopt login_shell | cut -f 2` == "off" ]; then # We're not a login shell for i in /etc/profile.d/*.sh; do if [ -r "$i" ]; then . $i Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Start gnome-terminal 2. run alias Actual Results: nothing. No aliases are set. Expected Results: The correct output would be something like: alias l.='ls -d .[a-zA-Z]* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias vi='vim' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' Additional info:
An improvement over the previous patch would be to replace the if line with: if ! shopt -q login_shell; then # We're not a login shell That way no cut is needed and we have a cleaner solution.
I would recommend that you use the $- variable to determine if the shell is interactive. This will save in having to execute progs and form a pipe. See the my patch for details.
Created attachment 98128 [details] attachment removed. Comment #1 has a better fix. My patch works for RH9, Fedora, and RHEL3.
I'll withdraw my comments #2, #3 and the attachment. I see that the sub-submitter is looking for login shell, not interactive shells. The use of if ! shopt -q login_shell; then ... is just as good. Therefore I recommend the patch: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=104491#c1 as suggested in comment #1.
Comment on attachment 98128 [details] attachment removed. Comment #1 has a better fix.
Comment on attachment 98128 [details] attachment removed. Comment #1 has a better fix. Patch removed.
Added in 2.5.34-1.
This seems to break things: see bug #165873.