[issue6054] tarfile normalizes arcname

Lars Gustäbel <report@bugs.python.org> at psf.upfronthosting.co.za Lars Gustäbel <report@bugs.python.org> at psf.upfronthosting.co.za
Sat May 23 14:03:20 CEST 2009


Lars Gustäbel <lars at gustaebel.de> added the comment:

Apparently, the .deb file format is not explicit about that, but it
seems to be common practice to have all files prefixed with './'.

normpath is used all over tarfile, crucial are the occurrences in
TarFile.add() and TarInfo.get_info(). As you're using a unix-like system
the easiest workaround is to replace the module level tarfile.normpath
function with a no-op.

The original assumption for using normpath on all pathnames was to keep
the names in an archive clean and in their canonical form. Most
occurrences of normpath date back to the 2003 original version (cp.
r30613) and have never been touched.

But, I found nothing in POSIX about normalizing pathnames. GNU tar and
star both strip different leading path components like "./" and "../"
from pathnames, but they both don't remove "./" components from inside a
pathname, for example. This means that the usage of normpath seems more
or less unnecessary in tarfile.

I will create a patch that addresses these issues.

Thanks for your report.

----------
versions: +Python 2.7, Python 3.1 -Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6054>
_______________________________________


More information about the Python-bugs-list mailing list