Skip to content

.pex files aren't runnable when invoked off the PATH #298

@chrisnovakovic

Description

@chrisnovakovic
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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions