author | Raphaël Gomès <rgomes@octobus.net> |
Fri, 23 Feb 2024 15:57:50 +0100 | |
changeset 51443 | 69ad1d1d9947 |
parent 51309 | 9b44b25dece1 |
permissions | -rw-r--r-- |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
1 |
Test exclusion-based ACL enforcement |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
$ . "$TESTDIR/narrow-library.sh" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 |
$ hg init master |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 |
$ cd master |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 |
$ for x in `$TESTDIR/seq.py 3`; do |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
> echo $x > "f$x" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 |
> hg add "f$x" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 |
> hg commit -m "Add $x" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
11 |
> done |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 |
$ cat >> .hg/hgrc << EOF |
42209
280f7a095df8
narrow: send specs as bundle2 data instead of param (issue5952) (issue6019)
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
36089
diff
changeset
|
13 |
> [narrowacl] |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
14 |
> default.includes=* |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
15 |
> default.excludes=f2 f3 |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
16 |
> test.excludes=f3 |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 |
> EOF |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 |
$ hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 |
$ cat hg.pid >> "$DAEMON_PIDS" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 |
$ cd .. |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 |
$ hg clone http://localhost:$HGPORT1 narrowclone1 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 |
requesting all changes |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 |
adding changesets |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 |
adding manifests |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 |
adding file changes |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 |
added 3 changesets with 2 changes to 2 files |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
28 |
new changesets * (glob) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 |
updating to branch default |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
32 |
The clone directory should only contain f1 and f2 |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
42209
diff
changeset
|
33 |
$ ls -A -1 narrowclone1 | sort |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
42209
diff
changeset
|
34 |
.hg |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
35 |
f1 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
36 |
f2 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
37 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
38 |
Requirements should contain narrowhg |
48464
5e6542143d40
test: use `hg debugrequires` instead of `cat` in some tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44724
diff
changeset
|
39 |
$ hg debugrequires -R narrowclone1 | grep narrowhg |
36089
e14821b290eb
narrowrepo: make repo requirement include the string 'experimental'
Augie Fackler <augie@google.com>
parents:
36079
diff
changeset
|
40 |
narrowhg-experimental |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
41 |
|
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
42 |
NarrowHG should exclude f3. |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
43 |
$ hg -R narrowclone1 tracked |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
44 |
I path:. |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
45 |
X path:f3 |
49241
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
46 |
|
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
47 |
Narrow should not be able to widen to include f3 |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
48 |
$ hg -R narrowclone1 tracked --addinclude f3 |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
49 |
comparing with http://localhost:$HGPORT1/ |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
50 |
searching for changes |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
51 |
adding changesets |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
52 |
adding manifests |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
53 |
adding file changes |
49241
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
54 |
$ ls -A -1 narrowclone1 | sort |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
55 |
.hg |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
56 |
f1 |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
57 |
f2 |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
58 |
$ hg -R narrowclone1 tracked |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
59 |
I path:. |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
60 |
X path:f3 |
49241
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
61 |
|
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
62 |
|
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
63 |
Narrow should not be able to remove the exclusion for f3 |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
64 |
$ hg -R narrowclone1 tracked --removeexclude f3 |
49241
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
65 |
comparing with http://localhost:$HGPORT1/ |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
66 |
searching for changes |
51309
9b44b25dece1
narrow: prevent removal of ACL-defined excludes
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
51308
diff
changeset
|
67 |
abort: The following excludes cannot be removed for test: ['path:f3'] |
9b44b25dece1
narrow: prevent removal of ACL-defined excludes
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
51308
diff
changeset
|
68 |
[255] |
49241
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
69 |
$ ls -A -1 narrowclone1 | sort |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
70 |
.hg |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
71 |
f1 |
6b10151b9621
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC)
Sandu Turcan <idlsoft@gmail.com>
parents:
48464
diff
changeset
|
72 |
f2 |
51308
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
73 |
$ hg -R narrowclone1 tracked |
bf7c24e12fad
narrow: add test demonstrating bug in acl exclusion enforcement
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
49241
diff
changeset
|
74 |
I path:. |
51309
9b44b25dece1
narrow: prevent removal of ACL-defined excludes
Arun Kulshreshtha <akulshreshtha@janestreet.com>
parents:
51308
diff
changeset
|
75 |
X path:f3 |