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.

Author ngie
Recipients Douglas.Leeder, Nick.Dowell, alexandre.vassalotti, doko, gregory.p.smith, ned.deily, ngie
Date 2010-09-11.05:16:46
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1284182209.83.0.0352830236965.issue8746@psf.upfronthosting.co.za>
In-reply-to
Content
That definitely fixes detection for FreeBSD CURRENT with 2.7 and py3k for me.

I'm looking into providing some unit-tests, but the problem is that whether or not chflags functions on the underlying filesystem is problematic. For instance, it won't function on msdosfs (Linux calls it vfat), it won't function on ext[23] (AFAIK), and it didn't function on ZFS (until recently? I'm not sure whether or not the latest patches for ZFS enhance the filesystem to support this functionality). So unfortunately adding tests for this feature (while nice) would potentially be error prone.

Something I tried was:

>>> UF_IMMUTABLE = 2
>>> import tempfile
>>> f = tempfile.mkstemp()[1]
>>> os.getuid()
1000
>>> os.chflags('/tmp', UF_IMMUTABLE)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 1] Operation not permitted: '/tmp'
>>> os.chflags(f, UF_IMMUTABLE)
>>> fd = open(f, 'w')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 1] Operation not permitted: '/tmp/tmpi_hwY7'
>>> fd = open(f, 'r')
>>> fd = open(f, 'r')
>>> fd.read()
''
>>> os.chflags(f, 0)
>>> fd = open(f, 'w')
>>> fd.write('foo')
>>> fd.close()
>>> fd = open(f, 'r')
>>> fd.read()
'foo'
>>> fd.close()

Also, the flags are missing that are described in the manpage. I'll provide a patch for those.

Otherwise, it looks like everything's functioning as expected for basic end-to-end tests with chflags(2).

Thanks!
History
Date User Action Args
2010-09-11 05:16:50ngiesetrecipients: + ngie, doko, gregory.p.smith, alexandre.vassalotti, ned.deily, Nick.Dowell, Douglas.Leeder
2010-09-11 05:16:49ngiesetmessageid: <1284182209.83.0.0352830236965.issue8746@psf.upfronthosting.co.za>
2010-09-11 05:16:48ngielinkissue8746 messages
2010-09-11 05:16:46ngiecreate