Red Hat Bugzilla – Full Text Bug Listing
|Summary:||/etc/bashrc needs to run /etc/profile.d/term.sh for ALL interactive shells|
|Product:||[Fedora] Fedora||Reporter:||Eido Inoue <havill>|
|Component:||setup||Assignee:||Bill Nottingham <notting>|
|Status:||CLOSED NOTABUG||QA Contact:|
|Version:||2||CC:||bugzilla, hdegoede, rvokal|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2004-08-10 16:40:43 EDT||Type:||---|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
|Bug Depends On:|
Description Eido Inoue 2004-07-29 21:35:45 EDT
Description of problem: FC2 /etc/bashrc will run the files in /etc/profile.d only if interactive and it's the top level shell. /etc/bashrc needs to be modified so that term.sh is run for any interactive shell, regardless of level. Version-Release number of selected component (if applicable): 2.5.33-1 Additional info: RHEL3 will run /etc/profile.d/term.sh for any interactive shell-- no changes are needed for that.
Comment 1 Hans de Goede 2004-07-30 02:31:09 EDT
When/where exactly does this go wrong? if a user starts a terminal the shell started in this terminal is a toplevel shell, if a user starts additonal shells in this terminal then TERM already has the correct value, or am I missing something?
Comment 2 Eido Inoue 2004-07-30 16:14:03 EDT
misdiagnosis about the top level. in FC2 and beyond, TERM is preset to "dumb", which causes the term.sh script to ignore the guts of it. in RHEL3, TERM is preset to "xterm". Will make the appropriate changes to term.sh
Comment 3 Hans de Goede 2004-07-31 03:52:13 EDT
Hmm, then why does the current term.sh work on my FC3-test1 + rawhide updates system?
Comment 4 Bill Nottingham 2004-08-10 16:40:43 EDT
Closing as notabug for now.
Comment 5 Kasper Dupont 2004-11-16 02:35:22 EST
SHLVL does not tell you if the shell is a login shell. If you type "bash -l" the SHLVL environment will be increased, and the new shell will source the files from /etc/profile.d/ twice. There are probably also ways to cause the SHLVL to be 1 even for a nonlogin shell. The current configuration files looks like a mess. The last thing /etc/profile does is to source files from /etc/profile.d, but after that has happened ~/.bash_profile will source ~/.bashrc which again will source /etc/bashrc which may source files from /etc/profile.d again. Rather than processing files from /etc/profile.d twice and trying to make the two locations agree on who is responsible, it should be changed so they are sourced exactly once. I can think of two possible ways to accomplish this. The first would be to let ~/.bash_profile not source ~/.bashrc. And then change /etc/bashrc such that it always sources files from /etc/profile.d. The other approach would be to let /etc/profile never source files from /etc/profile.d and always make it the responsibility of /etc/bashrc. It also seems to me, that there should be a place for files that we want sourced only in login shells. Currently it appears that files in /etc/profile.d are intended to be sourced by every interactive shell.
Comment 6 Hans de Goede 2004-11-16 02:52:22 EST
Only running profile.d scripts for a login shell is not an option, you want to run them to for a shell started from xterm. Basicly you want to run them once for every interactive shell.
Comment 7 Kasper Dupont 2004-11-16 03:51:20 EST
Hans could you please elaborate on your last comment. Indeed the files currently in profile.d are intended to be sourced once in every interactive shell, and except from a few exceptions that is also what happens. If a package had a file that was intended to be sourced only in login shells, where would it put it?
Comment 8 Hans de Goede 2004-11-16 04:05:44 EST
I was just trying to warn that when any changes are made that one should be carefull that the files in profile.d don't end up only being sourced for a login or only for a non login interactive shell.
Comment 9 Kasper Dupont 2004-11-23 15:22:17 EST
I just found a case where the current scripts do not source any of the files in /etc/profile.d, though they should do so. In an interactive shell you can type "exec bash" to save your history and reread certain configuration files. If you do this from a login shell, the new shell will not be a login shell, but it will still have shell level 1. In this case /etc/profile is not sourced, and /etc/bashrc does not source the files from /etc/profile.d because it thinks /etc/profile already did.