Bazaar Export Command Not Handling Long Path Names
John Arbash Meinel
john at arbash-meinel.com
Wed May 21 21:39:48 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Guido Ostkamp wrote:
| 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
|
As near as I can tell python2.4 also supports the GNU extensions, though the
code layout seems very different.
But I do see stuff like:
if len(tarinfo.linkname) > LENGTH_LINK:
~ if self.posix:
~ raise ValueError, "linkname is too long (>%d)" \
~ % (LENGTH_LINK)
~ else:
~ self._create_gnulong(tarinfo.linkname, GNUTYPE_LONGLINK)
~ tarinfo.linkname = tarinfo.linkname[:LENGTH_LINK -1]
~ self._dbg(2, "tarfile: Created GNU tar extension LONGLINK")
On the other hand, are we allowed to have a single name longer than 100
characters, or is just that the whole *path* can be longer than 100 chars?
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkg0iJQACgkQJdeBCYSNAAPD0wCfWyHeE2/rXVYGnuZ5I8y3ijUp
9j0An03A8Z6oclicWVliMX8hYnyHCoBU
=okmD
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list