[issue12585] distutils dereferences symlinks for zip but not for bztar/gztar target

Florian Berger report at bugs.python.org
Tue Jul 19 16:13:57 CEST 2011


New submission from Florian Berger <fberger at florian-berger.de>:

When creating a source distribution, formats=zip will dereference symbolic links while formats=bztar,gztar will not.

Example:

$ ls -l
drwxr-xr-x 3 4096 19. Jul 15:44 dist
-rw-r--r-- 1   53 19. Jul 15:15 foo.py
-rw-r--r-- 1   42 19. Jul 15:39 MANIFEST
-rw-r--r-- 1   42 19. Jul 15:39 MANIFEST.in
-rw-r--r-- 1  167 19. Jul 15:29 setup.py
-rw-r--r-- 1    5 19. Jul 15:16 test.dat
lrwxrwxrwx 1    8 19. Jul 15:16 test.symlink.dat -> test.dat

$ cat setup.py 
from distutils.core import setup
setup(name = 'foo',
      version = '0.1.0',
      py_modules = ['foo'],
      data_files = [("", ["test.dat", "test.symlink.dat"])])

$ python setup.py sdist --formats=gztar,zip

dist/foo-0.1.0.tar.gz does preserve the symbolic link test.symlink.dat -> test.dat, while dist/foo-0.1.0.zip does not.

This can lead to unexpected behaviour when a symlink points to a file outside the source tree. In the .zip file everything will be fine, while the .tar.* file will contain a broken link.

Actual behaviour: storing of symbolic links depends on the target format.

Expected behaviour: storing of symbolic links should not depend on the target format, i.e. format switches should be transparent. Since the zipfile module apparently does not support symbolic links, symlinks should be dereferenced for formats=gztar,bztar using the dereference=True parameter of tarfile.TarFile() in archive_util.py.

----------
assignee: tarek
components: Distutils
messages: 140669
nosy: eric.araujo, fberger, tarek
priority: normal
severity: normal
status: open
title: distutils dereferences symlinks for zip but not for bztar/gztar target
type: behavior
versions: Python 2.6, Python 3.2

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


More information about the Python-bugs-list mailing list