Bazaar Export Command Not Handling Long Path Names
Guido Ostkamp
bazaar at ostkamp.fastmail.fm
Wed May 21 21:21:06 BST 2008
On Wed, 21 May 2008, John Arbash Meinel wrote:
> We use python's built in 'tar' library for creating the tarballs, it is
> possible it doesn't know how to handle long filenames.
Bazaar uses the 'tarfile' module in its
.../site-packages/bzrlib/export/tar_exporter.py where it executes
import tarfile
...
ball = tarfile.open(dest, 'w:' + compression)
...
for dp, ie in entries:
...
ball.addfile(item, fileobj)
ball.close()
the tarball.py resides at .../lib/python2.5/tarfile.py and includes
def tobuf(self, posix=False):
...
if posix:
...
if len(self.linkname) > LENGTH_LINK:
raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK))
if len(name) > LENGTH_NAME:
prefix = name[:LENGTH_PREFIX + 1]
while prefix and prefix[-1] != "/":
prefix = prefix[:-1]
name = name[len(prefix):]
prefix = prefix[:-1]
if not prefix or len(name) > LENGTH_NAME:
raise ValueError("name is too long")
else:
if len(self.linkname) > LENGTH_LINK:
buf += self._create_gnulong(self.linkname, GNUTYPE_LONGLINK)
if len(name) > LENGTH_NAME:
buf += self._create_gnulong(name, GNUTYPE_LONGNAME)
so it is perfectly aware of GNU long pathname support and
class TarFile(object):
...
posix = False
defines 'posix' as false, so I suppose bazaar should be able to handle
long filenames in tarballs provided you do have a Python distro like the
above (the example above is Python 2.5.1 out of the box).
Regards
Guido
More information about the bazaar
mailing list