projg2 / python-exec

Wrapper for multi-implementation install of Python scripts and executables
BSD 2-Clause "Simplified" License
13 stars 6 forks source link

Use _CS_PATH as fallback PATH by default. #5

Closed rynbrd closed 7 years ago

rynbrd commented 7 years ago

This allows python-exec to behave correct when called via /usr/bin/env - python.

This was discovered at https://github.com/tensorflow/tensorflow/issues/10529.

This is easily reproducible by running it:

$ /usr/bin/env - python
python: unable to find executable in PATH.

The behavior of env is to call execvp which falls back to the output of confstr(_CS_PATH) when no PATH is set. This allows env - to work in most cases.

However, python-exec2c expects PATH to be set and does not fall back to confstr(_CS_PATH) when it isn't. This change enables this behavior by default when no FALLBACK_PATH is provided at build time.

I've tested this on my own Gentoo. The results are positive:

$ /usr/bin/env - python
Python 2.7.12 (default, Aug  2 2017, 11:41:16) 
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
mgorny commented 7 years ago

In any case, the current behavior is intentional and the bug you're trying to fix is already fixed in the current git.