This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()
Type: Stage:
Components: Library (Lib) Versions: Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, corona10, eryksun, socketpair
Priority: normal Keywords:

Created on 2021-01-16 14:25 by socketpair, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg385141 - (view) Author: Марк Коренберг (socketpair) * Date: 2021-01-16 14:25

Seems the ioctl is only way to implement chattr(). I propose to add all these flags to os.chflags() and to gain its support in Linux.
msg385995 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-01-30 20:50
bpo-39533 is a related issue that seeks to support the Linux statx() system call. A statx record includes an stx_attributes field, which supports the following file attributes that can be set with chattr:

    [a]ppend    : STATX_ATTR_APPEND
    [c]ompressed: STATX_ATTR_COMPRESSED
    no [d]ump   : STATX_ATTR_NODUMP
    [i]mmutable : STATX_ATTR_IMMUTABLE
    da[x]       : STATX_ATTR_DAX (5.8)

and the following read-only file attributes that can be listed with lsattr:

    [E]ncrypted : STATX_ATTR_ENCRYPTED
    [V]erity    : STATX_ATTR_VERITY (5.5)
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87105
2021-01-30 20:50:43eryksunsetnosy: + eryksun
messages: + msg385995
2021-01-30 15:26:24corona10setnosy: + corona10
2021-01-18 07:56:53vstinnersetnosy: + christian.heimes
2021-01-16 14:25:34socketpaircreate