Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 468378 - dev-python/setuptools writes to symlink targets when installing scripts (python-exec)
Summary: dev-python/setuptools writes to symlink targets when installing scripts (pyth...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL: https://bitbucket.org/pypa/setuptools...
Whiteboard:
Keywords:
: 475254 (view as bug list)
Depends on: 479980
Blocks:
  Show dependency tree
 
Reported: 2013-05-03 09:26 UTC by David Xie
Modified: 2014-03-13 13:50 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Xie 2013-05-03 09:26:40 UTC
No matter which python command I run, it gives me same output:
davidx@OpenStackDev ~/Projects/GevStack $ gnome-tweak-tool
error: No urls, filenames, or requirements specified (see --help)
davidx@OpenStackDev ~/Projects/GevStack $ gnome-tweak-tool
error: No urls, filenames, or requirements specified (see --help)
davidx@OpenStackDev ~/Projects/GevStack $ pip
error: No urls, filenames, or requirements specified (see --help)


Reproducible: Always

Steps to Reproduce:
1. run comomand [gnome-tweak-tool|pip|virtualenv|*]

Actual Results:  
davidx@OpenStackDev ~/Projects/GevStack $ gnome-tweak-tool
error: No urls, filenames, or requirements specified (see --help)
davidx@OpenStackDev ~/Projects/GevStack $ gnome-tweak-tool
error: No urls, filenames, or requirements specified (see --help)
davidx@OpenStackDev ~/Projects/GevStack $ pip
error: No urls, filenames, or requirements specified (see --help)

Expected Results:  
commond runs correctly

Portage 2.1.11.55 (default/linux/amd64/13.0, gcc-4.6.3, glibc-2.15-r3, 3.8.10-gentoo x86_64)
=================================================================
System uname: Linux-3.8.10-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-2.2
KiB Mem:     8108156 total,   4087712 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of tree: Mon, 29 Apr 2013 03:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.4
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo"
LANG="en_HK.utf8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://mirrors.163.com/gentoo-portage"
USE="X acl amd64 berkdb bindist bzip2 cli cracklib crypt cxx dbus dri gdbm gpm gtk iconv mmx modules mudflap multilib ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd unicode zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-04 13:33:32 UTC
Rebuild python-exec. You should know already you aren't supposed to let poor tools like 'pip' install stuff into /usr or it can do horribly things like replacing half of your system with junk.
Comment 2 David Xie 2013-05-04 13:36:50 UTC
(In reply to comment #1)
> Rebuild python-exec. You should know already you aren't supposed to let poor
> tools like 'pip' install stuff into /usr or it can do horribly things like
> replacing half of your system with junk.

Doesn't pip/easy_install always install libs into /usr/lib/pythonX.Y/site-packages?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-04 13:46:13 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Rebuild python-exec. You should know already you aren't supposed to let poor
> > tools like 'pip' install stuff into /usr or it can do horribly things like
> > replacing half of your system with junk.
> 
> Doesn't pip/easy_install always install libs into
> /usr/lib/pythonX.Y/site-packages?

and scripts into /usr/bin. Yet for some reason, it fails to replace symlinks properly and instead rewrites symlink target.. at least that's what I guess since I haven't tested it myself.

Also, anything in /usr and not in /usr/local must not be ever touched by anything but portage. Otherwise, your system becomes inconsistent and something will start failing at some point.
Comment 4 David Xie 2013-05-04 15:16:12 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Rebuild python-exec. You should know already you aren't supposed to let poor
> > > tools like 'pip' install stuff into /usr or it can do horribly things like
> > > replacing half of your system with junk.
> > 
> > Doesn't pip/easy_install always install libs into
> > /usr/lib/pythonX.Y/site-packages?
> 
> and scripts into /usr/bin. Yet for some reason, it fails to replace symlinks
> properly and instead rewrites symlink target.. at least that's what I guess
> since I haven't tested it myself.
> 
> Also, anything in /usr and not in /usr/local must not be ever touched by
> anything but portage. Otherwise, your system becomes inconsistent and
> something will start failing at some point.

Does it mean I have to install packages by using emerge not pip/easy_install?
But what if I want to install some packages that not in portage? Install them to /usr/local/lib/python2.7/site-packages?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-04 15:32:57 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Also, anything in /usr and not in /usr/local must not be ever touched by
> > anything but portage. Otherwise, your system becomes inconsistent and
> > something will start failing at some point.
> 
> Does it mean I have to install packages by using emerge not pip/easy_install?

Yes.

> But what if I want to install some packages that not in portage? Install
> them to /usr/local/lib/python2.7/site-packages?

Preferably, write an ebuild for it :). There is a dev-python/g-pypi which could help but I don't know if it still works. There's also a GSoC project this year which could improve automated ebuild generators.

Alternatively, install to any local location. Either /usr/local or your homedir.
Comment 6 David Xie 2013-05-04 15:50:52 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Also, anything in /usr and not in /usr/local must not be ever touched by
> > > anything but portage. Otherwise, your system becomes inconsistent and
> > > something will start failing at some point.
> > 
> > Does it mean I have to install packages by using emerge not pip/easy_install?
> 
> Yes.
> 
> > But what if I want to install some packages that not in portage? Install
> > them to /usr/local/lib/python2.7/site-packages?
> 
> Preferably, write an ebuild for it :). There is a dev-python/g-pypi which
> could help but I don't know if it still works. There's also a GSoC project
> this year which could improve automated ebuild generators.
> 
> Alternatively, install to any local location. Either /usr/local or your
> homedir.
If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds for them. That's really a large number packages to maintain and a little duplicate work for pypi.
So I think maybe we should set some default environment varialbes to make pip/easy_install install packages to /usr/local instead of /usr. What do you think?

One more thing, can I become a packager of portage?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-04 16:47:07 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Preferably, write an ebuild for it :). There is a dev-python/g-pypi which
> > could help but I don't know if it still works. There's also a GSoC project
> > this year which could improve automated ebuild generators.
> > 
> > Alternatively, install to any local location. Either /usr/local or your
> > homedir.
> If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds
> for them. That's really a large number packages to maintain and a little
> duplicate work for pypi.

I doubt there will be so many, but yes -- that is the plan.

> So I think maybe we should set some default environment varialbes to make
> pip/easy_install install packages to /usr/local instead of /usr. What do you
> think?

@python, what do you think?

Anyway, I think the best thing you could do with custom packages is to use virtualenv. I think that's least likely to cause problems such as different versions of same package being installed via portage and externally.

> One more thing, can I become a packager of portage?

Do you mean an ebuild maintainer? Yes, there are a few ways of doing that.

You can take a look at the Sunrise overlay [1] which -- though an overlay -- is a pretty official collection of community maintained packages. The goal is to help people polish and publish their ebuilds, and sometimes packages are collected by devs and moved to main repo.

You can also become a proxy-maintainer [2]. In that case, your packages go straight to main repo but they go through a developer which commits them for you.

And finally, you can become a developer :).

[1]:http://www.gentoo.org/proj/en/sunrise/
[2]:http://www.gentoo.org/proj/en/qa/proxy-maintainers/
Comment 8 David Xie 2013-05-04 16:57:28 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > Preferably, write an ebuild for it :). There is a dev-python/g-pypi which
> > > could help but I don't know if it still works. There's also a GSoC project
> > > this year which could improve automated ebuild generators.
> > > 
> > > Alternatively, install to any local location. Either /usr/local or your
> > > homedir.
> > If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds
> > for them. That's really a large number packages to maintain and a little
> > duplicate work for pypi.
> 
> I doubt there will be so many, but yes -- that is the plan.
> 
> > So I think maybe we should set some default environment varialbes to make
> > pip/easy_install install packages to /usr/local instead of /usr. What do you
> > think?
> 
> @python, what do you think?
> 
> Anyway, I think the best thing you could do with custom packages is to use
> virtualenv. I think that's least likely to cause problems such as different
> versions of same package being installed via portage and externally.

Maybe this is not the best way either. There's always a situation like this: I need a library A, but it's not in portage. Also I need it in many projects, so using virtualenv is not situable. What should I do then?
Normally, I will use pip/easy_install to install it for all my projects, but we have python-exec, so I can't do that. At this time, installing it to /usr/local is helpful now. Am I right on this?

Also, for pip, I checked this doc: http://www.pip-installer.org/en/latest/cookbook.html#user-installs
So I guess, can we set an ENV variable in python-exec ebuild? So that anyone who install this package, all other packages installed by pip wil directly go to /usr/local. Does it make sense?

> 
> > One more thing, can I become a packager of portage?
> 
> Do you mean an ebuild maintainer? Yes, there are a few ways of doing that.
> 
> You can take a look at the Sunrise overlay [1] which -- though an overlay --
> is a pretty official collection of community maintained packages. The goal
> is to help people polish and publish their ebuilds, and sometimes packages
> are collected by devs and moved to main repo.
> 
> You can also become a proxy-maintainer [2]. In that case, your packages go
> straight to main repo but they go through a developer which commits them for
> you.
> 
> And finally, you can become a developer :).
> 

Thank you for your advice! I will try to look at sunrise first!

> [1]:http://www.gentoo.org/proj/en/sunrise/
> [2]:http://www.gentoo.org/proj/en/qa/proxy-maintainers/
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-05-04 17:05:04 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > @python, what do you think?
> > 
> > Anyway, I think the best thing you could do with custom packages is to use
> > virtualenv. I think that's least likely to cause problems such as different
> > versions of same package being installed via portage and externally.
> 
> Maybe this is not the best way either. There's always a situation like this:
> I need a library A, but it's not in portage. Also I need it in many
> projects, so using virtualenv is not situable. What should I do then?
> Normally, I will use pip/easy_install to install it for all my projects, but
> we have python-exec, so I can't do that. At this time, installing it to
> /usr/local is helpful now. Am I right on this?

I'm not sure but I think the default PYTHONPATH does not list /usr/local (which means you'd have to add it).

> Also, for pip, I checked this doc:
> http://www.pip-installer.org/en/latest/cookbook.html#user-installs
> So I guess, can we set an ENV variable in python-exec ebuild? So that anyone
> who install this package, all other packages installed by pip wil directly
> go to /usr/local. Does it make sense?

I'd rather not use environment variables here. We need to be, er, cautious here. We want to change the default but not enforce something over what the user wants (and set up already).

In any case, I'll take a look at it soon. I just need to convert my system to btrfs, so I could snapshot it before attempting to break it :).
Comment 10 David Xie 2013-05-04 17:15:57 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > @python, what do you think?
> > > 
> > > Anyway, I think the best thing you could do with custom packages is to use
> > > virtualenv. I think that's least likely to cause problems such as different
> > > versions of same package being installed via portage and externally.
> > 
> > Maybe this is not the best way either. There's always a situation like this:
> > I need a library A, but it's not in portage. Also I need it in many
> > projects, so using virtualenv is not situable. What should I do then?
> > Normally, I will use pip/easy_install to install it for all my projects, but
> > we have python-exec, so I can't do that. At this time, installing it to
> > /usr/local is helpful now. Am I right on this?
> 
> I'm not sure but I think the default PYTHONPATH does not list /usr/local
> (which means you'd have to add it).
> 
> > Also, for pip, I checked this doc:
> > http://www.pip-installer.org/en/latest/cookbook.html#user-installs
> > So I guess, can we set an ENV variable in python-exec ebuild? So that anyone
> > who install this package, all other packages installed by pip wil directly
> > go to /usr/local. Does it make sense?
> 
> I'd rather not use environment variables here. We need to be, er, cautious
> here. We want to change the default but not enforce something over what the
> user wants (and set up already).
> 
> In any case, I'll take a look at it soon. I just need to convert my system
> to btrfs, so I could snapshot it before attempting to break it :).
You are right. We should be more cautious here. But my point is, no matter which methond we choose, we have to let user can run pip/easy_install directly to install 3rd-party libraries. I think it make sense.
Comment 11 Mike Gilbert gentoo-dev 2013-07-08 18:45:08 UTC
*** Bug 475254 has been marked as a duplicate of this bug. ***
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-04 11:15:39 UTC
Ai, I was wrong. distutils is fine, it's just setuptools screwed up. I've sent bug report to their mailing list, I'll add it here as soon as it shows up in archive.
Comment 13 Mike Summers 2013-08-04 13:38:14 UTC
I'm a bit late to this party, however in retrospect something like virtualenv (http://guide.python-distribute.org/pip.html) would have been the right thing for me to do.

For Python noobs like myself it would save a lot of trouble (and Bugzilla time) if someplace in the Gentoo Python docs there was a recommendation to setup a user local Pip repository. Gentoo depends heavily on Python and for the inexperienced it's easy to mess it up.
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-05 08:19:40 UTC
I've just committed -0.9.8-r1 with a patch that supposedly fixes that. Could any of you, brave gentlemen, test it?
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-03-12 21:47:17 UTC
Reporter timeout, assuming fixed :P.
Comment 16 Marcin Szamotulski 2014-03-13 13:50:36 UTC
Yes, indeed. Thanks!