Skip to content

Fix to allow more correct isatty()

Gil Pedersen linux-serial lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1tty: respond to TIOCGWINSZ when hungdrivers/tty/tty_io.c+22 -73 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] Fix to allow more correct isatty()

This patch comes from an issue discovered in systemd, where it can fail to restore a text TTY session after a GUI session is stopped when compiled with musl libc.

The specific systemd integration issue is currently resolved in the musl master branch by closer aligning the implementation with glibc, but the underlying isatty() implementation is still flawed since it can return 0 (false) for something that is definitely a TTY. Essentially both musl and glibc give up correctly handling this case on Linux due to inadequate/buggy kernel APIs.

Thus I am proposing this patch as a solution to fix the kernel APIs. An alternative fix could be to add a new IOCTL to specifically handle this, but that seems overkill.

Gil Pedersen (1):
tty: respond to TIOCGWINSZ when hung

 drivers/tty/tty_io.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
Signature · 1 line
2.45.2