FS#22036 - [filesystem] /etc/profile checks scripts for executable bit but sources them

Attached to Project: Arch Linux
Opened by Dave Reisner (falconindy) - Thursday, 09 December 2010, 21:09 GMT
Last edited by Pierre Schmitz (Pierre) - Tuesday, 14 December 2010, 07:12 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

/etc/profile shows some slightly confusing behavior in reading the contents of /etc/profile.d. It tests for the executable bit, but then sources the script (as it must, to preserve environment). This causes issues with upstream scripts mean to be placed in this directory that are not shipped with the executable bit. bash_completion.sh, for example, probably has never been sourced on a stock Arch machine.

The profile script should probably just 'test -r' rather than 'test -x'.
This task depends upon

Closed by  Pierre Schmitz (Pierre)
Tuesday, 14 December 2010, 07:12 GMT
Reason for closing:  Fixed
Comment by Pierre Schmitz (Pierre) - Sunday, 12 December 2010, 23:48 GMT
I didn't add this test myself but I guess it was done to be able to enable and disable profile scripts by simply altering the execute bit. But I am not sure if that is really needed.
Comment by Dave Reisner (falconindy) - Monday, 13 December 2010, 00:10 GMT
Well, even without the executable check you still have the option to change the filename since the loop explicitly reads *.sh files. But that brings up a separate issue -- some packages provides .csh files for /etc/profile.d which won't be sourced.

In case you're interested, the "offending" .csh packages are: jdk, jre, glib2, openjdk6, nxclient, mozilla-common.
Comment by Pierre Schmitz (Pierre) - Tuesday, 14 December 2010, 07:12 GMT
As I don't really see any need to check the x bit I have removed the test. I guess those .csh profles are for non-posix shells; which we probably cannot support in /etc/profile anyway.

Loading...