Bruno Haible wrote: > On HP-UX 11.11 and newer, I'm seeing these test failures: > > file_has_acl("tmpfile0") returned no, expected yes > FAIL: test-file-has-acl.sh > > FAIL: test-copy-acl.sh > FAIL: test-copy-file.sh > > It turns out that the support for HP-UX ACLs that I added on 2008-06-08 > <http://lists.gnu.org/archive/html/bug-gnulib/2008-06/msg00127.html> was only > complete for HP-UX 11.00. > > HP-UX 11.11 and newer has a new API, declared in <aclv.h>. And it's not > just a different API to read the same information in a different way. No. > It's a different API to read different kinds of ACLs that occur on different > file systems. So, on these systems, you have to try both APIs. > > The same situation exists on the command-line: The programs 'lsacl' and > 'chacl' > work only for the older kind of ACLs, and the new programs 'getacl' and > 'setacl' work only for the newer kind of ACLs. Really, I wouldn't want to be > a sysadmin of HP-UX machines... > > An additional quirk is that uses of the new API do not behave according to > its documentation: > - In order to retrieve the number of ACLs set on a file, using a command > ACL_CNT explicitly designed for this purpose, you have to pass a buffer. > The buffer is not touched, but you cannot pass a NULL pointer. > - On NFS the system call yields errno = EOPNOTSUPP, as documented, for > HP-UX 11.11 and 11.23. But on HP-UX 11.31, the result is EINVAL. > > This patch fixes it all. Tested on all 4 versions of HP-UX 11, both in /tmp > and on an NFS mounted file system. > > > 2011-06-12 Bruno Haible <br...@clisp.org> > > 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. > > --- doc/acl-resources.txt.orig Mon Jun 13 01:32:47 2011 > +++ doc/acl-resources.txt Mon Jun 13 01:22:02 2011 > @@ -243,15 +243,16 @@ > chmod > > > -HP-UX ACLs > +HP-UX 11.00 ACLs > > +Present in HP-UX >= 11.00. On some machines, yields ENOSYS always. > Manual pages: > - http://docs.hp.com/en/B2355-60105/acl.2.html > - http://docs.hp.com/en/B2355-60105/lsacl.1.html > - http://docs.hp.com/en/B2355-60105/chacl.1.html > - http://docs.hp.com/en/B2355-60105/getacl.1.html > + getacl, fgetacl: > http://h20000.www2.hp.com/bc/docs/support/SupportManual/c02261503/c02261503.pdf > + setacl, fsetacl: > http://h20000.www2.hp.com/bc/docs/support/SupportManual/c02267386/c02267386.pdf > + lsacl: > http://h20000.www2.hp.com/bc/docs/support/SupportManual/c02261049/c02261049.pdf > + chacl: > http://h20000.www2.hp.com/bc/docs/support/SupportManual/c01921575/c01921575.pdf > p. 125
Wow. Nice work. I haven't read all of that documentation, but am happy to trust you on this. I skimmed through the code and the only nit worth mentioning is line length (and that is debatable, because I think you've already explained your preference ;-). A few went way past 80 columns, and that makes them harder to read. + { + fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n", + file1, file2, i, entries1[i].a_type, entries2[i].a_type); + return 1; + } + if (entries1[i].a_id != entries2[i].a_id) + { + fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n", + file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id); + return 1; I prefer to split strings, fprintf (stderr, "files %s and %s: different ACL entry #%d: " "different ids %d and %d\n", file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id); but you're the one maintaining that code, so you choose what you prefer.