From: Jim Meyering Date: Wed, 23 Jul 2003 07:03:31 +0000 (+0000) Subject: Add a check for whether $NON_ROOT_USERNAME X-Git-Tag: v5.0.90~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cf4280099a3e0efa73940b4b72137b848fd0608;p=thirdparty%2Fcoreutils.git Add a check for whether $NON_ROOT_USERNAME can access the required version of rm. --- diff --git a/tests/rm/fail-2eperm b/tests/rm/fail-2eperm index 8f67faebd4..698ca4eff9 100755 --- a/tests/rm/fail-2eperm +++ b/tests/rm/fail-2eperm @@ -33,7 +33,19 @@ fi fail=0 -setuidgid $NON_ROOT_USERNAME rm -rf a 2> out && fail=1 +# Try to ensure that $NON_ROOT_USERNAME can access +# the required version of rm. +rm_version=`setuidgid $NON_ROOT_USERNAME rm --version|sed -n '1s/.* //p'` +case $rm_version in + $PACKAGE_VERSION) ;; + *) echo "$0: cannot access required version ($PACKAGE_VERSION) of rm" 1>&2 + fail=1 ;; +esac +setuidgid $NON_ROOT_USERNAME rm -rf a 2> out-t && fail=1 + +# On some systems, we get `Not owner'. Convert it. +sed 's/Not owner/Operation not permitted/' out-t > out + cat <<\EOF > exp rm: cannot remove `a/b': Operation not permitted EOF