Skip to content

Feature Add support of os.chflags() on Linux platform #75494

Description

@socketpair
BPO 31313
Nosy @pitrou, @larryhastings, @socketpair
Files
  • chiflag.c
  • 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:

    assignee = None
    closed_at = None
    created_at = <Date 2017-08-31.09:55:01.045>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Feature Add support of os.chflags() on Linux platform'
    updated_at = <Date 2017-09-01.09:27:54.508>
    user = 'https://github.com/socketpair'

    bugs.python.org fields:

    activity = <Date 2017-09-01.09:27:54.508>
    actor = 'pitrou'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2017-08-31.09:55:01.045>
    creator = 'socketpair'
    dependencies = []
    files = ['47115']
    hgrepos = []
    issue_num = 31313
    keywords = []
    message_count = 5.0
    messages = ['301043', '301046', '301089', '301091', '301092']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'larry', 'neologix', 'socketpair']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31313'
    versions = ['Python 3.7']

    Activity

    1. socketpair commented on Aug 31, 2017

      socketpairmannequin
      MannequinAuthor

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

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Aug 31, 2017
    3. pitrou commented on Aug 31, 2017

      @pitrou
      Member

      Judging by the ioctl name, this is ext2/ext3/ext4 specific?

    4. socketpair commented on Sep 1, 2017

      socketpairmannequin
      MannequinAuthor

      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)

    5. pitrou commented on Sep 1, 2017

      @pitrou
      Member

      On Ubuntu 16.04 I get the following values:
      EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_GETFLAGS = 0x80086601

    6. pitrou commented on Sep 1, 2017

      @pitrou
      Member

      Uh, of course, we care about SETFLAGS here. Which gives:
      EXT2_IOC_SETFLAGS = 0x40086602, FS_IOC_SETFLAGS = 0x40086602

    7. transferred this issue fromon Apr 10, 2022
    8. encukou commented on Aug 25, 2026

      @encukou
      Member

      FS_IOC flags are different from the stat.UF_* & stat.SF_* that os.chflags operates on.
      If we add them, they should use a different function, perhaps in fcntl or around statx, or use the chattr name.

      Feature proposals should go on Discourse nowadays; ideally with a use case.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions