[pypy-issue] Issue #1966: When run in a chroot, pypy will sometimes fail to import builtin modules (pypy/pypy)

JakobKrainz issues-reply at bitbucket.org
Mon Jan 26 17:44:20 CET 2015


New issue 1966: When run in a chroot, pypy will sometimes fail to import builtin modules
https://bitbucket.org/pypy/pypy/issue/1966/when-run-in-a-chroot-pypy-will-sometimes

JakobKrainz:

When running in a chroot where $HOME is not set and 
/etc/passwd does not contain an entry for the current UID,
pypy 2.4.0 will fail to import some builtin modules.

More precisely, the script

```
#!python

a = raw_input()
b = raw_input()

n = a.count("x")

for x in range(n + 4):
	if eval(a, dict(x=x)) != eval(b, dict(x=x)):
		print "NOT EQUIVALENT"
		exit()
print "EQUIVALENT"
```

will produce the following output:


```
'import site' failed
Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "K.py", line 9, in <module>
    exit()
NameError: global name 'exit' is not defined
```

Adding the current user to /etc/passwd or setting $HOME fixes this.






More information about the pypy-issue mailing list