'name is too long' (tarfile, python 2.2, Debian Woody)

Lars Behrens Spam.Buster at web.de
Wed Aug 20 12:45:05 EDT 2003


Helmut Jarausch wrote:
> The standard tar format allows only names (i.e. complete path) of 100
> characters. So in your '/home/lars' are names (fully expanded) which are
> longer.
> Please have a look at the documentation of tarfile, there is an option
> to store extended path names. Most other tar programs (like gnu-tar)
> support these, as well.

Thanks!

I found this in the tarfile doc:

-- snip --
posix=True
If True, create a POSIX 1003.1-1990 compliant archive. GNU extensions 
are not used, because they are not part of the POSIX standard. This 
limits the length of filenames to at most 256 and linknames to 100 
characters. A ValueError is raised, if a pathname exceeds this limit. If 
False, create a GNU tar compatible archive. It will not be POSIX 
compliant, but can store pathnames of unlimited length.
-- snap --

So, I put this in my script:

  tar.posix=True

before

  tar.add('bla')

This seems to work. But honestly, I don't quite understand
what I did :-\

I also found out, that I can call tarfile.GNUTYPE_LONGNAME but what can 
I do with it or how do I use it?

Any hints for me?
TIA
Lars








More information about the Python-list mailing list