Repository navigation
Feature Add support of os.chflags() on Linux platform #75494
Description
Activity
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>)
- added3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
on Aug 31, 2017 Judging by the ioctl name, this is ext2/ext3/ext4 specific?
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_GETFLAGShttp://man7.org/tlpi/code/online/book/files/chiflag.c.html (also attached)
On Ubuntu 16.04 I get the following values:
EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_GETFLAGS = 0x80086601Uh, of course, we care about SETFLAGS here. Which gives:
EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_SETFLAGS = 0x40086602FS_IOCflags are different from thestat.UF_*&stat.SF_*thatos.chflagsoperates on.
If we add them, they should use a different function, perhaps infcntlor aroundstatx, or use thechattrname.Feature proposals should go on Discourse nowadays; ideally with a use case.
- marked Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags() #87105 as a duplicate of this issue
on Aug 25, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: