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

Lars Gustaebel lars at gustaebel.de
Wed Aug 20 15:55:03 EDT 2003


On Wed, 20 Aug 2003 18:45:05 +0200, Lars Behrens wrote:

> 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
> :-\

The fact that it worked this time seems pure chance to me, it is likely to
fail in the future. For backup purposes you should definitely set
tar.posix=False to enable long pathnames in your tar file.
 
> 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?

tarfile.GNUTYPE_LONGNAME is a constant for internal use only. You don't
need to handle long pathnames yourself. I admit that setting an attribute
to False to turn on a feature may seem a bit cumbersome, but once you got
used to it it feels okay ;-)
tarfile creates POSIX compliant tar files by default because they are more
portable. If you just want to make backups for your personal use you don't
need to bother, so turn off the POSIX mode.

-- 
Lars Gustäbel
lars at gustaebel.de




More information about the Python-list mailing list