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

2016-03-28 Thread Tim Landscheidt
I posted a proof-of-concept for how to set extended attributes with
Python at http://stackoverflow.com/questions/34176464/why-os-chflags-
doesnt-work-under-linux/36274086#36274086.

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

Title:
  Python os module lacks the chflags/lchflags methods

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


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

2016-03-28 Thread Tim Landscheidt
I ran into this today and thought I'd share what I learned.

The syscall chflags does not exist in Linux, so when compiling Python it
notices this and does not provide os.chflags().

chattr(1) on the other hand uses an ioctl() of EXT2_IOC_SETFLAGS to set
the attributes (e2fsprogs-1.42.13's lib/e2p/fsetflags.c):

| fd = open (name, OPEN_FLAGS);
| if (fd == -1)
| return -1;
| f = (int) flags;
| r = ioctl (fd, EXT2_IOC_SETFLAGS, );
| if (r == -1)
| save_errno = errno;
| close (fd);

So you could (instead of executing chattr(1)) call Python's
fcntl.ioctl() to perform that action.

It would probably be very nice if Python's os.chflags() would DWIM (and
if someone brings this to Python please report here), but on the other
hand I can also understand the paradigm to keep low-level functions
"dumb", i. e. a function where the user expects that a simple syscall is
made should only do that and nothing more.

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

Title:
  Python os module lacks the chflags/lchflags methods

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


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

2012-04-05 Thread Olivier Cortès
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
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/969032

Title:
  Python os module lacks the chflags/lchflags methods

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


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

2012-04-05 Thread Matthias Klose
currently the configure check fails

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

Title:
  Python os module lacks the chflags/lchflags methods

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


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

2012-04-04 Thread Matthias Klose
this is only available on MacOS and FreeBSD. Please use chattr on Linux
instead.


** Changed in: python2.7 (Ubuntu)
   Status: New = Invalid

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

Title:
  Python os module lacks the chflags/lchflags methods

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs