-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show @ if extended attributes are present #962
base: master
Are you sure you want to change the base?
show @ if extended attributes are present #962
Conversation
c1b9a0d
to
5a1bc51
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: accidentaldevelopment The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
hi @accidentaldevelopment, may I ask whether this is the macOS-only feature, not the GNU ls? if so, we should leave it macOS-only. if there will later be some linux requirements, we could put it behind a flag, and should not enable by default in linux |
Hello, @zwpaper, thanks for the reply! The answer to your question is exactly why this one could be a little ugly. Linux currently checks for specific xattrs (system.posix_acl_access, security.selinux) to determine if it should show
Related is a macOS-specific flag Does that help? It's kind of a weird divergence between the two OS families. |
hi @accidentaldevelopment, thanks for the explanation, the problem is that it will break the linux users if the so I would prefer showing @ only on macOS, so we will not break any linux use-cases. |
Maybe adding an option to control it is a better idea? |
Whoops! Sorry, @zwpaper – I missed the notification for the replies!
Makes sense. There are a few different ways I could think of to do this:
I'm open to any of the above, or other options I may have missed. Obviously I would want to do whatever is best for the codebase and experience!
I'm a little unsure what you mean here, @CarterLi. Are you suggesting it goes behind a command line flag? This would break compatibility with Or are you referring to a config file option? That could probably work quite well, and default to |
ls -l
on macOS will show an@
if the file or directory has extended attributes. This PR adds the same functionality tolsd
.macOS also includes a
-@
flag to display the extended attributes. This PR does not include that functionality. If it's something that's wanted, it should probably be done in a followup PR.Example for this repo
Concerns
This adds a new
has_xattr
field to theAccessControl
struct. That field is determined by checkingselinux_context
,smack_context
, and just listing xattrs.If my understanding and testing are correct, this should never really show up in anything other than macOS. But the code and field will be present anyway. It feels a little dirty having a field that will never really be used outside of a single platform. But the alternative is some conditional compilation, and I generally feel that should be approached with care.
Happy to discuss alternative implementations!
TODO
cargo fmt