Bug 672 - [LTP]PATH contain ending colon for root user
Summary: [LTP]PATH contain ending colon for root user
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.0
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Kevin Tian
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2011-01-27 19:20 UTC by Kevin Tian
Modified: 2011-02-15 16:36 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified: Program Management
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Tian 2011-01-27 19:20:06 UTC
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 can fixes this problem.
Comment 2 Kevin Tian 2011-01-30 00:50:29 UTC
verified