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.

classification
Title: Feature Add support of os.chflags() on Linux platform
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: larry, neologix, pitrou, socketpair
Priority: normal Keywords:

Created on 2017-08-31 09:55 by socketpair, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
chiflag.c socketpair, 2017-09-01 09:09
Messages (5)
msg301043 - (view) Author: Марк Коренберг (socketpair) * Date: 2017-08-31 09:55
Yes, chflags() is not supported by linux directly. But actually, Linux supports chflags functionality:

https://stackoverflow.com/questions/34176464/why-os-chflags-doesnt-work-under-linux

through

ioctl (fd, EXT2_IOC_SETFLAGS, <BITMASK_OF_FLAGS>)
msg301046 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-08-31 11:00
Judging by the ioctl name, this is ext2/ext3/ext4 specific?
msg301089 - (view) Author: Марк Коренберг (socketpair) * Date: 2017-09-01 09:09
Well, it seems, you are right.

But there are another ioctls (maybe they are the same, I haven't checked):

FS_IOC_SETFLAGS
FS_IOC_GETFLAGS

http://man7.org/tlpi/code/online/book/files/chiflag.c.html  (also attached)
msg301091 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-01 09:26
On Ubuntu 16.04 I get the following values:
EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_GETFLAGS = 0x80086601
msg301092 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-01 09:27
Uh, of course, we care about SETFLAGS here.  Which gives:
EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_SETFLAGS = 0x40086602
History
Date User Action Args
2022-04-11 14:58:51adminsetgithub: 75494
2017-09-01 09:27:54pitrousetmessages: + msg301092
2017-09-01 09:26:35pitrousetmessages: + msg301091
2017-09-01 09:09:25socketpairsetfiles: + chiflag.c

messages: + msg301089
2017-08-31 11:00:11pitrousetnosy: + pitrou, larry, neologix

messages: + msg301046
versions: - Python 3.6
2017-08-31 09:55:01socketpaircreate