1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

tests/bracket.sh: don't test r/w perms as root; fix typos

src/cmd/ksh93/tests/bracket.sh:
- -r and -w are always true when running as root, so skip these.
- Fix several typos in the [[ tests (apparent copy/paste errors).

(cherry picked from commit b9325e9753b38f087d0c5501d474f7d1f15c4d36)
This commit is contained in:
Martijn Dekker 2020-06-03 02:39:43 +02:00
parent e1ef18c8ef
commit 80126062cc

View file

@ -66,7 +66,7 @@ fi
if [[ ! -w $file ]]
then err_exit "-w: $file should be writable"
fi
if [[ ! -w $file ]]
if [[ ! -x $file ]]
then err_exit "-x: $file should be executable"
fi
if [[ ! -w $file || ! -r $file ]]
@ -79,30 +79,35 @@ if [[ ! -f $file ]]
then err_exit "-f: $file should be an ordinary file"
fi
if [[ -d $file ]]
then err_exit "-f: $file should not be a directory file"
then err_exit "-d: $file should not be a directory file"
fi
if [[ ! -d . ]]
then err_exit "-d: . should not be a directory file"
then err_exit "-d: . should be a directory file"
fi
if [[ -f /dev/null ]]
then err_exit "-f: /dev/null should not be an ordinary file"
fi
chmod 000 $file
if [[ -r $file ]]
then err_exit "-r: $file should not be readable"
if [[ $(id -u) == '0' ]]
then print -u2 -r "${Command}[$LINENO]: warning: running as root: skipping tests involving r/w permissions"
else if [[ -r $file ]]
then err_exit "-r: $file should not be readable"
fi
if [[ -w $file ]]
then err_exit "-w: $file should not be writable"
fi
if [[ -w $file || -r $file ]]
then err_exit "-rw: $file should not be readable/writable"
fi
fi
if [[ ! -O $file ]]
then err_exit "-r: $file should be owned by me"
then err_exit "-O: $file should be owned by me"
fi
if [[ -w $file ]]
then err_exit "-w: $file should not be writable"
fi
if [[ -w $file ]]
if [[ -x $file ]]
then err_exit "-x: $file should not be executable"
fi
if [[ -w $file || -r $file ]]
then err_exit "-rw: $file should not be readable/writable"
fi
if [[ -z x && -z x || ! -z x ]]
then :
else err_exit " wrong precedence"