ACL type does not converge if permissions include capital X #98
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#98
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: jimis
__acl /path/to/dir/ --default --user username:r-X
Note the capital X in the permisisons part. No matter how many times I execute this, the type re-sets the ACL every time.
From setfacl manual:
The problem lies in the
gencode-remote
script, that expects to find the string "r-X" in the output ofgetfacl
(exploreracl_is
). Apparentlygetfacl
will never return a capital X. From the end ofgencode-remote
(the comment is mine):Fixing it properly is complicated, it would require logic while comparing
$acl_is
and$acl_should
, expecting "x" if it is a directory or if it is a file with the executable permissions bit set.My workaround is to add
-i
to that grep command line. Apparently this has drawbacks.Created by: jimis
Yes it is solved, thank you!
Created by: 4nd3r
this should be closed if #760 solved an issue
Created by: jimis
Sounds good! :-) But also skip the test entirely if it's a file and the "x" bit is not set for any user.
Created by: 4nd3r
wait... non-recursive test on path?
you don't know whether path, you are defining for
__acl
, is directory or file?i'm confused.
if that is the case, then we could just do simple test and
sed 's/x/X/
on wanted line in acl_is output...Created by: 4nd3r
separate explorer(s) with
find -perms -type
ifX
is used?Created by: jimis
I definitely do not want recursive comparisons, the way it is now is fine regarding recursion, I agree that the overhead would be too big otherwise.
Non-recursive test for capital X permission is what I was thinking of:
x
bit is set? Then the ACL is correct.x
mode bit is set, and thex
ACL bit is set? Then the ACL is correct.Created by: 4nd3r
I use
find
with-type
and-exec
😄jokes a side, how do you know if some perms inside deep directory needs a change? I personally don't like types which do something even when there's no need to, but that's may personal belief 👼
the thing with recursive operations is that they are hard. when i wrote
__acl
, i gave it a lot of thought. for example, getting recursively state of entire directory content and comparing that against wanted state is somewhat difficult, but doable. and when you have directory with 100k files then it doesn't scale.since I only use
__acl
to set up new directories and only care about acl of parent, i just made it this way and forgot it. now your situation gets my attention again and... maybe we still should revisit that idea. if--recursive
is set then get current state of entire directory contents and comapre it against wanted state with file type check? this way we could solve issue withX
. but i can already imagine the complexity of this kind of type...also, it's sorta admin choice - if you are going to use that type on directory with 100k files, then you maybe have very bad times...
Created by: jimis
@4nd3r I find it really useful. Otherwise how do you set recursively the ACL to "r-x" for directories but to "r--" for files?
Created by: 4nd3r
this is though one. i, myself, would never use such ambiguous feature, but I can't think of good solution for those, who would like to use it. at least we should add note about that in man.rst.
Created by: jimis
@4nd3r maybe you have an opinion on this one?