[COREUTILS 0/2] Improved acl handling

2015-04-12 Thread Andreas Gruenbacher
Hello, here are the simple changes for pulling in the gnulib acl handling improvements into coreutils. These patches (and the richacl patches on top) are available here: https://github.com/andreas-gruenbacher/coreutils I have tested the code with and without ACL support on Linux. The code f

[GNULIB 2/4] acl: On Linux, check for acls without libacl

2015-04-12 Thread Andreas Gruenbacher
On Linux, use the getxattr syscall instead of the acl_extended_file libacl library function to check for the presence of acls, avoiding a library dependency. * lib/file-has-acl.c: Include xattr headers if we have them. (file_has_acl): On Linux, use getxattr(). * m4/acl.m4 (gl_FUNC_ACL): Define LIB

[GNULIB 3/4] qacl: Simplify HP-UP acl_nontrivial check

2015-04-12 Thread Andreas Gruenbacher
* lib/acl-internal.c: Remove struct stat parameter from HP-UX's version of acl_nontrivial. Check if the acl has at most three entries instead (it must have exactly three entries according to the HP-UX documentation). Ignore uids and gids as long as an entry is either for a user (i.e., the owner), a

[COREUTILS 2/2] ls: Don't treat lack of acl support as an error

2015-04-12 Thread Andreas Gruenbacher
* src/ls.c (file_has_acl_cache): When a file system doesn't support acls, fail with errno set to ENOTSUP. (gobble_file): Don't treat lack of acl support as an error. --- src/ls.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ls.c b/src/ls.c index b308dd3..884e

[GNULIB 1/4] acl, qacl: split off shared functions into separate object file

2015-04-12 Thread Andreas Gruenbacher
Some of the helper functions in file-has-acl.c are used from qcopy-acl.c while file_has_acl() isn't needed there. Split the shared functions off into acl-internal.c. * lib/file-has-acl.c: Remove helper functions here. * lib/acl-internal.c: Add helper functions here. * modules/qacl: Use acl-intern

[GNULIB 4/4] qacl: Reimplement qset_acl and qcopy_acl

2015-04-12 Thread Andreas Gruenbacher
Implement get_permissions and set_permissions primitives for getting all the permissions of a file, storing them, and later setting them. (In the minimal case, the permissions consist only of a file mode.) Reimplement qset_acl and qcopy_acl based on these new primitives: this avoids code duplicatio

[COREUTILS 1/2] build: updated gnulib acl handling

2015-04-12 Thread Andreas Gruenbacher
This changes how ls checks for acls on Linux (it no longer requires libacl) and rewrites how acls are set and copied between files. * gnulib: Update to latest. * gl/lib/tempname.c.diff: Adjust for gnulib changes. * gl/lib/tempname.h.diff: Likewise. * src/local.mk (src_ls_LDADD): Only link with th

[GNULIB 0/4] Improved acl handling

2015-04-12 Thread Andreas Gruenbacher
Hello, while looking into adding richacl support to coreutils, I found the set_acl and copy_acl gnulib functions in a less than ideal state: setting acls was implemented in both functions, with slightly differing behavior. Here is a rewrite based on the existing code which splits setting and setti

Re: [COREUTILS 0/2] Improved acl handling

2015-04-12 Thread Pádraig Brady
On 12/04/15 15:37, Andreas Gruenbacher wrote: > Hello, > > here are the simple changes for pulling in the gnulib acl handling > improvements > into coreutils. > > > These patches (and the richacl patches on top) are available here: > > https://github.com/andreas-gruenbacher/coreutils Cool t