summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorDiego Rondini <diego.ml@zoho.com>2016-04-29 12:24:09 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-29 19:35:58 +0100
commit2806bed30988610e292c4396ebe10e7b53824b76 (patch)
tree9201e0e5b56b5ca13d2f871a1dce03d99eed1e23 /meta/recipes-core
parent896b2a0a330d1b1b5285bbf08e7cf9a9d6c2e06c (diff)
downloadpoky-2806bed30988610e292c4396ebe10e7b53824b76.tar.gz
base-files: add some safety checks in profile
Add some safety checks when sourcing files in /etc/profile.d/, in particular: - source only *.sh files, not every file. This is the practice in use in both Fedora and Debian/Ubuntu (see https://help.ubuntu.com/community/EnvironmentVariables#A.2Fetc.2Fprofile.d.2F.2A.sh); - check the input is actually a file and is readable. This check is especially important if profile.d is empty, as "*.sh" will get expanded only if profile.d is not empty. Previously if profile.d was present but empty, "/etc/profile.d/*" was sourced causing errors on login and breaking stuff, for example X startup. (From OE-Core rev: 8961bc4b71723477a3b4a837a1d9c25c1b860b9e) (From OE-Core rev: fde37b91284953cedc50bc32d22aac65a65afde1) Signed-off-by: Diego Rondini <diego.ml@zoho.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster@mvista.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/base-files/base-files/profile6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 53c2680409..e98e786b12 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -20,8 +20,10 @@ if [ "$PS1" ]; then
20fi 20fi
21 21
22if [ -d /etc/profile.d ]; then 22if [ -d /etc/profile.d ]; then
23 for i in /etc/profile.d/* ; do 23 for i in /etc/profile.d/*.sh ; do
24 . $i 24 if [ -f $i -a -r $i ]; then
25 . $i
26 fi
25 done 27 done
26 unset i 28 unset i
27fi 29fi