plz build //:pex # Assume //:pex is a python_binary that outputs test.pex
mkdir /tmp/pathdir
cp -f plz-out/bin/test.pex /tmp/pathdir
export PATH="/tmp/pathdir:$PATH"
test.pex
This should invoke the default run-time Python interpreter with /tmp/pathdir/test.pex as the first argument (modulo any interpreter options), but instead the first argument is (equivalent to) ./test.pex, which then fails because test.pex isn't in the current working directory. This happens because the preamble always assumes that argv[0] is a path relative to the current working directory if it doesn't contain a / character. It should instead emulate the shell's (or execvp(3)'s) PATH searching behaviour in this case.
This should invoke the default run-time Python interpreter with
/tmp/pathdir/test.pexas the first argument (modulo any interpreter options), but instead the first argument is (equivalent to)./test.pex, which then fails becausetest.pexisn't in the current working directory. This happens because the preamble always assumes thatargv[0]is a path relative to the current working directory if it doesn't contain a/character. It should instead emulate the shell's (orexecvp(3)'s)PATHsearching behaviour in this case.