mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
tests/path.sh: if root, skip tests involving unreadable scripts
These always fail when running as root, as root can access files regardless of permission bits. (cherry picked from commit a821fe13906ac8ef56162bebd7c3e976b973f91c)
This commit is contained in:
parent
62f8e744f1
commit
6e90d4d76c
1 changed files with 6 additions and 0 deletions
|
@ -282,6 +282,10 @@ PATH=$path
|
|||
scr=$tmp/script
|
||||
exp=126
|
||||
|
||||
if [[ $(id -u) == '0' ]]; then
|
||||
print -u2 -r "${Command}[$LINENO]: warning: running as root: skipping tests involving unreadable scripts"
|
||||
else
|
||||
|
||||
: > $scr
|
||||
chmod a=x $scr
|
||||
{ got=$($scr; print $?); } 2>/dev/null
|
||||
|
@ -309,6 +313,8 @@ got=$($SHELL -c "$scr; print \$?" 2>/dev/null)
|
|||
got=$($SHELL -c "command $scr; print \$?" 2>/dev/null)
|
||||
[[ "$got" == "$exp" ]] || err_exit "\$SHELL -c of command of unreadable non-empty script should fail -- expected $exp, got" $got
|
||||
|
||||
fi # if [[ $(id -u) == '0' ]]
|
||||
|
||||
# whence -a bug fix
|
||||
cd "$tmp"
|
||||
ifs=$IFS
|
||||
|
|
Loading…
Reference in a new issue