Bazaar Export Command Not Handling Long Path Names
Talbert, Phil W
phil.w.talbert at lmco.com
Wed May 21 21:56:38 BST 2008
We are seeing differing results Python 2.4 running on Linux does not
seem to have the 100 character limit and Python 2.5 does. So yes I agree
Bazaar should work out of the box with long path names but there is a
problem somewhere and it is not consistent. I also noted that the
Tarfile.py code for 2.4 and 2.5 is much different. It does however look
like both have posix set to False so this just deepens the mystery as to
why some platforms are having trouble with some versions. We want to use
the 2.5.1 version of Python.
Thank You,
Phil Talbert
Lockheed Martin Aeronautics Company
phil.w.talbert at lmco.com
(817) 763-2873
-----Original Message-----
From: John Arbash Meinel [mailto:john at arbash-meinel.com]
Sent: Wednesday, May 21, 2008 3:40 PM
To: Guido Ostkamp
Cc: Talbert, Phil W; bazaar at lists.canonical.com
Subject: Re: Bazaar Export Command Not Handling Long Path Names
-----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