Console crashes on startup with KeyError: 'PATH' for os.environ

Bug #529741 reported by David Coles on 2010-02-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
David Coles

Bug Description

IVLE intermitantly crashes when starting up the console. This appears to be an issue with ivle.interpret.execute_raw assuming that it will always have a PATH environment variable available.

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/ivle/dispatch/", line 164, in handler
  File "/usr/lib/python2.5/site-packages/ivle/webapp/base/", line 141, in render
    outjson = op(req, **opargs)
  File "/usr/lib/python2.5/site-packages/ivle/webapp/console/", line 54, in start
  File "/usr/lib/python2.5/site-packages/ivle/", line 128, in __init__
  File "/usr/lib/python2.5/site-packages/ivle/", line 165, in restart
    self.working_dir, "/usr/bin/python", args)
  File "/usr/lib/python2.5/site-packages/ivle/", line 450, in execute_raw
    'PATH': os.environ['PATH'],
  File "/usr/lib/python2.5/", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'PATH'

Solution is probably to hard code PATH to "/bin:/usr/bin:/usr/local/bin"

Related branches

William Grant (wgrant) wrote :

This happened locally just before release, but an Apache restart fixed it. It's now happening on informatics7.

We should fix this on two levels:
 - We should hardcode PATH.
 - We should prevent ivle.interpret from mutating os.environ; subprocess.Popen takes an "env" argument.

David Coles (dcoles) wrote :

Fixed in r1776 and r1777. Use a hard coded path for ivle.interpret.execute_raw and use set up a sanitized environment that we pass to subprocess.Popen for ivle.execute_cgi.

Changed in ivle:
status: Triaged → Fix Committed
Matt Giuca (mgiuca) wrote :

Why is there a separate bug status for milestone 1.0?

William Grant (wgrant) wrote :

It's actually a separate task for the 1.0 *series*, since David misunderstood the rather confusing "Target to release" UI. That's generally used for requesting a backport to a maintenance series, but we don't use multiple series (yet).

David Coles (dcoles) wrote :

Released in 1.0.1

Changed in ivle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers