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

Linux files attributes in Ctrl-A and Files highlighting #1843

Open
akruphi opened this issue Sep 19, 2023 · 5 comments
Open

Linux files attributes in Ctrl-A and Files highlighting #1843

akruphi opened this issue Sep 19, 2023 · 5 comments

Comments

@akruphi
Copy link
Contributor

akruphi commented Sep 19, 2023

Now Ctrl-A can works with extended attributes Immutable and Append, but these attributes can not be operate in Files highlighting 😿


Also Linux has other extended attributes (see https://en.wikipedia.org/wiki/Chattr or man chattr). It would be useful show all these attributes in Ctrl-A as disabled checkboxs (now only for quick information without possibility for its changing in far2l).

May be use new design of Ctrl-A dialog with:

──────────────────────────────────────────────────────────────
 [ ] SUID          [ ] SGID               [ ] Sticky
 User's access     Group's access         Other's access
 [x] Read          [x] Read               [x] Read
 [x] Write         [ ] Write              [ ] Write
 [x] Execute       [x] Execute            [x] Execute
──────────────────────────────────────────────────────────────
 [ ] i  [ ] a  [ ] A  [ ] c  [ ] C  [ ] d  [ ] D
 [ ] e  [ ] E  [ ] F  [ ] I  [ ] j  [ ] m  [ ] N
 [ ] P  [ ] s  [ ] S  [ ] t  [ ] T  [ ] u  [ ] x  [ ] V

where in last group compact information about all extended attributes according with attribute character from man chattr and attribute from A to V disabled to change in the first implementation

After all attributes will be recognize in far2l will be good to add possibility to operate with each in Files highlighting.

@elfmz
Copy link
Owner

elfmz commented Sep 19, 2023

Formally chattr is not really extended attributes, its 'usual' attributes, extended are those operated by fgetxattr/fsetxattr/flistxattr They're used to map SELinux policies, for instance.
Problem that readdir/stat don't return nor chattr nor that ...xattr, meaning at least extra syscall for each file, that will reduce directory update. Unless doing it smartly and dont ask for attributes if there're no highlighting rules depending on them.
On the other side, is it really demanded? Nobody from real users asked for that yet. Its not very good to add features just because its possible...

@akruphi
Copy link
Contributor Author

akruphi commented Sep 19, 2023

Some of chattr attributes like c=compressed or C=no copy-on-write or u=undeletable or X, Z = experimental compression interesting and by Ctrl+A may be useful to show it together with Immutable and Append.

For me Files highlighting for these attributes is not such important, but draft idea about balance for speed and possibility: make extra syscall only if Files highlighting have item depended on such attributes.

@toyan
Copy link

toyan commented Sep 19, 2023

As real user, I personally interested in "compressed" and "copy-on-write" attributes, which are very useful for fine tuning underlying BTRFS filesystem.

@akruphi akruphi changed the title Linux files extended attributes in Ctrl-A and Files highlighting Linux files attributes in Ctrl-A and Files highlighting Sep 20, 2023
@VPROFi
Copy link

VPROFi commented Sep 21, 2023

В целом по атрибутам lsattr - я столкнулся с ними в коммерческом софте (безопасники их иногда юзают для записи в журнале при доступе к чувствительным данным) - rsync не восстанавливал их с бэкапа если файл удален был - потому появилась заметка https://t.me/far2l_ru/11749
В сухом остатке:

  1. Я помню про rwx и даже s и t (S и T) буквы в стандартных атрибутах, а вот про буквы в lsattr - нет - иcходя из картинки Linux files attributes in Ctrl-A and Files highlighting #1843 (comment) - наверное дополнительное окно нужно открывающиеся по кнопке (которая для некоторых ФС неактивна) + хелп - PS: я даю согласие на использование материала из https://t.me/far2l_ru/11749, только будет неприятно если он где-нить вне far2l появится. Если можно доработайте окошко - реально поможет быстрее внедрить.

  2. Гораздо более важная вещь для меня - копирование (fsetxattr которая юзается при установки Copy ext. attr. никакого отношения к chattr и lsattr - контекст поиска для программиста:
    int fgetflags (const char * name, unsigned long * flags);
    int fsetflags (const char * name, unsigned long flags); -> ioctl(fd, EXT2_IOC_SETFLAGS, &f)
    ((e2fsprogs пакет) там fget(set)flags функция) не имеет) - иными словами - это очень специфичные для ФС атрибуты не копируются far2l. И таки да - эта фитча может быть уникальной для far2l

Только 1 вопрос открытый - скольким людям это нужно? "Из атрибутов сейчас far2l понимает только Append и Immutable" - но не копирует их

@akruphi
Copy link
Contributor Author

akruphi commented Jan 6, 2025

Сделал отдельный диалог для кучи известных мне атрибутов / флагов пока работающий только с отдельным файлом: #2614

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

No branches or pull requests

4 participants