$ /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.
>>>
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:
The behavior of
env
is to callexecvp
which falls back to the output ofconfstr(_CS_PATH)
when noPATH
is set. This allowsenv -
to work in most cases.However,
python-exec2c
expectsPATH
to be set and does not fall back toconfstr(_CS_PATH)
when it isn't. This change enables this behavior by default when noFALLBACK_PATH
is provided at build time.I've tested this on my own Gentoo. The results are positive: