6 # A test for running "darcs get" when the parent directory has restrictive
7 # permissions. The bug is that darcs trys to "chdir" to the current directory
8 # using the full path. The permissions on the parent directory prevent this
9 # from working, even though the current repo and the remote have sufficient
12 # The real-world case where this would happen would be a web-server with
13 # restrictive permissions on "/home", with a user running darcs within that.
15 not
() { "$@" && exit 1 ||
:; }
17 if echo $OS |
grep -i windows
; then
18 echo This
test does not work on Windows
24 # Set up a "remote" repo
30 # this is an ugly hack for Cygwin and pwd
34 # Set up a directory with restrictive permissions
35 mkdir
-p tmp_restrictive
/liberal
36 cd tmp_restrictive
/liberal
37 chmod 0111 ..
/..
/tmp_restrictive
38 # sanity check that we can cd out and back
39 cd ..
/..
; cd tmp_restrictive
/liberal
40 # TODO: we avoid this test on Solaris because it seems we can't create
41 # anything in tmp_restrictive/liberal
43 if [ -e can_touch
]; then
45 darcs get
$DIR/tmp_remote
2> log
46 not
grep -i 'permission denied' log
48 echo "Apparently I can't do `basename $0` on this platform"
51 echo "Can't do `basename $0` on this platform"
54 # We have to fix the permissions, just so we can delete it.
55 chmod 0755 tmp_restrictive
57 rm -rf tmp_remote tmp_restrictive