far2l icon indicating copy to clipboard operation
far2l copied to clipboard

Linux files attributes in Ctrl-A and Files highlighting

Open akruphi opened this issue 1 year ago • 4 comments

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


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.

akruphi avatar Sep 19 '23 19:09 akruphi

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...

elfmz avatar Sep 19 '23 19:09 elfmz

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.

akruphi avatar Sep 19 '23 20:09 akruphi

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

toyan avatar Sep 19 '23 20:09 toyan

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

  1. Я помню про rwx и даже s и t (S и T) буквы в стандартных атрибутах, а вот про буквы в lsattr - нет - иcходя из картинки https://github.com/elfmz/far2l/issues/1843#issue-1903608108 - наверное дополнительное окно нужно открывающиеся по кнопке (которая для некоторых ФС неактивна) + хелп - 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" - но не копирует их

VPROFi avatar Sep 21 '23 10:09 VPROFi