summaryrefslogtreecommitdiff
path: root/tests/test-copy-file.sh
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-06-13 02:11:03 +0200
committerBruno Haible <bruno@clisp.org>2011-06-13 02:11:03 +0200
commit227b08bbf68b66e8d7cd4da5c1a6f0ebf5a5d9e8 (patch)
tree91f3e525a17a538c8e00c635064554f0c2f6469b /tests/test-copy-file.sh
parent9cbf59b7fd224f263fce77ef1dadd3be5439fc4f (diff)
downloadgnulib-227b08bbf68b66e8d7cd4da5c1a6f0ebf5a5d9e8.tar.gz
acl: Add support for HP-UX >= 11.11 JFS ACLs.
* doc/acl-resources.txt: Add info about the ACL APIs on HP-UX. * m4/acl.m4 (gl_FUNC_ACL): Also test for HP-UX 11.11 API. * lib/acl-internal.h [HP-UX 11.11]: Include <aclv.h>. (acl, aclsort): New declarations. (aclv_nontrivial): New declaration. * lib/file-has-acl.c (aclv_nontrivial) [HP-UX 11.11]: New function. (file_has_acl): Read also the second kind of HP-UX ACLs. * lib/set-mode-acl.c (qset_acl) [HP-UX 11.11]: Try to set the second kind of HP-UX ACLs if the first kind fails. * lib/copy-acl.c (qcopy_acl) [HP-UX 11.11]: Read and set also the second kind of HP-UX ACLs. * tests/test-sameacls.c [HP-UX 11.11]: Include <aclv.h>. (main) [HP-UX 11.11]: Test also whether the second kind of HP-UX ACLs agree. * tests/test-file-has-acl.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs. Handle hpuxjfs. * tests/test-set-mode-acl.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs. Handle hpuxjfs. * tests/test-copy-acl.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs. (func_test_same_acls): Use both lsacl and getacl. Handle hpuxjfs. * tests/test-copy-file.sh (acl_flavor) [HP-UX 11.11]: Set to hpuxjfs. (func_test_same_acls): Use both lsacl and getacl. Handle hpuxjfs.
Diffstat (limited to 'tests/test-copy-file.sh')
-rwxr-xr-xtests/test-copy-file.sh79
1 files changed, 77 insertions, 2 deletions
diff --git a/tests/test-copy-file.sh b/tests/test-copy-file.sh
index c63f380dd5..fecf9bc300 100755
--- a/tests/test-copy-file.sh
+++ b/tests/test-copy-file.sh
@@ -54,7 +54,7 @@ cd "$builddir" ||
# Classification of the platform according to the programs available for
# manipulating ACLs.
# Possible values are:
- # linux, cygwin, freebsd, solaris, hpux, osf1, aix, macosx, irix, none.
+ # linux, cygwin, freebsd, solaris, hpux, hpuxjfs, osf1, aix, macosx, irix, none.
# TODO: Support also native Win32 platforms (mingw).
acl_flavor=none
if (getfacl tmpfile0 >/dev/null) 2>/dev/null; then
@@ -82,7 +82,13 @@ cd "$builddir" ||
if (lsacl / >/dev/null) 2>/dev/null; then
# Platforms with the lsacl and chacl programs.
# HP-UX, sometimes also IRIX.
- acl_flavor=hpux
+ if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
+ # HP-UX 11.11 or newer.
+ acl_flavor=hpuxjfs
+ else
+ # HP-UX 11.00.
+ acl_flavor=hpux
+ fi
else
if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
# Tru64, NonStop Kernel.
@@ -132,6 +138,19 @@ cd "$builddir" ||
cmp tmpaclout1 tmpaclout2 > /dev/null
}
;;
+ hpuxjfs)
+ func_test_same_acls ()
+ {
+ { lsacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+ lsacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+ cmp tmpaclout1 tmpaclout2 > /dev/null
+ } &&
+ { getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
+ getacl "$2" | sed -e "s/$2/FILENAME/g" > tmpaclout2
+ cmp tmpaclout1 tmpaclout2 > /dev/null
+ }
+ }
+ ;;
osf1 | nsk)
func_test_same_acls ()
{
@@ -360,6 +379,62 @@ cd "$builddir" ||
;;
+ hpuxjfs)
+
+ # Set an ACL for a user.
+ orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+ chacl -r "${orig}($auid.%,--x)" tmpfile0 \
+ || setacl -m user:$auid:1 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile2
+
+ # Set an ACL for a group.
+ orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+ chacl -r "${orig}(%.$agid,r--)" tmpfile0 \
+ || setacl -m group:$agid:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile3
+
+ # Set an ACL for other.
+ orig=`lsacl tmpfile0 | sed -e 's/ tmpfile0$//'`
+ chacl -r "${orig}(%.%,r--)" tmpfile0 \
+ || setacl -m other:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile4
+
+ # Remove the ACL for the user.
+ chacl -d "($auid.%,--x)" tmpfile0 \
+ || setacl -d user:$auid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile5
+
+ # Remove the ACL for the group.
+ chacl -d "(%.$agid,r--)" tmpfile0 \
+ || setacl -d group:$agid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile6
+
+ # Delete all optional ACLs.
+ chacl -z tmpfile0 \
+ || { setacl -m user:$auid:1 tmpfile0
+ setacl -s user::6,group::0,class:7,other:0 tmpfile0
+ }
+
+ func_test_copy tmpfile0 tmpfile8
+
+ # Copy ACLs from a file that has no ACLs.
+ echo > tmpfile9
+ chmod a+x tmpfile9
+ orig=`lsacl tmpfile9 | sed -e 's/ tmpfile9$//'`
+ getacl tmpfile9 > tmpaclout0
+ rm -f tmpfile9
+ chacl -r "${orig}" tmpfile0 \
+ || setacl -f tmpaclout0 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile9
+
+ ;;
+
osf1)
# Set an ACL for a user.