selftest broken under Python 2.5 because of tarfile API
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
Ian Clatworthy |
Bug Description
selftest reports 15 errors and 1 failure and all of the problems are much the same. Here's a sample:
ERROR: test_repository
vvvv[log from bzrlib.
created control directory in file://
creating repository in file://
created control directory in file://
creating repository in file://
Using fetch logic to copy between KnitRepository(
fetch up to rev {None}
^^^^[log from bzrlib.
-------
Traceback (most recent call last):
File "/home/
response = request.
File "/home/
return self.do(*args)
File "/home/
return self.do_
File "/home/
return self._tarfile_
File "/home/
self.
File "/home/
tarball = tarfile.
File "tarfile.py", line 1168, in open
_Stream(name, filemode, comptype, fileobj, bufsize))
File "tarfile.py", line 1047, in __init__
self.name = os.path.
File "posixpath.py", line 402, in abspath
if not isabs(path):
File "posixpath.py", line 49, in isabs
return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'
spiv did a quick investigation and confirmed that the problem is related to library API changes from Python 2.4 and Python 2.5.
Changed in bzr: | |
assignee: | nobody → ian-clatworthy |
importance: | Undecided → High |
status: | New → Fix Committed |
Specifically, it's a bug in Python 2.5.1. It works with 2.5.0, 2.4.x, and should work with 2.5.2 and 2.6 when they are released.
Martin suggests that passing the name we used to pass, in addition to fileobj, to the TarFile constructor will avoid the bug, and still give the behaviour we want (i.e. allow this to work on Windows). Looking at the various versions of tarfile.py, this does look like it will do what we want.
So:
tarball = tarfile. open(fileobj= ofile, name=ofile.name, mode='w|' + compression)