Skip to content
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

Add a shortcut to view permissions and extended attributes on selected object? #116

Open
ermo opened this issue Sep 8, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@ermo
Copy link

ermo commented Sep 8, 2023

Walk is great and is exactly what I've been looking for in an easy and convenient ls/cd replacement.

On systems with extended attributes, it might be super handy if walk had a way to show default (ls -l) and extended permissions (getfattr) with a shortcut for any particular highlighted file or directory?

The shortcut I would suggest is v, since that only changes the mode in vim/neovim and isn't associated with any other motion to the best of my knowledge.

Let me know what you think.

@antonmedv
Copy link
Owner

I like this idea. But we need to think it through. What gonna be displayed and how.

@antonmedv antonmedv added the enhancement New feature or request label Sep 8, 2023
@ermo
Copy link
Author

ermo commented Sep 8, 2023

I like this idea. But we need to think it through. What gonna be displayed and how.

Could start by just listing ls -l? Or even the output of stat maybe? I was thinking that it'd be listed the same way as the view file (<SPACE>) functionality, with a window opening to the right?

The other option is to reflow the terminal and list it below the selected item if the terminal is too narrow for the output...?

EDIT: You know what, by default, I would suggest listing the ls -l output in a bar at the bottom/top for the item currently selected. Then you could use the v shortcut to view the extended attributes; stat for starters in a window on the right (if there's enough space) or on the bottom (if the terminal is too narrow for the fixed with of stat).

The reason for doing it like this is that, on SELinux systems, ls -l will show a small . if there is extended SELinux labelling available, which will be shown in stat as well.

This gives you the freedom to come up with a nice way to list extended attributes below the stat output once you settle on a good viewing format?

@ermo
Copy link
Author

ermo commented Sep 8, 2023

Here's the output of the most useful permission and file info tests I could come up with:

ermo@solbox:~/test-setfacl
$ ls -l
total 0
-rw-rw-r-- 1 ermo ermo 0 Sep  8 14:56 test-no-xattr
-rw-rw-r-- 1 ermo ermo 0 Sep  8 14:56 test-with-xattr
ermo@solbox:~/test-setfacl
$ getfacl test-no-xattr
# file: test-no-xattr
# owner: ermo
# group: ermo
user::rw-
group::rw-
other::r--

ermo@solbox:~/test-setfacl
$ getfacl test-with-xattr 
# file: test-with-xattr
# owner: ermo
# group: ermo
user::rw-
group::rw-
other::r--

ermo@solbox:~/test-setfacl
$ setfacl -m "g:adm:rw--" test-with-xattr 
ermo@solbox:~/test-setfacl
$ getfacl test-with-xattr 
# file: test-with-xattr
# owner: ermo
# group: ermo
user::rw-
group::rw-
group:adm:rw-
mask::rw-
other::r--

ermo@solbox:~/test-setfacl
$ ls -l
total 0
-rw-rw-r--  1 ermo ermo 0 Sep  8 14:56 test-no-xattr
-rw-rw-r--+ 1 ermo ermo 0 Sep  8 14:56 test-with-xattr
ermo@solbox:~/test-setfacl
$ stat test-with-xattr 
  File: test-with-xattr
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 8,1     Inode: 4195303     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    ermo)   Gid: ( 1000/    ermo)
Access: 2023-09-08 14:56:31.423503726 +0200
Modify: 2023-09-08 14:56:31.423503726 +0200
Change: 2023-09-08 15:03:34.788450639 +0200
 Birth: 2023-09-08 14:56:31.423503726 +0200
ermo@solbox:~/test-setfacl
$ 

Notice how, if there are extended attributes (in this case ACL attributes) associated with a file, the ls -l output will append a +. This is entirely in line with SELinux's approach of appending a . if SELinux labels are detected.

@antonmedv
Copy link
Owner

Let’s just start with a bar at the end with permission/user/group, size (kb,MB,GB), modtime.

@ermo
Copy link
Author

ermo commented Sep 8, 2023

Good call.

Note that my rationale for suggesting the addition of an easy way to view extended attributes/ACLs for files is that, currently (to the best of my knowledge) no low-friction UX exists for doing so.

I see walk's approach as the ideal vessel for convenient terminal use of ACLs, in turn allowing the use of ACLs to become the norm, rather than the exception.

@ermo
Copy link
Author

ermo commented Sep 8, 2023

Just noting that I found POSIX Access Control Lists on Linux rather enlightening re. the mask: entries and the resulting effective permissions for a given ACL in case you care about that specific detail.

@ermo ermo changed the title Add a v shortcut to view permissions and extended attributes on selected object? Add a shortcut to view permissions and extended attributes on selected object? Sep 8, 2023
@kice
Copy link

kice commented Jan 24, 2024

I do not like the idea to "show file info" but rather "switch navigation mode".

For example, we can use a key shortcut for switch from ls to ls -l mode.

I think in ls -l mode, at least showing: size (human readable, or in bytes), permission, user/group, last modified time.

Check this out: kice@1c7829f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants