[Bug 260938] script(1) hangs when child doesn't read input fast enough

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 10 Jan 2022 15:36:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260938

--- Comment #3 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=c0ba4c2ee2c48ec9892d10c0aca797f3685c53ee

commit c0ba4c2ee2c48ec9892d10c0aca797f3685c53ee
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-01-08 13:19:14 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-10 15:34:51 +0000

    script(1): work around slow reading child

    If child is slow reading from its input, or even completely stops doing
    the read, script(1) hangs in write(2) to the pts master waiting until
    there is a space in the terminal discipline buffer.  This also stops
    handling any outer io, as well as child output.

    Work around the problem by making pts master fd non-blocking, and be
    prepared for short writes to it.  The data to be written to master is
    buffered in the tailq which is processed when select(2) detects that
    master is ready for write.

    PR:     260938
    Reported by:    наб <nabijaczleweli@nabijaczleweli.xyz>
    See also:       https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003095
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D33789

 usr.bin/script/script.c | 56 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 51 insertions(+), 5 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.