[Bugs] #2199 NORM: Rainbow changes Python's sys.executable, breaking 0launch's GUI

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Sat Aug 21 10:46:47 EDT 2010


#2199: Rainbow changes Python's sys.executable, breaking 0launch's GUI
------------------------+---------------------------------------------------
    Reporter:  talex5   |          Owner:  sascha_silbe     
        Type:  defect   |         Status:  accepted         
    Priority:  Normal   |      Milestone:                   
   Component:  Rainbow  |        Version:  Git as of bugdate
    Severity:  Minor    |       Keywords:                   
Distribution:           |   Status_field:  Needinfo         
------------------------+---------------------------------------------------
Changes (by sascha_silbe):

  * status:  new => accepted
  * severity:  Unspecified => Minor
 * cc: mstone (added)
  * component:  0sugar => Rainbow
  * priority:  Unspecified by Maintainer => Normal
  * version:  Unspecified => Git as of bugdate
  * milestone:  Unspecified by Release Team =>
  * owner:  alsroot => sascha_silbe
  * distribution:  Unspecified =>


Comment:

 What happens is that Rainbow
 a) doesn't pass through PATH, but
 b) uses execvpe() to look up the executable, passing through argv[0]
 unresolved.

 Python apparently gets confused as it can't find itself using PATH. You
 can reproduce this without Rainbow:

 {{{
 sascha.silbe at twin:~$ env - python
 Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
 [GCC 4.3.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.executable
 '/home/sascha.silbe/'
 >>>
 sascha.silbe at twin:~$ env - PATH="$PATH" python
 Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
 [GCC 4.3.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.executable
 '/usr/bin/python'
 >>>
 sascha.silbe at twin:~$ env - /usr/bin/python
 Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
 [GCC 4.3.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.executable
 '/usr/bin/python'
 >>>
 sascha.silbe at twin:~$
 }}}

 As a workaround you can use an absolute path to call python:

 {{{
 sascha.silbe at twin:~/src/rainbow$ sudo rainbow-easy foo /usr/bin/python
 X-ifying isolated uid 10111.
 X-ifying envdir /tmp/tmpW-OW3E.
 -E XAUTHORITY=/var/spool/rainbow/2/uid_to_home_dir/10111/XAUTHORITY
 -E ICEAUTHORITY=/var/spool/rainbow/2/uid_to_home_dir/10111/ICEAUTHORITY
 -E USER=10111
 -E HOME=/var/spool/rainbow/2/uid_to_home_dir/10111
 -E DISPLAY=:0.0
 Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
 [GCC 4.3.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.executable
 '/usr/bin/python'
 >>>
 }}}


 I guess the right solution would be to:
 a) pass through PATH when using rainbow-easy and
 b) look up the executable ourselves, passing the absolute path to both
 execve() and argv[0].

 Michael, what do you think?

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/2199#comment:3>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list