annotate tests/test-file-has-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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #!/bin/sh
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 # Show all commands when run with environment variable VERBOSE=yes.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 test -z "$VERBOSE" || set -x
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # func_tmpdir
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # creates a temporary directory.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 # Sets variable
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 # - tmp pathname of freshly created temporary directory
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 func_tmpdir ()
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 # Use the environment variable TMPDIR, falling back to /tmp. This allows
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 # users to specify a different temporary directory, for example, if their
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # /tmp is filled up or too small.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 : ${TMPDIR=/tmp}
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 # Use the mktemp program if available. If not available, hide the error
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 # message.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 test -n "$tmp" && test -d "$tmp"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 } ||
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # Use a simple mkdir command. It is guaranteed to fail if the directory
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 # already exists. $RANDOM is bash specific and expands to empty in shells
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 # other than bash, ksh and zsh. Its use does not increase security;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 # rather, it minimizes the probability of failure in a very cluttered /tmp
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 # directory.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 tmp=$TMPDIR/gl$$-$RANDOM
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 (umask 077 && mkdir "$tmp")
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 } ||
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 cd "$builddir" ||
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 echo "$0: cannot determine build directory (unreadable parent dir?)" >&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 # Switch to a temporary directory, to increase the likelihood that ACLs are
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 # supported on the current file system. (/tmp is usually locally mounted,
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 # whereas the build dir is sometimes NFS-mounted.)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 ( cd "$tmp"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 # Prepare tmpfile0.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 rm -f tmpfile[0-9] tmp.err
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 echo "Simple contents" > tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 chmod 600 tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 # Classification of the platform according to the programs available for
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 # manipulating ACLs.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 acl_flavor=none
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 # Platforms with the getfacl and setfacl programs.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 # Linux, FreeBSD, Solaris, Cygwin.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 if (setfacl --help >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 # Linux, Cygwin.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 if (LC_ALL=C setfacl --help | grep ' --set-file' >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 # Linux.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 acl_flavor=linux
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 acl_flavor=cygwin
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 # FreeBSD, Solaris.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 if (LC_ALL=C setfacl 2>&1 | grep '\-x entries' >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 # FreeBSD.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 acl_flavor=freebsd
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 # Solaris.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 acl_flavor=solaris
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 if (lsacl / >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 # Platforms with the lsacl and chacl programs.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 # AIX.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 acl_flavor=aix
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
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
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 acl_flavor=macosx
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 if test -f /sbin/chacl; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 # IRIX.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 acl_flavor=irix
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 # func_test_file_has_acl file expected
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 # tests the result of the file_has_acl function on file, and checks that it
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 # matches the expected value.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 func_test_file_has_acl ()
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 res=`"$builddir"/test-file-has-acl${EXEEXT} "$1"`
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 test "$res" = "$2" || {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 echo "file_has_acl(\"$1\") returned $res, expected $2" 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 # func_test_has_acl file expected
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 # tests the result of the file_has_acl function on file, and checks that it
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 # matches the expected value, also taking into account the system's 'ls'
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 # program.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 case $acl_flavor in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 freebsd | solaris | hpux | macosx)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 case $acl_flavor in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 freebsd | solaris | hpux) acl_ls_option="-ld" ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 macosx) acl_ls_option="-lde" ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 func_test_has_acl ()
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 func_test_file_has_acl "$1" "$2"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 case `/bin/ls $acl_ls_option "$1" | sed 1q` in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 ??????????+*)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 test "$2" = yes || {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 echo "/bin/ls $acl_ls_option $1 shows an ACL, but expected $2" 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 ??????????" "*)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 test "$2" = no || {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 echo "/bin/ls $acl_ls_option $1 shows no ACL, but expected $2" 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 irix)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 func_test_has_acl ()
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 func_test_file_has_acl "$1" "$2"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 case `/bin/ls -ldD "$1" | sed 1q` in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 *" []")
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 test "$2" = no || {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 echo "/bin/ls -ldD $1 shows no ACL, but expected $2" 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 *)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 test "$2" = yes || {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 echo "/bin/ls -ldD $1 shows an ACL, but expected $2" 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 *)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 func_test_has_acl ()
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195 {
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 func_test_file_has_acl "$1" "$2"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 }
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202
11551
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
203 mkdir tmpdir0
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
204 func_test_has_acl tmpdir0 no
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
205
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 if test $acl_flavor != none; then
11914
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
207 # A POSIX compliant 'id' program.
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
208 if test -f /usr/xpg4/bin/id; then
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
209 ID=/usr/xpg4/bin/id
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
210 else
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
211 ID=id
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
212 fi
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 # Use a user and group id different from the current one, to avoid
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 # redundant/ambiguous ACLs.
11914
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
215 myuid=`$ID -u`
e9cf9c46ad7a Work around deficient /usr/bin/id program on Solaris.
Bruno Haible <bruno@clisp.org>
parents: 11551
diff changeset
216 mygid=`$ID -g`
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 auid=1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 if test "$auid" = "$myuid"; then auid=2; fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 agid=1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 if test "$agid" = "$mygid"; then agid=2; fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 case $acl_flavor in
10149
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
223 linux | freebsd | solaris)
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 if setfacl -m user:$auid:1 tmpfile0; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231 case $acl_flavor in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232 linux) setfacl -x user:$auid tmpfile0 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233 freebsd) setfacl -x user:$auid:1 tmpfile0 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234 *) setfacl -d user:$auid:1 tmpfile0 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236
11551
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
237 # On Linux and FreeBSD, the ACL for the mask is implicitly added.
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 # On Solaris, it is always there.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239 case $acl_flavor in
11551
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
240 linux | freebsd) func_test_has_acl tmpfile0 yes ;;
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
241 *) func_test_has_acl tmpfile0 no ;;
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
243
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 # Remove the ACL for the mask, if it was implicitly added.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 case $acl_flavor in
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 linux | freebsd) setfacl -x mask: tmpfile0 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 *) setfacl -d mask: tmpfile0 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254
10149
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
255 cygwin)
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
256
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
257 # Set an ACL for a group.
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
258 if setfacl -m group:0:1 tmpfile0; then
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
259
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
260 func_test_has_acl tmpfile0 yes
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
261
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
262 # Remove the ACL for the group.
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
263 setfacl -d group:0 tmpfile0
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
264
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
265 func_test_has_acl tmpfile0 no
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
266
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
267 fi
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
268 ;;
2f94bd2a861d Use different test code for Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 10148
diff changeset
269
14905
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
270 hpux | hpuxjfs)
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 if chacl -r "${orig}($auid.%,--x)" tmpfile0; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 chacl -d "($auid.%,--x)" tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282
14905
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
283 else
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
284 if test $acl_flavor = hpuxjfs; then
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
285
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
286 # 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
287 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
288
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
289 func_test_has_acl tmpfile0 yes
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
290
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
291 # 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
292 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
293
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
294 func_test_has_acl tmpfile0 no
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
295
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 13757
diff changeset
296 fi
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 osf1)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 setacl -u user:$auid:1 tmpfile0 2> tmp.err
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304 cat tmp.err 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 if grep 'Error:' tmp.err > /dev/null \
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 || grep 'Operation not supported' tmp.err > /dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 :
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 setacl -x user:$auid:1 tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
319
13757
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
320 nsk)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
321
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
322 # Set an ACL for a user.
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
323 setacl -m user:$auid:1 tmpfile0
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
324
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
325 func_test_has_acl tmpfile0 yes
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
326
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
327 # Remove the ACL for the user.
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
328 setacl -d user:$auid tmpfile0
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
329
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
330 func_test_has_acl tmpfile0 no
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
331
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
332 ;;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 11914
diff changeset
333
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 aix)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337 { aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo " permit --x u:$auid"; } | aclput tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 if aclget tmpfile0 | grep enabled > /dev/null; then
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 aclget tmpfile0 | grep -v ' u:[^ ]*$' | aclput tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 macosx)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 /bin/chmod +a "user:daemon allow execute" tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
355 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
357 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
358 /bin/chmod -a "user:daemon allow execute" tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
359
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
360 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 irix)
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 # Set an ACL for a user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 /sbin/chacl user::rw-,group::---,other::---,user:$auid:--x tmpfile0 2> tmp.err
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 cat tmp.err 1>&2
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 if test -s tmp.err; then :; else
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 func_test_has_acl tmpfile0 yes
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 # Remove the ACL for the user.
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 /sbin/chacl user::rw-,group::---,other::--- tmpfile0
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 func_test_has_acl tmpfile0 no
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 ;;
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 esac
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 fi
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384 rm -f tmpfile[0-9] tmp.err
11551
957a85702f2b Fix test-file-has-acl on FreeBSD.
David Bartley <dtbartle@csclub.uwaterloo.ca>
parents: 10444
diff changeset
385 rm -rf tmpdir0
10142
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386 ) || exit 1
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
388 rm -rf "$tmp"
dc740b83408a New ACL unit tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 exit 0