Skip to content

Commit

Permalink
Handle venv path special chars in coursier fetch (#15701)
Browse files Browse the repository at this point in the history
On one system (a gentoo linux  box), uname reports a very verbose
processor name which is then used to build the pants venv path. That
verbose processor name includes "Intel(R)" and other symbols including
parentheses and at: `()@`

The coursier fetch script did not escape the python_path, so running
`./pants lint ::` on the pants codebase results in this error:

```
__coursier/coursier_fetch_wrapper_script.sh: line 11: syntax error near unexpected token `R'
```

The full path that triggered this error is:
```
/home/cognifloyd/.cache/pants/pants_dev_deps/Linux.x86_64.Intel(R).Core(TM)[email protected]/bin/python
```

This PR fixes that by wrapping python_path in single quotes in the
coursier script.

[ci skip-rust]
[ci skip-build-wheels]
  • Loading branch information
cognifloyd authored Jun 8, 2022
1 parent a7c3c19 commit dabda34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/python/pants/jvm/resolve/coursier_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ async def setup_coursier(
coursier_wrapper_script = COURSIER_FETCH_WRAPPER_SCRIPT.format(
repos_args=repos_args,
coursier_working_directory=Coursier.working_directory_placeholder,
python_path=python.path,
coursier_bin_dir=Coursier.bin_dir,
python_path=shlex.quote(python.path),
coursier_bin_dir=shlex.quote(Coursier.bin_dir),
)

post_process_stderr = POST_PROCESS_COURSIER_STDERR_SCRIPT.format(python_path=python.path)
Expand Down

0 comments on commit dabda34

Please sign in to comment.