Hi, I can't install any distutils-based packages; they all keep trying to write outside of the image directory, causing sandbox to kill them. The cause is a bit of a snowball: while portage correctly passes the --root= option to the distutils-based ./setup.py, distutils ignores it. The reason for that is in the last of lines (python-2.6/distutils/util.py): if os.name == 'posix': if not os.path.isabs(pathname): return os.path.join(new_root, pathname) else: return os.path.join(new_root, pathname[1:]) It's failing, as it turns out, because $ python -c 'import sys; print sys.exec_prefix' //usr Why 'exec_prefix' has a double-slash, I haven't yet figured out, but it does. distutils *does* run exec_prefix through os.path.normpath(), but (python-2.6/posixpath.py): # POSIX allows one or two initial slashes, but treats three or more # as single slash. Meaning that the second arg to os.path.join() above begins with '/usr', which is absolute, so it discards the value of --root. In my eyes, the best fix is an upstream patch to distutils which lets it handle the particular case of paths with a double-slash in front, but since this issue might affect Gentooers before most others I wanted to post here first. For now, I fixed it by changing the offending line from utils.py to return os.path.join(new_root, pathname.lstrip('/')) HTH, Steven
Aha. $ ls -l /usr/bin/python lrwxrwxrwx 1 root root 19 2008-10-05 18:56 /usr/bin/python -> //usr/bin/python2.6 # eselect python set 1 # eselect python set 2 # ls -l /usr/bin/python lrwxrwxrwx 1 root root 18 2008-10-05 21:28 /usr/bin/python -> /usr/bin/python2.6 ...not sure why, but when the ebuild installed, it added an extra slash to the linked path. manually eselecting the old python then the new one again installed a correct link.
*** Bug 240530 has been marked as a duplicate of this bug. ***
(In reply to comment #1) > $ ls -l /usr/bin/python > lrwxrwxrwx 1 root root 19 2008-10-05 18:56 /usr/bin/python -> > //usr/bin/python2.6 > > # eselect python set 1 > # eselect python set 2 > # ls -l /usr/bin/python > lrwxrwxrwx 1 root root 18 2008-10-05 21:28 /usr/bin/python -> > /usr/bin/python2.6 > > ...not sure why, but when the ebuild installed, it added an extra slash to the > linked path. manually eselecting the old python then the new one again > installed a correct link. python.eselect contains INTERPRETER_PATH="${ROOT}/usr/bin/". ROOT is set to "/" during emerging, but is usually unset in normal shell sessions. --- python.eselect +++ python.eselect @@ -8,6 +8,7 @@ VERSION=$(svn_date_to_version "${SVN_DATE}" ) -INTERPRETER_PATH="${ROOT}/usr/bin/" -MAN_PATH="${ROOT}/usr/share/man/man1/" +[[ "${ROOT}" != */ ]] && ROOT="${ROOT}/" +INTERPRETER_PATH="${ROOT}usr/bin/" +MAN_PATH="${ROOT}usr/share/man/man1/" # find a list of python versions @@ -166,5 +167,5 @@ done - if [[ -L "${ROOT}/usr/bin/python" ]]; then + if [[ -L "${ROOT}usr/bin/python" ]]; then ${if_unset} && return fi
How about if [[ -L "${ROOT%/}/usr/bin/python" ]]; then that allows for both "" and "/".
eselect-python-20080925 fixes this issue. python-2.6-r3 depends on it. Thanks everyone :)