Issue #183 resolved

extracting of symlinks loses original

Anonymous created an issue

(this is a copy of http://bugs.python.org/setuptools/issue118 . I'm filing it here as well in the hope that a fix in setuptools gets merged in distribute as well).

I ran into something odd related to handling of symlinks today. I have a source which contains a symlink. The relevant directory looks like this:

{{{ drwxr-xr-x 5 wichert staff 170 Oct 1 10:55 ./ drwxr-xr-x 40 wichert staff 1360 Oct 1 10:55 ../ lrwxr-xr-x 1 wichert staff 20 Oct 1 10:55 editor_plugin.js -> editor_plugin_src.js -rw-r--r-- 1 wichert staff 1159 Oct 1 10:55 editor_plugin_src.js }}}

when I create an sdist both the original file and the symlink are included in the .tar.gz. When I install the distribution using the sdist as uploaded on pypi the same directory in the generated egg looks like this:

{{{ drwxr-xr-x 3 wichert staff 102 Sep 30 14:50 ./ drwxr-xr-x 39 wichert staff 1326 Sep 30 14:50 ../ -rw-r--r-- 1 wichert staff 1159 Sep 30 14:50 editor_plugin.js }}}

the symlink has been replaced with a copy, but the original went missing. Unfortunately both filenames are used, so the result is a broken package.

The relevant package is NuPlone 1.0b2 (http://pypi.python.org/packages/source/N/NuPlone/NuPlone-1.0b2.tar.gz), and the directory is plonetheme/nuplone/z3cform/tiny_mce/plugins/linefield .

Comments (6)

  1. Anonymous

    PJE fixed this in the setuptools tree. Snapshot 0.6c12dev-r85190 has a fix for this problem.

  2. Toshio Kuratomi

    That fix was broken but pje just committed a new fix. Looking into whether a straight backport of that is best or if it's better to do something that doesn't use tarfile private functions.

  3. Toshio Kuratomi

    Here's a patch to the code to fix this. This isn't a straight port of pje's changes to distribute. I looked at his code and he's using tarfile internals in order to do this work. That seems fragile to me (as both this bug and http://bugs.python.org/setuptools/issue16 show).

    Successfully tested with NuPlone and logilab-common.

    What do you think, tarek? Should we go this route or stick closer to what pje produced?

  4. Log in to comment