Bug 35714 - /etc/profile incorrectly checks for executable bit
Summary: /etc/profile incorrectly checks for executable bit
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: setup
Version: 7.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-04-11 22:07 UTC by Philip Rowlands
Modified: 2014-03-17 02:20 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2001-04-18 02:01:02 UTC

Attachments (Terms of Use)

Description Philip Rowlands 2001-04-11 22:07:18 UTC
/etc/profile contains the following lines:

for i in /etc/profile.d/*.sh ; do
        if [ -x $i ]; then
                . $i

The test should be for read (-r) rather than execute (-x), because
source'ing a file reads it.

While you're at it, could you also fix /etc/csh.cshrc to use "-r" for this

Comment 1 Trond Eivind Glomsrxd 2001-04-17 21:44:42 UTC
That's not a bug, it's just an easy way to turn it off :)

Comment 2 Philip Rowlands 2001-04-18 02:00:57 UTC
I would respectfully suggest that there are other ways to turn it off without 
requiring this broken behaviour (e.g rename to *.sh.x).

It is a bug because it's no guard against the conditional action successfully 
reading the file (ditto for csh.cshrc). Being able to execve() a file is not 
the same as being able to open() it.

I'm not reporting this to be pedantic; I've seen RPMs packaged by people who 
thought that a script file which is sourced needs read permissions; no more.

Comment 3 Bill Nottingham 2001-06-12 20:14:32 UTC
Will be fixed in 2.4.11-1; thanks!

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