Mercurial > gnulib
annotate tests/test-copy-acl.sh @ 40156:066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
* tests/init.sh (setup_): Set srcdir and builddir.
(BOURNE_SHELL): New variable.
* modules/acl-tests (Depends-on): Add 'test-framework-sh'.
* modules/file-has-acl-tests (Depends-on): Likewise.
* modules/copy-file-tests (Depends-on): Likewise.
* tests/test-set-mode-acl-1.sh: Use the test framework. Invoke shell
scripts through $BOURNE_SHELL.
* tests/test-set-mode-acl-2.sh: Likewise.
* tests/test-copy-acl-1.sh: Likewise.
* tests/test-copy-acl-2.sh: Likewise.
* tests/test-file-has-acl-1.sh: Likewise.
* tests/test-file-has-acl-2.sh: Likewise.
* tests/test-copy-file-1.sh: Likewise.
* tests/test-copy-file-2.sh: Likewise.
* tests/test-set-mode-acl.sh (builddir): Consider value set by the
invoker.
* tests/test-copy-acl.sh (builddir): Likewise.
* tests/test-file-has-acl.sh (builddir): Likewise.
* tests/test-copy-file.sh (builddir): Likewise.
* tests/test-vc-list-files-cvs.sh: Don't create shims for executables in
build-aux/. Instead, invoke shell scripts through $BOURNE_SHELL.
* tests/test-vc-list-files-git.sh: Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 27 Jan 2019 16:01:23 +0100 |
parents | 498a2211d839 |
children | 8c1a17df67e0 |
rev | line source |
---|---|
10142 | 1 #!/bin/sh |
2 | |
3 # Show all commands when run with environment variable VERBOSE=yes. | |
4 test -z "$VERBOSE" || set -x | |
5 | |
10444
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
6 test "$USE_ACL" = 0 && |
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
7 { |
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
8 echo "Skipping test: insufficient ACL support" |
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
9 exit 77 |
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
10 } |
e7595530873e
avoid spurious test failure when library is built without ACL support
Jim Meyering <meyering@redhat.com>
parents:
10149
diff
changeset
|
11 |
10142 | 12 # func_tmpdir |
13 # creates a temporary directory. | |
14 # Sets variable | |
15 # - tmp pathname of freshly created temporary directory | |
16 func_tmpdir () | |
17 { | |
18 # Use the environment variable TMPDIR, falling back to /tmp. This allows | |
19 # users to specify a different temporary directory, for example, if their | |
20 # /tmp is filled up or too small. | |
21 : ${TMPDIR=/tmp} | |
22 { | |
23 # Use the mktemp program if available. If not available, hide the error | |
24 # message. | |
25 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` && | |
26 test -n "$tmp" && test -d "$tmp" | |
27 } || | |
28 { | |
29 # Use a simple mkdir command. It is guaranteed to fail if the directory | |
30 # already exists. $RANDOM is bash specific and expands to empty in shells | |
31 # other than bash, ksh and zsh. Its use does not increase security; | |
32 # rather, it minimizes the probability of failure in a very cluttered /tmp | |
33 # directory. | |
34 tmp=$TMPDIR/gl$$-$RANDOM | |
35 (umask 077 && mkdir "$tmp") | |
36 } || | |
37 { | |
38 echo "$0: cannot create a temporary directory in $TMPDIR" >&2 | |
39 exit 1 | |
40 } | |
41 } | |
42 | |
43 func_tmpdir | |
40156
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
44 # builddir may already be set by the script that invokes this one. |
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
45 case "$builddir" in |
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
46 '') builddir=`pwd` ;; |
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
47 /* | ?:*) ;; |
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
48 *) builddir=`pwd`/$builddir ;; |
066c585853e5
tests: Accommodate a shell that is not in /bin/sh.
Bruno Haible <bruno@clisp.org>
parents:
16935
diff
changeset
|
49 esac |
10142 | 50 cd "$builddir" || |
51 { | |
52 echo "$0: cannot determine build directory (unreadable parent dir?)" >&2 | |
53 exit 1 | |
54 } | |
55 # Switch to a temporary directory, to increase the likelihood that ACLs are | |
56 # supported on the current file system. (/tmp is usually locally mounted, | |
57 # whereas the build dir is sometimes NFS-mounted.) | |
58 ( cd "$tmp" | |
59 | |
60 # Prepare tmpfile0. | |
61 rm -f tmpfile[0-9] tmpaclout[0-2] | |
62 echo "Simple contents" > tmpfile0 | |
63 chmod 600 tmpfile0 | |
64 | |
65 # Classification of the platform according to the programs available for | |
66 # manipulating ACLs. | |
67 # Possible values are: | |
14905
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
68 # linux, cygwin, freebsd, solaris, hpux, hpuxjfs, osf1, aix, macosx, irix, none. |
16214
ec738d6aeef5
Talk about "native Windows API", not "Win32".
Bruno Haible <bruno@clisp.org>
parents:
14905
diff
changeset
|
69 # TODO: Support also native Windows platforms (mingw). |
10142 | 70 acl_flavor=none |
71 if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then | |
72 # Platforms with the getfacl and setfacl programs. | |
73 # Linux, FreeBSD, Solaris, Cygwin. | |
74 if (setfacl --help >/dev/null) 2>/dev/null; then | |
75 # Linux, Cygwin. | |
76 if (LC_ALL=C setfacl --help | grep ' --set-file' >/dev/null) 2>/dev/null; then | |
77 # Linux. | |
78 acl_flavor=linux | |
79 else | |
80 acl_flavor=cygwin | |
81 fi | |
82 else | |
83 # FreeBSD, Solaris. | |
84 if (LC_ALL=C setfacl 2>&1 | grep '\-x entries' >/dev/null) 2>/dev/null; then | |
85 # FreeBSD. | |
86 acl_flavor=freebsd | |
87 else | |
88 # Solaris. | |
89 acl_flavor=solaris | |
90 fi | |
91 fi | |
92 else | |
93 if (lsacl / >/dev/null) 2>/dev/null; then | |
94 # Platforms with the lsacl and chacl programs. | |
95 # HP-UX, sometimes also IRIX. | |
14905
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
96 if (getacl tmpfile0 >/dev/null) 2>/dev/null; then |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
97 # HP-UX 11.11 or newer. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
98 acl_flavor=hpuxjfs |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
99 else |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
100 # HP-UX 11.00. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
101 acl_flavor=hpux |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
102 fi |
10142 | 103 else |
104 if (getacl tmpfile0 >/dev/null) 2>/dev/null; then | |
13757
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
105 # Tru64, NonStop Kernel. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
106 if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
107 # Tru64. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
108 acl_flavor=osf1 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
109 else |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
110 # NonStop Kernel. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
111 acl_flavor=nsk |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
112 fi |
10142 | 113 else |
114 if (aclget tmpfile0 >/dev/null) 2>/dev/null; then | |
115 # AIX. | |
116 acl_flavor=aix | |
117 else | |
118 if (fsaclctl -v >/dev/null) 2>/dev/null; then | |
16935
498a2211d839
Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents:
16214
diff
changeset
|
119 # Mac OS X. |
10142 | 120 acl_flavor=macosx |
121 else | |
122 if test -f /sbin/chacl; then | |
123 # IRIX. | |
124 acl_flavor=irix | |
125 fi | |
126 fi | |
127 fi | |
128 fi | |
129 fi | |
130 fi | |
131 | |
132 # Define a function to test for the same ACLs, from the point of view of | |
133 # the programs. | |
134 # func_test_same_acls file1 file2 | |
135 case $acl_flavor in | |
136 linux | cygwin | freebsd | solaris) | |
137 func_test_same_acls () | |
138 { | |
139 getfacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 | |
140 getfacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 | |
141 cmp tmpaclout1 tmpaclout2 > /dev/null | |
142 } | |
143 ;; | |
144 hpux) | |
145 func_test_same_acls () | |
146 { | |
147 lsacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 | |
148 lsacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 | |
149 cmp tmpaclout1 tmpaclout2 > /dev/null | |
150 } | |
151 ;; | |
14905
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
152 hpuxjfs) |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
153 func_test_same_acls () |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
154 { |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
155 { lsacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
156 lsacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
157 cmp tmpaclout1 tmpaclout2 > /dev/null |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
158 } && |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
159 { getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
160 getacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
161 cmp tmpaclout1 tmpaclout2 > /dev/null |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
162 } |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
163 } |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
164 ;; |
13757
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
165 osf1 | nsk) |
10142 | 166 func_test_same_acls () |
167 { | |
168 getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 | |
169 getacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 | |
170 cmp tmpaclout1 tmpaclout2 > /dev/null | |
171 } | |
172 ;; | |
173 aix) | |
174 func_test_same_acls () | |
175 { | |
176 aclget "$1" > tmpaclout1 | |
177 aclget "$2" > tmpaclout2 | |
178 cmp tmpaclout1 tmpaclout2 > /dev/null | |
179 } | |
180 ;; | |
181 macosx) | |
182 func_test_same_acls () | |
183 { | |
184 /bin/ls -le "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 | |
185 /bin/ls -le "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 | |
186 cmp tmpaclout1 tmpaclout2 > /dev/null | |
187 } | |
188 ;; | |
189 irix) | |
190 func_test_same_acls () | |
191 { | |
192 /bin/ls -lD "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1 | |
193 /bin/ls -lD "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2 | |
194 cmp tmpaclout1 tmpaclout2 > /dev/null | |
195 } | |
196 ;; | |
197 none) | |
198 func_test_same_acls () | |
199 { | |
200 : | |
201 } | |
202 ;; | |
203 esac | |
204 | |
205 # func_test_copy file1 file2 | |
206 # copies file1 to file2 and verifies the permissions and ACLs are the same | |
207 # on both. | |
208 func_test_copy () | |
209 { | |
210 echo "Simple contents" > "$2" | |
211 chmod 600 "$2" | |
212 "$builddir"/test-copy-acl${EXEEXT} "$1" "$2" || exit 1 | |
213 "$builddir"/test-sameacls${EXEEXT} "$1" "$2" || exit 1 | |
214 func_test_same_acls "$1" "$2" || exit 1 | |
215 } | |
216 | |
217 func_test_copy tmpfile0 tmpfile1 | |
218 | |
219 if test $acl_flavor != none; then | |
11914
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
220 # A POSIX compliant 'id' program. |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
221 if test -f /usr/xpg4/bin/id; then |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
222 ID=/usr/xpg4/bin/id |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
223 else |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
224 ID=id |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
225 fi |
10142 | 226 # Use a user and group id different from the current one, to avoid |
227 # redundant/ambiguous ACLs. | |
11914
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
228 myuid=`$ID -u` |
e9cf9c46ad7a
Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents:
10444
diff
changeset
|
229 mygid=`$ID -g` |
10142 | 230 auid=1 |
231 if test "$auid" = "$myuid"; then auid=2; fi | |
232 agid=1 | |
233 if test "$agid" = "$mygid"; then agid=2; fi | |
234 | |
235 case $acl_flavor in | |
10149
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
236 linux | freebsd | solaris) |
10142 | 237 |
238 # Set an ACL for a user. | |
239 setfacl -m user:$auid:1 tmpfile0 | |
240 | |
241 func_test_copy tmpfile0 tmpfile2 | |
242 | |
243 # Set an ACL for a group. | |
244 setfacl -m group:$agid:4 tmpfile0 | |
245 | |
246 func_test_copy tmpfile0 tmpfile3 | |
247 | |
248 # Set an ACL for other. | |
249 case $acl_flavor in | |
250 freebsd) setfacl -m other::4 tmpfile0 ;; | |
251 solaris) chmod o+r tmpfile0 ;; | |
252 *) setfacl -m other:4 tmpfile0 ;; | |
253 esac | |
254 | |
255 func_test_copy tmpfile0 tmpfile4 | |
256 | |
257 # Remove the ACL for the user. | |
258 case $acl_flavor in | |
259 linux) setfacl -x user:$auid tmpfile0 ;; | |
260 freebsd) setfacl -x user:$auid:1 tmpfile0 ;; | |
261 *) setfacl -d user:$auid:1 tmpfile0 ;; | |
262 esac | |
263 | |
264 func_test_copy tmpfile0 tmpfile5 | |
265 | |
266 # Remove the ACL for other. | |
267 case $acl_flavor in | |
268 linux | solaris) ;; # impossible | |
269 freebsd) setfacl -x other::4 tmpfile0 ;; | |
270 *) setfacl -d other:4 tmpfile0 ;; | |
271 esac | |
272 | |
273 func_test_copy tmpfile0 tmpfile6 | |
274 | |
275 # Remove the ACL for the group. | |
276 case $acl_flavor in | |
277 linux) setfacl -x group:$agid tmpfile0 ;; | |
278 freebsd) setfacl -x group:$agid:4 tmpfile0 ;; | |
279 *) setfacl -d group:$agid:4 tmpfile0 ;; | |
280 esac | |
281 | |
282 func_test_copy tmpfile0 tmpfile7 | |
283 | |
284 # Delete all optional ACLs. | |
285 case $acl_flavor in | |
286 linux | freebsd) | |
287 setfacl -m user:$auid:1 tmpfile0 | |
288 setfacl -b tmpfile0 | |
289 ;; | |
290 *) | |
291 setfacl -s user::6,group::0,other:0 tmpfile0 ;; | |
292 esac | |
293 | |
294 func_test_copy tmpfile0 tmpfile8 | |
295 | |
296 # Copy ACLs from a file that has no ACLs. | |
297 echo > tmpfile9 | |
298 chmod a+x tmpfile9 | |
299 case $acl_flavor in | |
300 linux) getfacl tmpfile9 | setfacl --set-file=- tmpfile0 ;; | |
301 freebsd) ;; | |
302 *) getfacl tmpfile9 | setfacl -f - tmpfile0 ;; | |
303 esac | |
304 rm -f tmpfile9 | |
305 | |
306 func_test_copy tmpfile0 tmpfile9 | |
307 | |
308 ;; | |
309 | |
10149
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
310 cygwin) |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
311 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
312 # Set an ACL for a group. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
313 setfacl -m group:0:1 tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
314 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
315 func_test_copy tmpfile0 tmpfile2 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
316 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
317 # Set an ACL for other. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
318 setfacl -m other:4 tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
319 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
320 func_test_copy tmpfile0 tmpfile4 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
321 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
322 # Remove the ACL for the group. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
323 setfacl -d group:0 tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
324 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
325 func_test_copy tmpfile0 tmpfile5 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
326 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
327 # Remove the ACL for other. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
328 setfacl -d other:4 tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
329 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
330 func_test_copy tmpfile0 tmpfile6 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
331 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
332 # Delete all optional ACLs. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
333 setfacl -s user::6,group::0,other:0 tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
334 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
335 func_test_copy tmpfile0 tmpfile8 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
336 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
337 # Copy ACLs from a file that has no ACLs. |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
338 echo > tmpfile9 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
339 chmod a+x tmpfile9 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
340 getfacl tmpfile9 | setfacl -f - tmpfile0 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
341 rm -f tmpfile9 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
342 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
343 func_test_copy tmpfile0 tmpfile9 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
344 |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
345 ;; |
2f94bd2a861d
Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents:
10142
diff
changeset
|
346 |
10142 | 347 hpux) |
348 | |
349 # Set an ACL for a user. | |
350 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` | |
351 chacl -r "${orig}($auid.%,--x)" tmpfile0 | |
352 | |
353 func_test_copy tmpfile0 tmpfile2 | |
354 | |
355 # Set an ACL for a group. | |
356 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` | |
357 chacl -r "${orig}(%.$agid,r--)" tmpfile0 | |
358 | |
359 func_test_copy tmpfile0 tmpfile3 | |
360 | |
361 # Set an ACL for other. | |
362 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` | |
363 chacl -r "${orig}(%.%,r--)" tmpfile0 | |
364 | |
365 func_test_copy tmpfile0 tmpfile4 | |
366 | |
367 # Remove the ACL for the user. | |
368 chacl -d "($auid.%,--x)" tmpfile0 | |
369 | |
370 func_test_copy tmpfile0 tmpfile5 | |
371 | |
372 # Remove the ACL for the group. | |
373 chacl -d "(%.$agid,r--)" tmpfile0 | |
374 | |
375 func_test_copy tmpfile0 tmpfile6 | |
376 | |
377 # Delete all optional ACLs. | |
378 chacl -z tmpfile0 | |
379 | |
380 func_test_copy tmpfile0 tmpfile8 | |
381 | |
382 # Copy ACLs from a file that has no ACLs. | |
383 echo > tmpfile9 | |
384 chmod a+x tmpfile9 | |
385 orig=`lsacl tmpfile9 | sed -e 's/ tmpfile9$//'` | |
386 rm -f tmpfile9 | |
387 chacl -r "${orig}" tmpfile0 | |
388 | |
389 func_test_copy tmpfile0 tmpfile9 | |
390 | |
391 ;; | |
392 | |
14905
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
393 hpuxjfs) |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
394 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
395 # Set an ACL for a user. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
396 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
397 chacl -r "${orig}($auid.%,--x)" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
398 || setacl -m user:$auid:1 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
399 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
400 func_test_copy tmpfile0 tmpfile2 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
401 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
402 # Set an ACL for a group. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
403 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
404 chacl -r "${orig}(%.$agid,r--)" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
405 || setacl -m group:$agid:4 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
406 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
407 func_test_copy tmpfile0 tmpfile3 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
408 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
409 # Set an ACL for other. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
410 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'` |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
411 chacl -r "${orig}(%.%,r--)" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
412 || setacl -m other:4 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
413 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
414 func_test_copy tmpfile0 tmpfile4 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
415 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
416 # Remove the ACL for the user. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
417 chacl -d "($auid.%,--x)" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
418 || setacl -d user:$auid tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
419 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
420 func_test_copy tmpfile0 tmpfile5 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
421 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
422 # Remove the ACL for the group. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
423 chacl -d "(%.$agid,r--)" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
424 || setacl -d group:$agid tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
425 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
426 func_test_copy tmpfile0 tmpfile6 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
427 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
428 # Delete all optional ACLs. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
429 chacl -z tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
430 || { setacl -m user:$auid:1 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
431 setacl -s user::6,group::0,class:7,other:0 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
432 } |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
433 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
434 func_test_copy tmpfile0 tmpfile8 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
435 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
436 # Copy ACLs from a file that has no ACLs. |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
437 echo > tmpfile9 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
438 chmod a+x tmpfile9 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
439 orig=`lsacl tmpfile9 | sed -e 's/ tmpfile9$//'` |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
440 getacl tmpfile9 > tmpaclout0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
441 rm -f tmpfile9 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
442 chacl -r "${orig}" tmpfile0 \ |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
443 || setacl -f tmpaclout0 tmpfile0 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
444 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
445 func_test_copy tmpfile0 tmpfile9 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
446 |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
447 ;; |
a9b67d6b93df
acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents:
13757
diff
changeset
|
448 |
10142 | 449 osf1) |
450 | |
451 # Set an ACL for a user. | |
452 setacl -u user:$auid:1 tmpfile0 | |
453 | |
454 func_test_copy tmpfile0 tmpfile2 | |
455 | |
456 # Set an ACL for a group. | |
457 setacl -u group:$agid:4 tmpfile0 | |
458 | |
459 func_test_copy tmpfile0 tmpfile3 | |
460 | |
461 # Set an ACL for other. | |
462 setacl -u other::4 tmpfile0 | |
463 | |
464 func_test_copy tmpfile0 tmpfile4 | |
465 | |
466 # Remove the ACL for the user. | |
467 setacl -x user:$auid:1 tmpfile0 | |
468 | |
469 func_test_copy tmpfile0 tmpfile5 | |
470 | |
471 if false; then # would give an error "can't set ACL: Invalid argument" | |
472 # Remove the ACL for other. | |
473 setacl -x other::4 tmpfile0 | |
474 | |
475 func_test_copy tmpfile0 tmpfile6 | |
476 fi | |
477 | |
478 # Remove the ACL for the group. | |
479 setacl -x group:$agid:4 tmpfile0 | |
480 | |
481 func_test_copy tmpfile0 tmpfile7 | |
482 | |
483 # Delete all optional ACLs. | |
484 setacl -u user:$auid:1 tmpfile0 | |
485 setacl -b tmpfile0 | |
486 | |
487 func_test_copy tmpfile0 tmpfile8 | |
488 | |
489 # Copy ACLs from a file that has no ACLs. | |
490 echo > tmpfile9 | |
491 chmod a+x tmpfile9 | |
492 getacl tmpfile9 > tmpaclout0 | |
493 setacl -b -U tmpaclout0 tmpfile0 | |
494 rm -f tmpfile9 | |
495 | |
496 func_test_copy tmpfile0 tmpfile9 | |
497 | |
498 ;; | |
499 | |
13757
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
500 nsk) |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
501 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
502 # Set an ACL for a user. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
503 setacl -m user:$auid:1 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
504 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
505 func_test_copy tmpfile0 tmpfile2 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
506 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
507 # Set an ACL for a group. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
508 setacl -m group:$agid:4 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
509 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
510 func_test_copy tmpfile0 tmpfile3 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
511 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
512 # Set an ACL for other. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
513 setacl -m other:4 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
514 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
515 func_test_copy tmpfile0 tmpfile4 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
516 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
517 # Remove the ACL for the user. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
518 setacl -d user:$auid tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
519 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
520 func_test_copy tmpfile0 tmpfile5 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
521 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
522 # Remove the ACL for the group. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
523 setacl -d group:$agid tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
524 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
525 func_test_copy tmpfile0 tmpfile6 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
526 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
527 # Delete all optional ACLs. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
528 setacl -m user:$auid:1 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
529 setacl -s user::6,group::0,class:7,other:0 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
530 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
531 func_test_copy tmpfile0 tmpfile8 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
532 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
533 # Copy ACLs from a file that has no ACLs. |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
534 echo > tmpfile9 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
535 chmod a+x tmpfile9 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
536 getacl tmpfile9 > tmpaclout0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
537 setacl -f tmpaclout0 tmpfile0 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
538 rm -f tmpfile9 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
539 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
540 func_test_copy tmpfile0 tmpfile9 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
541 |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
542 ;; |
87aaf9340686
acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
11914
diff
changeset
|
543 |
10142 | 544 aix) |
545 | |
546 # Set an ACL for a user. | |
547 { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo " permit --x u:$auid"; } | aclput tmpfile0 | |
548 | |
549 func_test_copy tmpfile0 tmpfile2 | |
550 | |
551 # Set an ACL for a group. | |
552 { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo " permit r-- g:$agid"; } | aclput tmpfile0 | |
553 | |
554 func_test_copy tmpfile0 tmpfile3 | |
555 | |
556 # Set an ACL for other. | |
557 chmod o+r tmpfile0 | |
558 | |
559 func_test_copy tmpfile0 tmpfile4 | |
560 | |
561 # Remove the ACL for the user. | |
562 aclget tmpfile0 | grep -v ' u:[^ ]*$' | aclput tmpfile0 | |
563 | |
564 func_test_copy tmpfile0 tmpfile5 | |
565 | |
566 # Remove the ACL for the group. | |
567 aclget tmpfile0 | grep -v ' g:[^ ]*$' | aclput tmpfile0 | |
568 | |
569 func_test_copy tmpfile0 tmpfile7 | |
570 | |
571 # Delete all optional ACLs. | |
572 aclget tmpfile0 | sed -e 's/enabled$/disabled/' | sed -e '/disabled$/q' | aclput tmpfile0 | |
573 | |
574 func_test_copy tmpfile0 tmpfile8 | |
575 | |
576 # Copy ACLs from a file that has no ACLs. | |
577 echo > tmpfile9 | |
578 chmod a+x tmpfile9 | |
579 aclget tmpfile9 | aclput tmpfile0 | |
580 rm -f tmpfile9 | |
581 | |
582 func_test_copy tmpfile0 tmpfile9 | |
583 | |
584 ;; | |
585 | |
586 macosx) | |
587 | |
588 # Set an ACL for a user. | |
589 /bin/chmod +a "user:daemon allow execute" tmpfile0 | |
590 | |
591 func_test_copy tmpfile0 tmpfile2 | |
592 | |
593 # Set an ACL for a group. | |
594 /bin/chmod +a "group:daemon allow read" tmpfile0 | |
595 | |
596 func_test_copy tmpfile0 tmpfile3 | |
597 | |
598 # Set an ACL for other. | |
599 chmod o+r tmpfile0 | |
600 | |
601 func_test_copy tmpfile0 tmpfile4 | |
602 | |
603 # Remove the ACL for the user. | |
604 /bin/chmod -a "user:daemon allow execute" tmpfile0 | |
605 | |
606 func_test_copy tmpfile0 tmpfile5 | |
607 | |
608 # Remove the ACL for the group. | |
609 /bin/chmod -a "group:daemon allow read" tmpfile0 | |
610 | |
611 func_test_copy tmpfile0 tmpfile7 | |
612 | |
613 # Delete all optional ACLs. | |
614 /bin/chmod -N tmpfile0 | |
615 | |
616 func_test_copy tmpfile0 tmpfile8 | |
617 | |
618 # Copy ACLs from a file that has no ACLs. | |
619 echo > tmpfile9 | |
620 chmod a+x tmpfile9 | |
621 { /bin/ls -le tmpfile9 | sed -n -e 's/^ [0-9][0-9]*: //p'; echo; } | /bin/chmod -E tmpfile0 | |
622 rm -f tmpfile9 | |
623 | |
624 func_test_copy tmpfile0 tmpfile9 | |
625 | |
626 ;; | |
627 | |
628 irix) | |
629 | |
630 # Set an ACL for a user. | |
631 /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x tmpfile0 | |
632 | |
633 func_test_copy tmpfile0 tmpfile2 | |
634 | |
635 # Set an ACL for a group. | |
636 /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x,group:$agid:r-- tmpfile0 | |
637 | |
638 func_test_copy tmpfile0 tmpfile3 | |
639 | |
640 # Set an ACL for other. | |
641 /sbin/chacl user::rw-,group::---,user:$auid:--x,group:$agid:r--,other::r-- tmpfile0 | |
642 | |
643 func_test_copy tmpfile0 tmpfile4 | |
644 | |
645 # Remove the ACL for the user. | |
646 /sbin/chacl user::rw-,group::---,group:$agid:r--,other::r-- tmpfile0 | |
647 | |
648 func_test_copy tmpfile0 tmpfile5 | |
649 | |
650 # Remove the ACL for the group. | |
651 /sbin/chacl user::rw-,group::---,other::r-- tmpfile0 | |
652 | |
653 func_test_copy tmpfile0 tmpfile7 | |
654 | |
655 ;; | |
656 | |
657 esac | |
658 fi | |
659 | |
660 rm -f tmpfile[0-9] tmpaclout[0-2] | |
661 ) || exit 1 | |
662 | |
663 rm -rf "$tmp" | |
664 exit 0 |