First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 240149
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Python Gentoo Team <python@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Steven Robertson <nihilismwow@gmail.com>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 240149 depends on: Show dependency tree
Bug 240149 blocks: 230205
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-10-05 21:05 0000
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

------- Comment #1 From Steven Robertson 2008-10-05 21:31:03 0000 -------
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.

------- Comment #2 From candrews@integralblue.com 2008-10-08 21:17:30 0000 -------
*** Bug 240530 has been marked as a duplicate of this bug. ***

------- Comment #3 From Arfrever Frehtes Taifersar Arahesis 2008-10-14 11:38:00 0000 -------
(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

------- Comment #4 From Elias Pipping 2008-10-20 06:54:06 0000 -------
How about

  if [[ -L "${ROOT%/}/usr/bin/python" ]]; then

that allows for both "" and "/".

------- Comment #5 From Ali Polatel (RETIRED) 2008-10-25 15:08:39 0000 -------
eselect-python-20080925 fixes this issue.
python-2.6-r3 depends on it.
Thanks everyone :)

First Last Prev Next    No search results available      Search page      Enter new bug