diff options
-rwxr-xr-x | tests/chown/deref | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/chown/deref b/tests/chown/deref index 065686962..a10603719 100755 --- a/tests/chown/deref +++ b/tests/chown/deref @@ -7,6 +7,8 @@ if test "$VERBOSE" = yes; then chown --version fi +. $srcdir/../envvar-check + pwd=`pwd` t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0 @@ -24,8 +26,17 @@ fi fail=0 -set _ `ls -ldg dangle`; user=$3 +set _ `ls -ldg dangle`; shift; user=$3 + +# With 5.2.1 and earlier, this command would mistakenly succeed. +chown --dereference $user dangle 2> out1 && fail=1 +sed 's/: [^:]*$//' out1 > out + +cat <<\EOF > exp || fail=1 +chown: cannot dereference `dangle' +EOF -chown --dereference $user dangle && fail=1 +cmp out exp || fail=1 +test $fail = 1 && diff out exp 2> /dev/null (exit $fail); exit $fail |