report: 0.15 selftest result of Slackware Linux

Alexander Belchenko bialix at ukr.net
Wed Apr 4 13:04:53 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel пишет:
> Alexander Belchenko wrote:
>> Python 2.4 @ Slackware Linux 10.2.
>>
>> Selftest running from sources. I ran selftest twice to reduce
>> spurious failings.
>> I don't know is this failed tests say something important.
>> Just FYI.
> ...
>> ^^^^[log from bzrlib.tests.test_lockdir.TestLockDir.test_lock_permission]-----
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "/tmp/bzr/bzr-0.15/bzrlib/tests/test_lockdir.py", line 614, in test_lock_permission
>>     self.assertRaises(errors.PermissionDenied, ld1.attempt_lock)
>>   File "/tmp/bzr/bzr-0.15/bzrlib/tests/__init__.py", line 814, in assertRaises
>>     raise self.failureException, "%s not raised" % excName
>> AssertionError: PermissionDenied not raised
> 
> This is little disconcerting. I'm assuming we are expecting
> "Transport.rename('dir', 'existing')" to raise PermissionDenied when the
> target exists. At least for the case when both the source and the target
> are directories containing data.
> 
> Can you try doing:
> 
> import os
> os.mkdir('a')
> open('a/file', 'wb').write('foo\n')
> os.mkdir('b')
> open('b/file2', 'wb').write('bar\n')
> 
> os.rename('b', 'a')
> 
> Here I get:
> OSError: [Errno 66] Directory not empty
> where 66 == ENOTEMPTY
> 
> It sounds like 'os.rename()' is succeeding. And I'm curious why. (Is it
> renaming b => a/b?)

Here is my result:

root at cvv:/tmp/bzr/1# python test1.py
Traceback (most recent call last):
  File "test1.py", line 7, in ?
    os.rename('b', 'a')
OSError: [Errno 39] Directory not empty

Different errno, as I can see. But the same error. And see:

root at cvv:/tmp/bzr/1# python
Python 2.4.1 (#1, Apr 10 2005, 22:30:36)
[GCC 3.3.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import errno
>>> errno.ENOTEMPTY
39

As I could see in bzrlib/transport/__init__.py in function _translate_error:

            if e.errno == errno.EACCES:
                raise errors.PermissionDenied(path, extra=e)
            if e.errno == errno.ENOTEMPTY:
                raise errors.DirectoryNotEmpty(path, extra=e)


>> ======================================================================
>> FAIL: test_readonly_file (bzrlib.tests.per_lock.test_lock.TestLock)
>>
>> vvvv[log from bzrlib.tests.per_lock.test_lock.TestLock.test_readonly_file(fcntl)]
>>
>> ^^^^[log from bzrlib.tests.per_lock.test_lock.TestLock.test_readonly_file(fcntl)]
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "/tmp/bzr/bzr-0.15/bzrlib/tests/per_lock/test_lock.py", line 67, in test_readonly_file
>>     self.assertRaises(IOError, open, 'a-file', 'rb+')
>>   File "/tmp/bzr/bzr-0.15/bzrlib/tests/__init__.py", line 814, in assertRaises
>>     raise self.failureException, "%s not raised" % excName
>> AssertionError: IOError not raised
>>
> 
> Again, something weird is happening. In the set-up for this code, I do:
> 
> import os
> f = open('file', 'wb')
> f.write('foo\n')
> f.close()
> os.chmod('file', 0444)
> 
> f2 = open('file', 'rb+')
> 
> IOError: [Errno 13] Permission denied: 'file'

No IOError.

> Now, I would expect 'rb+' (read+write, binary mode) to fail. Because we
> shouldn't be able to open a 0444 (r--r--r--) file for writing.
> Now maybe the os has opened it up for only reading, and if we tried to
> write to the file it would fail.
> 
> Can you try the above and see what happens? If the f2 = open() succeeds,
> can you try f2.read(), and f2.write() to see if that fails?

I try different variants. And get no exception.
f2.write() actually wrote to file.
I assume that something wrong with that Slackware Linux.

May be both failed tests is failed because I have broken Linux machine?

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGE5RkzYr338mxwCURAmUzAKCXb7HE460DI5rfk7nXQ9b+gOGcLgCdFC9U
yLK6JKM8Jy/r+S6zoXeqgaM=
=dvzv
-----END PGP SIGNATURE-----



More information about the bazaar mailing list