[Bug 969032] Re: Python os module lacks the chflags/lchflags methods

Olivier Cortès olive at deep-ocean.net
Thu Apr 5 07:45:31 UTC 2012


Yes, I know `chattr` and I already use it on Linux. But referring to
http://docs.python.org/library/os.html#os.chflags the "flags" feature IS
the chattr on Linux ("Availability: Unix", not just MacOS and FreeBSD).

Reading further http://bugs.python.org/issue1490190 , the flags/chattr
seems understood as different by upstream, but it is really the same
system call. Though it has not the same name, it does the same thing
(both "flags" and "chattr" have "SF_IMMUTABLE", "SF_APPEND", and more in
common).

Doing `os.chflags()` in python on Linux should make the `chattr`
equivalent syscall on Linux, if I understand the Python documentation
correctly. Only some flags values would be different (some missing and
some more than on other OSes).

It seems to be a good candidate for an upstream bug, though. I will
investigate a little more in this direction.

** Bug watch added: Python Roundup #1490190
   http://bugs.python.org/issue1490190

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python2.7 in Ubuntu.
https://bugs.launchpad.net/bugs/969032

Title:
  Python os module lacks the chflags/lchflags methods

Status in “python2.7” package in Ubuntu:
  Invalid

Bug description:
  Reading http://docs.python.org/library/os.html#os.stat , I noticed
  that on Linux the "flags" or "chattr" features have a Python interface
  since version 2.6.

  However, on up-to-date Precise (Python 2.7.3rc2) and Oneiric (Python
  Python 2.7.2+), the following commands :

  import os
  os.chflags

  report "AttributeError" in a Python shell. Grepping in
  /usr/lib/python2.7, the only reference to "chflags" is in the
  `shutil.py` file which just checks if the python method is present or
  not.

  As the system interface is OK (I can successfully use "chattr"  and
  "lsattr" in the shell on both Ubuntu versions, and historically this
  features has been present since I started using Linux), I think the
  "flags" part of the Python distribution should be activated on Ubuntu.

  Currently I need this feature in my Python application to see if some
  files have the IMMUTABLE or APPEND flag, but generally speaking I
  can't see any good reason why this feature is not active while beeing
  part of the standard Python distribution.

  regards,

  --
  Olivier

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/969032/+subscriptions




More information about the foundations-bugs mailing list