[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: About the userland API for ACL, xattr, extattr



Hi,

while answering i realize that ACL is not enabled with my UFS
filesystem and that the ENOSYS might come from this individual
shortcomming and not from lack of support.

I will try to investigate and distinguish.

Do you have a web pointer to the source of libacl as used in kfreebsd ?

--------------------------------------------------------------------

Steven Chamberlain wrote:
> I'm not even familiar with ACLs, so you probably know more about this
> than me!

My code knows how to get and set ACL and extented file attributes
on Linux and on FreeBSD 8.0. I obviously had reason to avoid type
ACL_TYPE_DEFAULT on FreeBSD:
   /* Note: no ACL_TYPE_DEFAULT in FreeBSD */

Elsewise both usages of ACL API are the same:
  acl_t, acl_free(3), acl_get_file(3), acl_set_file(3),
  acl_to_text(3), acl_from_text(3)

On Linux it is necessary to link with -lacl.
On FreeBSD 8 it suffices to link libc (which is hard to avoid).

On Debian amd64 Sid, man acl_get_file has the title
  BSD Library Functions Manual
and the footer
  IEEE Std 1003.1e draft 17 (“POSIX.1e”, abandoned)


> I think we should aim to implement this cross-platform interface rather
> than the FreeBSD-specific one for example.

>From my narrow experience i'd say that the Linux implementation
is an adaption and slight expansion of the FreeBSD one.


> | acl_delete_def_file(3), acl_dup(3), acl_free(3), acl_from_text(3),
> | acl_get_fd(3), acl_get_file(3), acl_init(3), acl_set_fd(3),
> | acl_set_file(3), acl_to_text(3), acl_valid(3) 
> http://sources.debian.net/src/glibc/2.21-1/sysdeps/unix/bsd/bsd4.4/kfreebsd/
syscalls.list/?hl=11#L11

The kernel interface might indeed be complete.
acl_delete_def_file(3) is about ACL_TYPE_DEFAULT.
acl_dup(3), acl_from_text(3), acl_init(3), acl_to_text(3),
and acl_valid(3) might be implemented in userland.
Probably in
  https://svnweb.freebsd.org/base/head/lib/libc/posix1e/


> The others functions might be available already as library functions in
> libacl.

My short encounter with -lacl on kfreebsd 7 lets me think
that libacl needs organ transplants from the FreeBSD posix1e
implementation.

But it might also be that ENOSYS is the way how the kernel
tells me that there is no ACL support in the particular
filesystem.
(It was made by the installer on a i386 mini.iso with
 creation time 2015090121223300. Thank you for flying xorriso.
)

The FreeBSD handbook says in
  https://www.freebsd.org/doc/handbook/fs-acl.html
that i either shall set the acls flag in /etc/fstab or
use tunefs.
Well, on kfreebsd there is /sbin/tunefs.ufs

  # tunefs.ufs -p /
  tunefs.ufs: POSIX.1e ACLs: (-a)                disabled
  ...


> What is a testcase or an example of usage that returns ENOSYS?

I manipulated libisofs to let it link and use -lacl as it does
on GNU/Linux. It worked fine at build time.

At run time the error happened when i tried to restore ACL
from an ISO fileystem to a directory in /home:
  /dev/ad0s1 on / (ufs, local)

It must have been the use of acl_from_text(3) in
  http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/view/head:/libisofs/aaip-os-linux.c#L414
or of acl_set_file(3) in #L418.


Have a nice day :)

Thomas


Reply to: