diff options
author | Jeff King <peff@peff.net> | 2024-06-06 10:22:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-06 19:07:41 +0200 |
commit | 62c71ace4449df4b22a5d568f3699238ea032495 (patch) | |
tree | 8d3424daacd6e417270a2ec0043373afb8133c1e /delta-islands.h | |
parent | am: add explicit "--retry" option (diff) | |
download | git-62c71ace4449df4b22a5d568f3699238ea032495.tar.xz git-62c71ace4449df4b22a5d568f3699238ea032495.zip |
test-terminal: drop stdin handling
Since 18d8c26930 (test_terminal: redirect child process' stdin to a pty,
2015-08-04), we set up a pty and copy stdin to the child program. But
this ends up being racy; once we send all of the bytes and close the
descriptor, the child program will no longer see a terminal! isatty()
will return 0, and trying to read may return EIO, even if we didn't yet
get all of the bytes.
This was mentioned even in the commit message of 18d8c26930, but we
hacked around it by just sending an infinite input from /dev/zero (in
the intended case, we only cared about isatty(0), not reading actual
input).
And it came up again recently in:
https://lore.kernel.org/git/d42a55b1-1ba9-4cfb-9c3d-98ea4d86da33@gmail.com/
where we tried to actually send bytes, but they don't always all come
through. So this interface is somewhat of an accident waiting to happen;
a caller might not even care about stdin being a tty, but will get bit
by the flaky behavior.
One solution would probably be to avoid closing test_terminal's end of
the pty altogether. But then the other side would never see EOF on its
stdin. That may be OK for some cases, but it's another gotcha that
might cause races or deadlocks, depending on what the child expects to
read.
Let's instead just drop test_terminal's stdin feature completely. Since
the previous commit dropped the two cases from t4153 for which the
feature was originally added, there are no callers left that need it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'delta-islands.h')
0 files changed, 0 insertions, 0 deletions