Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolutize all of the execute_pex_args in the venv script. #12727

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Sep 1, 2021

The absolutizing of execute_pex_args was being applied to the entire list of arguments, rather than to individual arguments. When:

  1. using a working directory
  2. hitting the Process cache for VenvPex creation/seeding and missing for execution
  3. missing the PEX venv cache

... the relevant execute_pex_args code would run to seed the venv, and fail with:

pants.engine.process.ProcessExecutionFailure: Process 'Run the pex and check its cwd' failed with exit code 2.
stdout:

stderr:
<snip>/python3.6: can't open file 'test.pex': [Errno 2] No such file or directory

...because the PEX filename was not absolutized.

Add a reproducing test, and fix by absolutizing each argument.

[ci skip-rust]
[ci skip-build-wheels]

@stuhood stuhood added this to the 2.7.x milestone Sep 1, 2021
[ci skip-rust]

[ci skip-build-wheels]
@stuhood stuhood force-pushed the stuhood/absolutize-all-of-argv branch from 77f972c to 694952f Compare September 1, 2021 18:58
@stuhood stuhood enabled auto-merge (squash) September 1, 2021 18:59
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for figuring this out!

@stuhood stuhood merged commit d3cd2ed into pantsbuild:main Sep 1, 2021
@stuhood stuhood deleted the stuhood/absolutize-all-of-argv branch September 1, 2021 19:30
@@ -943,6 +944,7 @@ async def create_venv_pex(
pex=pex.script,
python=python.script,
bin=FrozenDict((bin_name, venv_script.script) for bin_name, venv_script in scripts.items()),
venv_rel_dir=venv_rel_dir.as_posix(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Folks have a habit of doing this, but str(venv_rel_dir) will be Windows-proof and is actually correct today too.

@@ -852,6 +852,7 @@ class VenvPex:
pex: Script
python: Script
bin: FrozenDict[str, Script]
venv_rel_dir: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably good to tack on ~ # for tests to be friendly to future refactorers.

stuhood added a commit to stuhood/pants that referenced this pull request Sep 1, 2021
…d#12727)

The absolutizing of `execute_pex_args` was being applied to the entire list of arguments, rather than to individual arguments. When:
1. using a working directory
2. hitting the `Process` cache for VenvPex creation/seeding and missing for execution
3. missing the PEX venv cache

... the relevant `execute_pex_args` code would run to seed the venv, and fail with:
```
pants.engine.process.ProcessExecutionFailure: Process 'Run the pex and check its cwd' failed with exit code 2.
stdout:

stderr:
<snip>/python3.6: can't open file 'test.pex': [Errno 2] No such file or directory
```
...because the PEX filename was not absolutized.

Add a reproducing test, and fix by absolutizing each argument.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit that referenced this pull request Sep 1, 2021
…k of #12727) (#12729)

The absolutizing of `execute_pex_args` was being applied to the entire list of arguments, rather than to individual arguments. When:
1. using a working directory
2. hitting the `Process` cache for VenvPex creation/seeding and missing for execution
3. missing the PEX venv cache

... the relevant `execute_pex_args` code would run to seed the venv, and fail with:
```
pants.engine.process.ProcessExecutionFailure: Process 'Run the pex and check its cwd' failed with exit code 2.
stdout:

stderr:
<snip>/python3.6: can't open file 'test.pex': [Errno 2] No such file or directory
```
...because the PEX filename was not absolutized.

Add a reproducing test, and fix by absolutizing each argument.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants