do_clean ()
{
test -d $dir || return 0
- find $dir -type d -exec chmod u+rwx '{}' ';' || :
+ # Don't try to be smart and use find here, that has caused issues
+ # and extra ERROR results in the past. Be dumb and safe.
+ chmod u+rwx $dir || :
+ for d in $dir/*; do test ! -d $d || chmod u+rwx $d || :; done
+ for d in $dir/*/*; do test ! -d $d || chmod u+rwx $d || :; done
rm -rf $dir
}
cd ..
chmod 000 $dir/sub/* $dir/file
test $have_symlinks = yes && chmod 000 $dir/symlink
-chmod 000 $dir/sub $dir
-command_ok_ "pre-cleanup can deal with null-perms testdir" \
+chmod 500 $dir/sub $dir
+command_ok_ "pre-cleanup can deal with low-perms testdir" \
$SHELL -c '. ./defs' dummy.test
-command_ok_ "pre-cleanup removed null-perms testdir" \
+command_ok_ "pre-cleanup removed low-perms testdir" \
eval 'test ! -f $dir && test ! -d $dir && test ! -r $dir'
do_clean
# Check that post-test cleanup works also with directories with
# "null" permissions, and containing broken symlinks.
-command_ok_ "post-cleanup can deal with null-perms testdir" \
+command_ok_ "post-cleanup can deal with low-perms testdir" \
$SHELL -c '
stderr_fileno_=2
. ./defs || Exit 1
cd ..
chmod 000 dir/sub/* dir/file
test $have_symlinks = yes && chmod 000 dir/symlink
- chmod 000 dir/sub dir
+ chmod 500 dir/sub dir
:
' dummy.test
command_ok_ "post-cleanup removed null-perms testdir" \
command_ok_ "post-cleanup chmod doesn't follow symlinks to dirs" \
eval 'ls -ld dir | grep "^d---------.*dir"'
+ chmod u+rwx dir file
rmdir dir
rm -f file