This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mgorny
Recipients eric.araujo, mgorny, tarek
Date 2013-06-13.05:18:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371100735.33.0.721782392161.issue18201@psf.upfronthosting.co.za>
In-reply-to
Content
We're doing heavy wrapping of Python scripts on Gentoo in order to efficiently support having multiple versions of Python installed. For that reason, every Python script installed using the package manager is renamed, and a symlink to a common wrapper binary is installed in its place.

For example, setuptools install looks like:

  /usr/bin/easy_install -> python-exec
  /usr/bin/easy_install-python2.7
  /usr/bin/easy_install-python3.2

Using the wrappers like this allow us to actively support user preference of Python version and map it to supported ones. Symlinking a common binary makes this more maintainable since there's just one place where wrapper needs to be updated.

However, it seems that setup.py is failing hard in replacing symlinks. Whenever user upgrades any installed package, either externally or due to some tool like easy_install or pip, the relevant setup.py writes into /usr/bin/easy_install rather than properly replacing it with a new file.

The effect, as you may imagine, is the wrapper being replaced with a random Python script and system-wide breakage.

The proper thing to do would be to write into temporary file in the destination directory, then use os.rename() to atomically replace the destination with the temporary file.

Since distutils is no longer maintained, I would be equally happy with simply os.remove() before writing the scripts. The problem may affect distutils2 as well.
History
Date User Action Args
2013-06-13 05:18:55mgornysetrecipients: + mgorny, tarek, eric.araujo
2013-06-13 05:18:55mgornysetmessageid: <1371100735.33.0.721782392161.issue18201@psf.upfronthosting.co.za>
2013-06-13 05:18:55mgornylinkissue18201 messages
2013-06-13 05:18:54mgornycreate