cool-easter-32542
05/31/2023, 1:43 AMstd::env::vars() which has docs that it panics instead of a signature / API that makes the fallibility manifest.
So the only way to run Pants in an ambient env with non-utf8 entries currently is to use --no-pantsd (and turn off the native client when available with PANTS_NO_NATIVE_CLIENT=1).
The 1st issue is in the native client here:
pants/src/rust/engine/client/src/main.rs
Line 88 in </pantsbuild/pants/commit/00a82f030fe625ee85c1c7a031743a6c6f927e9a|00a82f0>
Errors looks like the error above in scie-pants / `scie-jump`:
$ env PANTS_VERSION=2.17.0a1 $'FOO=B\xa5R' ./scie-pants --version
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "B\xA5R"', library/std/src/env.rs:171:83
The 2nd issue is in the PyNailgunClient used when starting pantsd for the first time or when no native client is present or active:
pants/src/rust/engine/src/externs/nailgun.rs
Lines 44 to 51 in </pantsbuild/pants/commit/00a82f030fe625ee85c1c7a031743a6c6f927e9a|00a82f0>
The error looks like:
$ env $'FOO=B\xa5R' ./scie-pants --version
Traceback (most recent call last):
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/bin/pants", line 8, in <module>
sys.exit(main())
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 123, in main
PantsLoader.main()
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 110, in main
cls.run_default_entrypoint()
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 92, in run_default_entrypoint
exit_code = runner.run(start_time)
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 89, in run
return remote_runner.run(start_time)
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/remote_pants_runner.py", line 123, in run
return self._connect_and_execute(pantsd_handle, executor, start_time)
File "/home/jsirois/.cache/nce/ff338ba9a8dd5abb25f774b6bf232ee14f99d98720d9c34bb15042fbe70eeb70/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/remote_pants_runner.py", line 161, in _connect_and_execute
return PyNailgunClient(port, executor).execute(command, args, modified_env)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udca5' in position 1: surrogates not allowed
pantsbuild/pants