##// END OF EJS Templates
try to fix test-inherit-mode on HFS+...
Alexis S. L. Carvalho -
r6113:8ca25589 default
parent child Browse files
Show More
@@ -1,68 +1,90 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # test that new files created in .hg inherit the permissions from .hg/store
3 # test that new files created in .hg inherit the permissions from .hg/store
4
4
5 "$TESTDIR/hghave" unix-permissions || exit 80
5 "$TESTDIR/hghave" unix-permissions || exit 80
6
6
7 mkdir dir
7 mkdir dir
8 # just in case somebody has a strange $TMPDIR
8 # just in case somebody has a strange $TMPDIR
9 chmod g-s dir
9 chmod g-s dir
10 cd dir
10 cd dir
11
11
12 cat >printmodes.py <<EOF
12 cat >printmodes.py <<EOF
13 import os, sys
13 import os, sys
14
14
15 allnames = []
15 allnames = []
16 isdir = {}
16 isdir = {}
17 for root, dirs, files in os.walk(sys.argv[1]):
17 for root, dirs, files in os.walk(sys.argv[1]):
18 for d in dirs:
18 for d in dirs:
19 name = os.path.join(root, d)
19 name = os.path.join(root, d)
20 isdir[name] = 1
20 isdir[name] = 1
21 allnames.append(name)
21 allnames.append(name)
22 for f in files:
22 for f in files:
23 name = os.path.join(root, f)
23 name = os.path.join(root, f)
24 allnames.append(name)
24 allnames.append(name)
25 allnames.sort()
25 allnames.sort()
26 for name in allnames:
26 for name in allnames:
27 suffix = name in isdir and '/' or ''
27 suffix = name in isdir and '/' or ''
28 print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
28 print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
29 EOF
29 EOF
30
30
31 cat >mode.py <<EOF
32 import sys
33 import os
34 print '%05o' % os.lstat(sys.argv[1]).st_mode
35 EOF
36
31 umask 077
37 umask 077
32
38
33 hg init repo
39 hg init repo
34 cd repo
40 cd repo
35
41
36 chmod 0770 .hg/store
42 chmod 0770 .hg/store
37 chmod g+s .hg/store
38
43
39 echo '% before commit'
44 echo '% before commit'
40 echo '% store can be written by the group, other files cannot'
45 echo '% store can be written by the group, other files cannot'
41 echo '% store is setgid'
46 echo '% store is setgid'
42 python ../printmodes.py .
47 python ../printmodes.py .
43
48
44 mkdir dir
49 mkdir dir
45 touch foo dir/bar
50 touch foo dir/bar
46 hg ci -qAm 'add files'
51 hg ci -qAm 'add files'
47
52
48 echo
53 echo
49 echo '% after commit'
54 echo '% after commit'
50 echo '% working dir files can only be written by the owner'
55 echo '% working dir files can only be written by the owner'
51 echo '% files created in .hg can be written by the group'
56 echo '% files created in .hg can be written by the group'
52 echo '% (in particular, store/**, dirstate, branch.cache, undo files)'
57 echo '% (in particular, store/**, dirstate, branch.cache, undo files)'
53 echo '% new directories are setgid'
58 echo '% new directories are setgid'
54 python ../printmodes.py .
59 python ../printmodes.py .
55
60
56 umask 007
61 umask 007
57 hg init ../push
62 hg init ../push
58 echo
63 echo
59 echo '% before push'
64 echo '% before push'
60 echo '% group can write everything'
65 echo '% group can write everything'
61 python ../printmodes.py ../push
66 python ../printmodes.py ../push
62
67
63 umask 077
68 umask 077
64 hg -q push ../push
69 hg -q push ../push
65 echo
70 echo
66 echo '% after push'
71 echo '% after push'
67 echo '% group can still write everything'
72 echo '% group can still write everything'
68 python ../printmodes.py ../push
73 python ../printmodes.py ../push
74
75 # Test that we don't lose the setgid bit when we call chmod.
76 # Not all systems support setgid directories (e.g. HFS+), so
77 # just check that directories have the same mode.
78 cd ..
79 hg init setgid
80 cd setgid
81 chmod g+s .hg/store 2> /dev/null
82 mkdir dir
83 touch dir/file
84 hg ci -qAm 'add dir/file'
85 storemode=`python ../mode.py .hg/store`
86 dirmode=`python ../mode.py .hg/store/data/dir`
87 if [ "$storemode" != "$dirmode" ]; then
88 echo "$storemode != $dirmode"
89 fi
90
@@ -1,54 +1,54 b''
1 % before commit
1 % before commit
2 % store can be written by the group, other files cannot
2 % store can be written by the group, other files cannot
3 % store is setgid
3 % store is setgid
4 00700 ./.hg/
4 00700 ./.hg/
5 00600 ./.hg/00changelog.i
5 00600 ./.hg/00changelog.i
6 00600 ./.hg/requires
6 00600 ./.hg/requires
7 02770 ./.hg/store/
7 00770 ./.hg/store/
8
8
9 % after commit
9 % after commit
10 % working dir files can only be written by the owner
10 % working dir files can only be written by the owner
11 % files created in .hg can be written by the group
11 % files created in .hg can be written by the group
12 % (in particular, store/**, dirstate, branch.cache, undo files)
12 % (in particular, store/**, dirstate, branch.cache, undo files)
13 % new directories are setgid
13 % new directories are setgid
14 00700 ./.hg/
14 00700 ./.hg/
15 00600 ./.hg/00changelog.i
15 00600 ./.hg/00changelog.i
16 00660 ./.hg/dirstate
16 00660 ./.hg/dirstate
17 00600 ./.hg/requires
17 00600 ./.hg/requires
18 02770 ./.hg/store/
18 00770 ./.hg/store/
19 00660 ./.hg/store/00changelog.i
19 00660 ./.hg/store/00changelog.i
20 00660 ./.hg/store/00manifest.i
20 00660 ./.hg/store/00manifest.i
21 02770 ./.hg/store/data/
21 00770 ./.hg/store/data/
22 02770 ./.hg/store/data/dir/
22 00770 ./.hg/store/data/dir/
23 00660 ./.hg/store/data/dir/bar.i
23 00660 ./.hg/store/data/dir/bar.i
24 00660 ./.hg/store/data/foo.i
24 00660 ./.hg/store/data/foo.i
25 00660 ./.hg/store/undo
25 00660 ./.hg/store/undo
26 00660 ./.hg/undo.branch
26 00660 ./.hg/undo.branch
27 00660 ./.hg/undo.dirstate
27 00660 ./.hg/undo.dirstate
28 00700 ./dir/
28 00700 ./dir/
29 00600 ./dir/bar
29 00600 ./dir/bar
30 00600 ./foo
30 00600 ./foo
31
31
32 % before push
32 % before push
33 % group can write everything
33 % group can write everything
34 00770 ../push/.hg/
34 00770 ../push/.hg/
35 00660 ../push/.hg/00changelog.i
35 00660 ../push/.hg/00changelog.i
36 00660 ../push/.hg/requires
36 00660 ../push/.hg/requires
37 00770 ../push/.hg/store/
37 00770 ../push/.hg/store/
38
38
39 % after push
39 % after push
40 % group can still write everything
40 % group can still write everything
41 00770 ../push/.hg/
41 00770 ../push/.hg/
42 00660 ../push/.hg/00changelog.i
42 00660 ../push/.hg/00changelog.i
43 00660 ../push/.hg/branch.cache
43 00660 ../push/.hg/branch.cache
44 00660 ../push/.hg/requires
44 00660 ../push/.hg/requires
45 00770 ../push/.hg/store/
45 00770 ../push/.hg/store/
46 00660 ../push/.hg/store/00changelog.i
46 00660 ../push/.hg/store/00changelog.i
47 00660 ../push/.hg/store/00manifest.i
47 00660 ../push/.hg/store/00manifest.i
48 00770 ../push/.hg/store/data/
48 00770 ../push/.hg/store/data/
49 00770 ../push/.hg/store/data/dir/
49 00770 ../push/.hg/store/data/dir/
50 00660 ../push/.hg/store/data/dir/bar.i
50 00660 ../push/.hg/store/data/dir/bar.i
51 00660 ../push/.hg/store/data/foo.i
51 00660 ../push/.hg/store/data/foo.i
52 00660 ../push/.hg/store/undo
52 00660 ../push/.hg/store/undo
53 00660 ../push/.hg/undo.branch
53 00660 ../push/.hg/undo.branch
54 00660 ../push/.hg/undo.dirstate
54 00660 ../push/.hg/undo.dirstate
General Comments 0
You need to be logged in to leave comments. Login now