https://pantsbuild.org/ logo
#general
Title
# general
c

cool-printer-74432

07/01/2022, 5:15 PM
Has anyone had issues with help working in
pants repl
? E.g.,
help(str)
in
repl
gives me empty output.
I think this is an issue passing text to
PAGER
because
pydoc.render_doc(str)
does generate the right text.
e

enough-analyst-54434

07/01/2022, 5:22 PM
What version of Pants? I just tried
./pants repl src/python/pants/util/strutil.py
in the Pants repo on main and
help(str)
in the session got me help output. My
PAGER
is unset though.
c

cool-printer-74432

07/01/2022, 5:23 PM
2.11.1rc2
Happens for me even with
PAGER= ./pants repl
Just tested calling
pydoc.pager("Hello, world!")
directly, this definitely seems to be the problem part. Empty output in
pants repl
but works in a vanilla python3.9 interpreter.
e

enough-analyst-54434

07/01/2022, 5:35 PM
I just checked out the 2.11.x branch (so 2.11.1, which was just released on the 28th), and both
help(str)
and `pydoc.pager("Hello, world!")`work for me. The changes between 2.11.1rc2 and 2.11.1 do not indicate a fix; so it looks like I don't repro.
Does this repro for a colleague?
Another angle: is the
sys.executable
in the repl session the same as the one you've tried manually?
c

cool-printer-74432

07/01/2022, 5:39 PM
Personal project, so no colleague to test. 🙂
e

enough-analyst-54434

07/01/2022, 5:39 PM
Ok - the sys.executable check then may be enlightening.
The hunch there is
./pants repl
picks an interpreter with a -handwave- issue vs. your manual repl tests use a different interpreter.
c

cool-printer-74432

07/01/2022, 5:44 PM
sys.executable
is the same binary in both cases (
/usr/bin/python3.9
). Also, looks like
PAGER=cat
works. Which makes it sound like this may be terminal issues--everyone's favorite part of Linux. But I can probably track down the issue with a bit more investigation...
e

enough-analyst-54434

07/01/2022, 5:45 PM
Ok. Thanks for anything you can dig up. This has been a historically finicky part of the codebase since pushing a terminal through to the pantsd daemon is non-trivial.
c

cool-printer-74432

07/01/2022, 6:18 PM
I get interesting different behaviors between
less
and
more
. And definitely unrelated to pydoc, I can repro with any content long enough to trigger pagination, E.g.,
/proc/cpuinfo
.
subprocess.run(["less", "/proc/cpuinfo"])
gives me no output.
subprocess.run(["more", "/proc/cpuinfo"])
gives me the first page and then behaves as if it's receiving no input.
subprocess.run(["strace", "-o", "/tmp/lessout.strace", "less", "/proc/cpuinfo"])
is informative.
less
gets
ENXIO
trying to open
/dev/tty
and everything goes downhill from there.
e

enough-analyst-54434

07/01/2022, 6:22 PM
Do you have other interesting env vars you know of in your environment? I need to double check interactive processes used by
./pants run
and
./pants repl
, but standard processes Pants runs have hermetic envs where we only let a limited set of env variables leak in from your environment.
c

cool-printer-74432

07/01/2022, 6:24 PM
os.environ
looks like I've got all my normal environment. Doesn't appear to be sanitized.
e

enough-analyst-54434

07/01/2022, 6:24 PM
Ok. Can you try a repl session with
--no-pantsd
?
c

cool-printer-74432

07/01/2022, 6:25 PM
less
works normally with
--no-pantsd
And it doesn't look like it's anything funky in my environment. I can repro with
env -i PATH="$PATH" HOME="$HOME" TERM="$TERM" ./pants repl
e

enough-analyst-54434

07/01/2022, 6:28 PM
Ok. This sounds bug-worthy. I'm not super fluent with this part of the codebase and I'm loathe to destroy good debugging state, but a destructive step would be to kill all pantsd processes and then try again with a normal
./pants repl ...
run - which will start up a fresh pantsd.
c

cool-printer-74432

07/01/2022, 6:32 PM
Still fails with restarted pantsd processes. FWIW, I don't recall help() ever working for me, so I don't think pantsd state is likely to matter. Let me go file a bug with what we know so far.
e

enough-analyst-54434

07/01/2022, 6:32 PM
Thanks Steve.
c

cool-printer-74432

07/01/2022, 7:24 PM
5 Views