Bug 111483 - /etc/profile.d scripts run by /etc/bashrc
/etc/profile.d scripts run by /etc/bashrc
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2003-12-04 07:11 EST by Reuben Thomas
Modified: 2014-03-16 22:40 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-23 01:07:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Reuben Thomas 2003-12-04 07:11:16 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; Linux i686; U) Opera 7.23  [en]

Description of problem:
Actually, this is more in the way of a question than a bug report 
(though I do consider the behaviour undesirable). Having googled 
extensively and checked the RedHat manuals, I can find no mention of 
why /etc/bashrc runs the scripts in /etc/profile.d (in the case that 
they haven't already been run by /etc/profile).

I noticed this because of a 3rd party /etc/profile.d script that 
added something to an environment variable. Of course, every time a 
subshell is spawned, this causes the variable to be expanded, which 
is undesirable. I filed a bug report with patch to the maintainer of 
the RPM in question, but it still seems reasonable to wonder why 
something called "profile", which one expects, by analogy with .
profile, /etc/profile and .bash_profile to be run only in login 
shells, is being run in all shells.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Start bash, not as a login shell.


Actual Results:  The /etc/profile.d scripts are run.

Expected Results:  I would've expected them to be run only in a login 

Additional info:
Comment 1 Bill Nottingham 2003-12-04 11:51:38 EST
It's a really really old change. ISTR it was done for uniformity of
all interactive shells, for example, xterms, etc.
Comment 2 Reuben Thomas 2003-12-06 16:51:30 EST
Since you've not closed the bug, I'm guessing you at least admit the 
possibility that it might be a problem?

Just as a suggestion, here's my view on what should happen: because 
/etc/profile and .bash_profile aren't run in every xterm either 
(unless you use the -ls option) I've either set a default of -ls, or 
caused my environment to be set up by .Xclients or somewhere else in 
the login process (at the moment I don't use xdm, kdm or whatever, so 
it's simply a question of logging in and running startx; all my X 
clients therefore inherit my login environment).

Some solution like this is cleaner as it doesn't break assumptions 
about the function of profile.d scripts, while still giving the 
expected effect in xterms (not to mention other applications started 
directly by the window manager).
Comment 3 Bill Nottingham 2004-09-23 01:07:21 EDT
At this point, I don't think we're going to change this.

Note You need to log in before you can comment on or make changes to this bug.