]> code.ossystems Code Review - openembedded-core.git/commitdiff
base-files: remove ending colon from default $PATH for root user
authorKevin Tian <kevin.tian@intel.com>
Wed, 26 Jan 2011 08:28:45 +0000 (16:28 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 28 Jan 2011 16:49:12 +0000 (16:49 +0000)
now the PATH for root user defined in a problematic way
    PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:

from eglibc:
    /* Two adjacent colons, or a colon at the beginning or the end
       of `PATH' means to search the current directory.  */

that means current directory is always searched as the last path,
which could generate undesired behavior.

One example is found in LTP cron_deny01 test, which always complains
    "sh: cron_deny01 not found"

cron_deny01 is a shell script which setups the initial test preparation
and then invokes itself for real test under a different user:
    su $TEST_USER1 -c "$0"

'su' doesn't inherit PATH into the sub-shell, and thus $0 has to
be an absolute path to have right script found.

ltp appends the path of cron_deny01 to $PATH before running the test:
    export PATH="${PATH}:${LTPROOT}/testcases/bin"

In ideal way "${LTPROOT}/testcases/bin/cron_deny01" is found and becomes
$0, which works well.

However due to the ending colon in original PATH:
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin::${LTPROOT}/testcases/bin
$0 becomes 'cron_deny01' w/o leading path which makes sub-shell under 'su'
failed to locate cron_deny01.

remove ending colon then fixes this problem.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
meta/recipes-core/base-files/base-files/profile
meta/recipes-core/base-files/base-files_3.0.14.bb

index aa1c20fdb8f9878d3390e5f08128bb01f00bfef9..e9408d17d712a200ad91350547ffd1675671f307 100644 (file)
@@ -12,7 +12,7 @@ if [ ! -e /etc/localtime ]; then
 fi
 
 if [ "$HOME" = "/home/root" ]; then
-   PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:
+   PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
 fi
 if [ "$PS1" ]; then
 # works for bash and ash (no other shells known to be in use here)
index 2363feb6ba1c5973c28e14d5a0a5983a9fe4d757..d2fec72913be614b013d44a043a5d2cef51923d9 100644 (file)
@@ -2,7 +2,7 @@ SUMMARY = "Miscellaneous files for the base system."
 DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system."
 SECTION = "base"
 PRIORITY = "required"
-PR = "r66"
+PR = "r67"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
 SRC_URI = "file://rotation \